/* =====================================================================
   g:when — the date guess (module: g-when). Three momentum snap wheels (month / day / year) with
   drum perspective, a gold selection band, and the "Lock it in" Flip into one spoken date.
   Only transform / opacity animate; the drum rows are driven by GSAP quickSetters (rotateX / scale / z / opacity).
   ===================================================================== */

/* centre-band scrim: the photo breathes at the top, the wheels sit on a near-solid band */
.scene[data-step="g:when"] .bg::after {
  background: linear-gradient(to bottom, rgba(var(--scrim), 0.3) 0%, rgba(var(--scrim), 0.5) 20%, rgba(var(--scrim), 0.84) 38%, rgba(var(--scrim), 0.86) 80%, rgba(var(--scrim), 0.95) 100%);
}
.when .fg.bottom { padding-bottom: calc(var(--safe-bottom) + 72px); }

/* the narrator slot is reserved so the wheels never jump when the bubble types in */
.when .when-aside { min-height: 82px; }
.when .when-aside .aside { margin-top: 16px; }

/* screen-reader line: the settled date ("Selected May 14, 2027") */
.when .sr-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- wheels ---------- */
.when .wheels {
  position: relative; display: grid; grid-template-columns: 1.4fr 1fr 1.1fr; gap: 8px; height: 280px; margin-top: 8px;
  overflow: clip; perspective: 800px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
}
.when .wheel {
  position: relative; height: 100%; perspective: 800px; border-radius: var(--r-s); outline: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.when .wheel:active { cursor: grabbing; }
.when .wheel:focus-visible { box-shadow: inset 0 0 0 1px var(--cream-30); }
.when .wheels.locked .wheel { pointer-events: none; cursor: default; }
/* the drum sits so row 0 is centred at y = 0; the scene translates it by -idx × 56px */
.when .drum { list-style: none; margin: 0; padding: 0; position: absolute; left: 0; right: 0; top: calc(50% - 28px); transform-style: preserve-3d; will-change: transform; }
.when .drum li {
  height: 56px; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0;
  font-family: var(--display); font-weight: 300; line-height: 1; color: var(--cream); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.when .drum li.off { visibility: hidden; }
.when .drum li > span { display: inline-block; transform-origin: 50% 50%; }
.when .wheel.month li { font-style: italic; font-weight: 400; font-size: 26px; letter-spacing: -0.005em; font-variation-settings: "WONK" 1, "SOFT" 30, "opsz" 48; }
.when .wheel.day li { font-size: 40px; letter-spacing: -0.02em; font-variation-settings: "opsz" 72; }
.when .wheel.year li { font-size: 30px; letter-spacing: 0.04em; font-variation-settings: "opsz" 48; }

/* selection band: glass with two gold hairlines ±32px from the centre (they flash to full on every tick) */
.when .band { position: absolute; left: 0; right: 0; top: 50%; height: 64px; transform: translateY(-50%); z-index: 2; pointer-events: none; background: rgba(244, 238, 227, 0.06); border-radius: 2px; transition: background 0.4s ease; }
.when .band .hair { position: absolute; left: 0; right: 0; height: var(--hairline); background: var(--gold); opacity: 0.7; }
.when .band .hair.t { top: 0; } .when .band .hair.b { bottom: 0; }
.when .wheels.locked .band { background: rgba(201, 164, 92, 0.1); }

/* the spoken date the centre rows Flip into on lock: "May 14, 2027" */
.when .said {
  position: absolute; left: 0; right: 0; top: 50%; z-index: 3; transform: translateY(-50%); margin: 0; pointer-events: none;
  display: none; justify-content: center; align-items: baseline; gap: 0.26em;
  font-family: var(--display); font-weight: 300; font-size: 34px; line-height: 1; letter-spacing: -0.01em; color: var(--cream);
  font-variant-numeric: tabular-nums lining-nums; font-variation-settings: "opsz" 72; white-space: nowrap;
  text-shadow: 0 2px 18px rgba(5, 8, 15, 0.6);
}
.when .said.on { display: flex; }
.when .said > span, .when .said .d { display: inline-block; }
.when .said span > span { display: inline-block; }
.when .said .m { font-style: italic; font-weight: 400; font-variation-settings: "WONK" 1, "SOFT" 30, "opsz" 72; }
.when .said .comma { font-style: normal; opacity: 0; }
.when .said.fallback { position: static; transform: none; min-height: 56px; }

/* lock button states */
.when .answers { margin-top: 24px; }
.when .link { align-self: center; }

/* no-GSAP fallback: three selects */
.when .date-row { display: grid; grid-template-columns: 1.5fr 1fr 1.15fr; gap: 8px; }
.when .sel { position: relative; }
.when .sel::after { content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--cream-60); border-bottom: 1.5px solid var(--cream-60); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .when .wheels, .when .wheel { perspective: none; }
  .when .drum { transform-style: flat; }
  .when .drum li { will-change: auto; }
}

/* The wedding year is fixed; only month and day can be changed. */
.when .wheel.year { cursor: default; pointer-events: none; }
