/* The Track order button with the package sliding along the timeline. A sheet of warm paper with a window light and a
   fine grain; in the middle one pill of porcelain. Closed it says Track order; pressed, the same pill (.tk__body, its
   width and height moved only by GSAP) stretches into a timeline: the arrival window on top, an engraved line with
   four thin ticks, the four stops under it, and a small kraft package riding the line. The package box (.tk__pkg) is
   moved only by script.js, its child (.tk__pkg-box) only by GSAP for the tilt and the squash. */
:root {
  --paper: #eee7db;            /* the sheet of paper behind */
  --paper-light: #fbf7f0;      /* the window light on the paper */
  --paper-shade: #d9cfbf;      /* the paper in shadow, at the edges */
  --porcelain: #fcfaf6;        /* the pill's porcelain */
  --porcelain-low: #eee8de;    /* the porcelain at the bottom, away from the light */
  --ink: #1f1b17;              /* the words, the disc */
  --muted: #8d8376;            /* the small words, the stops still to come */
  --accent: #e5602b;           /* the accent light: the stops reached, the line, the check */
  --accent-deep: #b9441b;      /* the accent in shadow */
  --kraft: #c89a64;            /* the package's cardboard */
  --kraft-deep: #9a7142;       /* the cardboard in shadow, the tape */
  --cream: #f7f1e7;            /* the words on the dark disc */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* the paper: a window light from the top left, a soft fall of light through a window frame, the edges in shadow,
   a fine grain */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(90vw, 760px) min(64vh, 460px) at 36% 30%, var(--paper-light), transparent 70%),
    linear-gradient(118deg, transparent 38%, rgba(255, 252, 245, 0.42) 46%, transparent 58%),
    radial-gradient(140% 120% at 50% 50%, transparent 52%, color-mix(in srgb, var(--paper-shade) 85%, transparent) 100%),
    var(--paper);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
  mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* the piece: as wide as the open timeline, so the frame never moves */
.tk {
  --W: min(640px, 92vw, 100%);
  --pad: 34px;
  position: relative;
  z-index: 1;
  width: var(--W);
  height: min(150px, 34vh);
  display: grid;
  place-items: center;
}

/* the soft shadow the pill throws on the paper (GSAP widens it with the pill) */
.tk__floor {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 236px;
  height: 34px;
  margin: 22px 0 0 -118px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(70, 48, 28, 0.24), rgba(70, 48, 28, 0.08) 60%, transparent);
  filter: blur(9px);
  pointer-events: none;
}

.tk__btn {
  position: relative;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.tk__btn:focus-visible .tk__edge {
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--accent),
    inset 0 1px 0 #fff,
    inset 0 0 0 1px rgba(60, 40, 20, 0.08);
}

.tk__body {
  position: relative;
  display: block;
  width: 236px;
  height: 60px;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(60, 40, 22, 0.14),
    0 4px 10px -3px rgba(60, 40, 22, 0.16),
    0 16px 30px -14px rgba(60, 40, 22, 0.32),
    0 34px 60px -30px rgba(60, 40, 22, 0.34);
}

.tk__fill,
.tk__light,
.tk__sheen,
.tk__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* porcelain: lighter on top, a warm shade at the bottom and the faintest glaze grain */
.tk__fill {
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.95), transparent 60%),
    linear-gradient(180deg, var(--porcelain), var(--porcelain-low));
}

.tk__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.42 0 0 0 0 0.34 0 0 0 0.08 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the light under the pointer */
.tk__light {
  opacity: 0;
  background: radial-gradient(160px 80px at var(--lx, 50%) var(--ly, 0%), rgba(255, 236, 214, 0.75), transparent 70%);
}

/* the reflection that crosses the pill when it opens and on the delivery */
.tk__sheen {
  overflow: hidden;
}

.tk__sheen-band {
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  width: 34%;
  opacity: 0;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55) 46%, rgba(255, 246, 236, 0.85) 52%, transparent);
}

/* the edges: a white line on top, a warm shade at the bottom, a hairline all round */
.tk__edge {
  z-index: 5;
  box-shadow:
    inset 0 1px 0 #fff,
    inset 0 -2px 3px rgba(120, 90, 60, 0.12),
    inset 0 0 0 1px rgba(60, 40, 20, 0.08);
}

/* ---------------------------------------------------------------- closed */
.tk__closed {
  position: absolute;
  left: 0;
  top: 50%;
  width: 236px;
  height: 60px;
  margin-top: -30px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 9px;
  z-index: 2;
}

.tk__disc {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #3a332c, var(--ink) 75%);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 230, 0.18),
    inset 0 -2px 3px rgba(0, 0, 0, 0.4),
    0 2px 5px -1px rgba(40, 25, 12, 0.35);
}

.tk__glyph {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tk__glyph-box,
.tk__glyph-fold {
  stroke: var(--cream);
  stroke-width: 1.5;
}

.tk__glyph-tape {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.tk__words {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.tk__title {
  font-size: 15.5px;
  font-weight: 640;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}

.tk__sub {
  font-size: 11.5px;
  font-weight: 480;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tk__chev {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
}

/* ---------------------------------------------------------------- open */
.tk__open {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--Wpx, 640px);
  height: 88px;
  margin: -44px 0 0 calc(var(--Wpx, 640px) / -2);
  z-index: 3;
  visibility: hidden;
}

.tk__top {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 15px;
  height: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* the arrival window: two lines in a window one line tall, rolled by GSAP */
.tk__eta {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 20px;
  overflow: hidden;
  text-align: left;
}

.tk__eta-line {
  position: absolute;
  left: 0;
  top: 0;
  height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  line-height: 20px;
}

.tk__eta-line[data-eta-line='1'] {
  visibility: hidden;
}

.tk__eta-word {
  color: var(--muted);
  font-weight: 500;
}

.tk__time {
  display: inline-flex;
  font-weight: 660;
  color: var(--ink);
  letter-spacing: -0.005em;
}

/* a digit drum: a window one line tall over a column of 0-9 twice */
.tk__drum {
  position: relative;
  display: inline-block;
  height: 20px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 28%, #000 72%, transparent);
}

.tk__drum-col {
  display: block;
}

.tk__drum-col span {
  display: block;
  height: 20px;
  line-height: 20px;
  text-align: center;
}

.tk__sep {
  display: inline-block;
  line-height: 20px;
}

.tk__ref {
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tk__fold {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}

/* the line: an engraved groove, the accent part already travelled, the flare and the four ticks */
.tk__track {
  position: absolute;
  left: 0;
  right: 0;
  top: 40px;
  height: 22px;
}

.tk__groove,
.tk__done {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  top: 15px;
  height: 2px;
  border-radius: 2px;
}

.tk__groove {
  background: rgba(70, 50, 30, 0.13);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 1px 1px rgba(70, 50, 30, 0.12);
}

.tk__done {
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, var(--porcelain)), var(--accent));
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* the accent light on the stop reached: long and flat like an anamorphic flare, never a dot */
.tk__flare {
  position: absolute;
  left: 0;
  top: 16px;
  width: 120px;
  height: 18px;
  margin: -9px 0 0 -60px;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 42%, transparent), color-mix(in srgb, var(--accent) 12%, transparent) 55%, transparent);
  filter: blur(2px);
  pointer-events: none;
}

.tk__tick {
  position: absolute;
  left: 0;
  top: 12px;
  width: 2px;
  height: 8px;
  margin-left: -1px;
  border-radius: 2px;
  background: rgba(70, 50, 30, 0.28);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.9);
}

.tk__tick-on {
  background: var(--accent);
}

/* the package: a box for script.js, the cardboard inside for GSAP */
.tk__pkg {
  position: absolute;
  left: 0;
  top: -3px;
  width: 22px;
  height: 18px;
  margin-left: -11px;
}

.tk__pkg-shadow {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -4px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60, 40, 20, 0.34), transparent);
}

.tk__pkg-box {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
}

.tk__pkg-box svg {
  display: block;
  width: 22px;
  height: 18px;
  overflow: visible;
}

.tk__pkg-side {
  fill: var(--kraft);
  stroke: var(--kraft-deep);
  stroke-width: 0.8;
}

.tk__pkg-lid {
  fill: color-mix(in srgb, var(--kraft) 82%, white);
  stroke: var(--kraft-deep);
  stroke-width: 0.8;
}

.tk__pkg-tape {
  fill: var(--accent);
}

.tk__pkg-label {
  fill: none;
  stroke: rgba(255, 248, 236, 0.85);
  stroke-width: 1.1;
  stroke-linecap: round;
}

.tk__check {
  position: absolute;
  left: 0;
  top: 5px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--porcelain) 62%, transparent 64%);
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  visibility: hidden;
}

.tk__check-ring {
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.tk__check-mark {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.tk__labels {
  position: absolute;
  left: 0;
  right: 0;
  top: 64px;
  height: 14px;
}

.tk__label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  font-variation-settings: 'wdth' var(--wd, 100);
  color: var(--muted);
  white-space: nowrap;
}

.tk__label-on {
  color: var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .tk__btn:hover .tk__chev {
    opacity: 0.85;
  }
}

/* the phone: the same timeline, tighter */
@media (max-width: 520px) {
  .tk {
    --pad: 24px;
  }

  .tk__ref {
    display: none;
  }

  .tk__eta-line {
    font-size: 12.5px;
  }

  .tk__label {
    font-size: 10.5px;
  }
}
