/* ===================== DevFest 2027 ===================== */
:root {
  /* Colors sampled from the artwork */
  --sky-day: #b6d2e8;      /* top edge of skyline-day-wide.jpg (middle) */
  --sky-sunset: #a8989a;   /* top edge of skyline-sunset-wide.jpg (middle) */
  --water-day: #60adaf;
  --water-sunset: #306265;
  --water-deep: #173638;
  --ink: #1d2a44;          /* the dark outline color */
  --cream: #f6e7c8;        /* banner / window glow */
  --glow: #ffe9a8;
  --sea-top: #50aab5;      /* top edge of the sea background */

  --font-hand: "Gaegu", "Comic Sans MS", cursive;
  --font-body: "Nunito", system-ui, sans-serif;

  /* Updated by script.js: 0 = day, 1 = sunset */
  --p: 0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--water-deep);
}

/* ===================== HERO ===================== */
.hero {
  position: relative;
  height: 240vh;               /* how much scrolling the day->sunset takes */
}
.hero__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;              /* mobile: the area actually visible */
  overflow: hidden;
  /* cqw/cqh = this box (the visible window, without the desktop scrollbar) */
  container-type: size;
}

/* ---------- Sky above the art (portrait only) ---------- */
/* The art's top-edge colors, sampled left / middle / right, so the image's
   top edge blends straight into it. */
.sky { position: absolute; inset: 0; display: none; }
.sky--day    { background: linear-gradient(90deg, #adc9e2, var(--sky-day) 50%, #bed9ec); }
.sky--sunset { background: linear-gradient(90deg, #a79fa6, var(--sky-sunset) 50%, #ac979a); opacity: var(--p); }

/* ---------- Stage = the displayed 16:9 image ---------- */
/* Hotspots, boat and blimp are positioned in % of the stage, so they stay
   locked to the drawing. The variables below are inherited by them too.

   Landscape: the image COVERS the window, centered. Squarer windows lose some
   of the outer left/right edges (the labeled buildings are at 22-74% of the
   width, so they stay visible down to a 1:1 window). Ultrawide windows lose
   sky and water, centered, but never more than:
     --crop-top-max  from the top    (Tracks roof at 16.6%; antenna tip 5.7%)
     --keep-bottom   kept at the bottom (building hotspots end at 91.1%)
   If both can't fit, the top limit wins.
   Portrait: see the @container rule below. */
.stage {
  --crop-top-max: 0.163;
  --keep-bottom: 0.915;
  /* Blimp (see .blimp below). Width: 65% of the art, but at least 936px, and
     never wider than the window. Its bottom stays above the drawn building
     labels (the highest, FAQ, is 34% down; the blimp ends ~25% down). */
  --blimp-w: 0.65;
  --bw: min(max(var(--blimp-w) * var(--art-w), 936px), 96cqw);
  /* 3% from the art's top, or just below the window's top when the sky is cropped */
  --blimp-top: max(3%, -1 * var(--art-top) + 1.5cqh);
  /* Boat (see .boat below). Visible water = the art's bottom 12% minus
     whatever is cropped below the window. The hull is the lower third of the
     boat image, so a boat up to 4.6x the water strip wide still floats with
     the waterline at least halfway up the hull. --bdrift = side-to-side drift,
     as a fraction of the boat's width. */
  --water-vis: calc(0.12 * var(--art-h) - max(0px, var(--art-crop-bottom)));
  --boat-w: clamp(140px, min(14cqw, 4.6 * var(--water-vis)), 300px);
  --bdrift: 0.08;
  --art-w: max(100cqw, 100cqh * 16 / 9);
  --art-h: calc(var(--art-w) * 9 / 16);
  --art-left: calc((100cqw - var(--art-w)) / 2);
  --art-overflow: calc(var(--art-h) - 100cqh);
  --art-top: calc(-1 * min(max(var(--art-overflow) / 2,
                               var(--art-overflow) - var(--art-h) * (1 - var(--keep-bottom))),
                           var(--art-h) * var(--crop-top-max)));
  /* how much of the art is hidden below the window */
  --art-crop-bottom: calc(var(--art-h) + var(--art-top) - 100cqh);

  position: absolute;
  left: var(--art-left);
  top: var(--art-top);
  width: var(--art-w);
  height: var(--art-h);
}
/* Portrait: covering would cut off most buildings, so fit the full width,
   anchor to the bottom and show the sky color above. */
/* Phones (under 600px wide): the blimp is nearly the full screen width
   and shows the compact one-line countdown. */
@container (width < 600px) {
  .stage {
    --bw: 96cqw;
    /* boat: 28% of the screen; small drift so it clears the Schedule hotspot */
    --boat-w: 28cqw;
    --bdrift: 0.02;
  }
}
@container (aspect-ratio < 1) {
  .stage {
    --art-w: 100cqw;
    --art-top: calc(100cqh - var(--art-h));
    /* the art is short here, so the blimp flies in the sky above it: its
       bottom 5% down the art, above the antenna tip (5.7%). 5.4 = the blimp
       image's width/height. */
    --blimp-top: calc(5% - var(--bw) / 5.4);
  }
  .sky { display: block; }
  /* No edge fade: the sky colors are the art's own top edge, so the join is
     invisible; fading both stacked images would let day show through at sunset. */
}
.skyline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.skyline--sunset { opacity: var(--p); }

/* ---------- Clickable buildings ---------- */
.hotspot {
  position: absolute;
  border-radius: 10px;
  /* label text is already in the drawing; keep it for screen readers only */
  color: transparent;
  font-size: 0;
  outline: none;
}
.hotspot::before {             /* soft glow on hover */
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 40%;
  background: radial-gradient(closest-side, rgba(255, 233, 168, .55), transparent);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity .25s ease;
}
.hotspot::after {              /* little tag that pops up */
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: .5em;                /* inside the building, so it's never cropped */
  transform: translate(-50%, 6px);
  padding: .15em .7em;
  font: 700 clamp(14px, 1.3vw, 20px)/1.4 var(--font-hand);
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.hotspot:hover::before, .hotspot:focus-visible::before { opacity: 1; }
.hotspot:hover::after,  .hotspot:focus-visible::after  { opacity: 1; transform: translate(-50%, 0); }

/* Positions as % of the artwork (left, top, width, height).
   Schedule overlaps About; it comes later in the HTML so it's on top. */
.hotspot--about    { left: 22.7%; top: 48.3%; width: 9.4%;  height: 42.8%; }
.hotspot--schedule { left: 28.3%; top: 75.2%; width: 10.5%; height: 15.9%; }
.hotspot--tracks   { left: 43.3%; top: 16.6%; width: 6.0%;  height: 73.8%; }
.hotspot--faq      { left: 67.9%; top: 34.2%; width: 5.5%;  height: 20.0%; }
.hotspot--judges   { left: 66.2%; top: 54.2%; width: 6.6%;  height: 33.5%; }

/* ---------- Sponsors boat (inside .stage) ---------- */
/* --boat-w wide (set on .stage). Placed against the VISIBLE window, since the
   art can be cropped:
   - bottom: just above the window's bottom edge (or 1% up from the art's
     bottom if that's visible). The hull is 59-92% down the image and the bob
     (4% down) and rock stay inside the image's transparent bottom margin, so
     nothing is ever cut off.
   - left: 6% of the window (cqw), but pulled left if the hull's tip (91% of
     the image width, plus drift) would reach the Schedule hotspot (28.3% of
     the art); never so far left that the drift or the hover scale cuts it
     off. (var(--art-left) converts window x to stage x.)
   Three loops with unrelated durations so the motion never visibly repeats:
   drift (side to side, on the link), bob (up/down) and rock (tilt) on the img.
   They animate the separate translate/rotate properties, so the hover
   `transform` still works on top of them. */
.boat {
  position: absolute;
  width: var(--boat-w);
  left: calc(max(var(--boat-w) * (var(--bdrift) + 0.03) + 2px,
                 min(6cqw, var(--art-left) + 0.283 * var(--art-w)
                           - var(--boat-w) * (0.91 + var(--bdrift)) - 2px))
             - var(--art-left));
  bottom: max(1%, var(--art-crop-bottom) + 2px);
  z-index: 3;
  animation: boat-drift 13.7s ease-in-out infinite;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .15));
  pointer-events: none;        /* only the clipped img below catches the pointer */
}
.boat img {
  width: 100%;
  display: block;
  transform-origin: 50% 85%;
  animation: boat-bob 3.3s ease-in-out infinite,
             boat-rock 5.1s ease-in-out infinite;
  transition: transform .25s ease;
  /* Only the drawn boat (mast, sail, hull) is clickable/hoverable, not the
     transparent corners of the image, so it never blocks a building hotspot
     behind it (clicks still go to the link). Traced from boat-sponsors.png,
     in % of the image. */
  pointer-events: auto;
  clip-path: polygon(44% 4%, 59% 4%, 65% 14%, 72% 19%, 82% 24%, 77% 31%, 68% 40%,
                     60% 45%, 51% 50%, 51% 58%, 72% 63%, 91% 68%, 93% 84%, 79% 90%,
                     71% 94%, 39% 94%, 32% 90%, 14% 85%, 9% 80%, 2% 69%, 9% 58%, 44% 58%);
}
.boat:hover img, .boat:focus-visible img { transform: scale(1.08) rotate(-3deg); }

@keyframes boat-drift {        /* +/- --bdrift of the boat's width */
  0%, 100% { translate: 0 0; }
  35%      { translate: calc(var(--bdrift) * 100%) 0; }
  70%      { translate: calc(var(--bdrift) * -100%) 0; }
}
@keyframes boat-bob {          /* % of the boat's height */
  0%, 100% { translate: 0 4%; }
  50%      { translate: 0 -12%; }
}
@keyframes boat-rock {
  0%, 100% { rotate: -4deg; }
  50%      { rotate: 4deg; }
}

/* ---------- Blimp (inside .stage) ---------- */
/* --bw wide (set on .stage). Flies from the center of the art (x 51%, just
   right of the Tracks tower) to the window's left edge as you scroll. The start
   is pulled left if the blimp would stick out past the window's right edge, so
   it's never cut off. Landscape: in the art's sky, above the labeled buildings
   (the Tracks label starts ~45% down, FAQ at 34%). Portrait: in the sky above
   the art. cqw/cqh here = the window. */
.blimp {
  position: absolute;
  top: var(--blimp-top);
  left: calc((1 - var(--p)) * min(51%, 100cqw - var(--art-left) - var(--bw) - 2cqw)
             + var(--p) * (2cqw - var(--art-left)));
  width: var(--bw);
  animation: float 5s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;        /* decoration: never blocks a building link */
}
.blimp img { width: 100%; display: block; }
/* The blimp is a size container, so cqw below = % of the blimp's width and the
   text always fits the cream banner (left 33%, width 60%, top 30%, height 50%
   of the image = 9.26cqw tall). */
.blimp { container-type: inline-size; }
.blimp__text {
  position: absolute;
  left: 33%;
  width: 60%;
  top: 30%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-hand);
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
/* Sizes scale with the blimp (cqw = % of its width). The text never shrinks
   below its minimum; instead the blimp is made big enough (see --bw): at
   3.5cqw "89 days 04 hrs 12 min 45 sec" takes about 80% of the banner, and
   the two-line form only shows when the blimp is 660px+ wide, where 3.5cqw is
   already 23px+ (so the 24px minimum still fits). Numbers sit in fixed-width
   slots (script.js .cd-num) so nothing jiggles as the seconds change. */
.blimp__date  { font-size: clamp(18px, 3cqw, 40px); font-weight: 700; }
.blimp__count {
  font-size: clamp(24px, 3.5cqw, 58px);
  font-weight: 700;
  word-spacing: .12em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cd-num {                      /* --digit-w = widest digit, measured by script.js */
  display: inline-block;
  width: calc(var(--digit-w, .56em) * var(--n, 2));
  text-align: center;
  word-spacing: normal;
}
.cd-short { display: none; }
/* Smaller blimp (< 660px, i.e. phones): one line, compact "89d 04h 12m 45s",
   16px+ (at 6cqw it fills about 83% of the banner). */
@container (max-width: 659px) {
  .blimp__date { display: none; }
  .cd-long  { display: none; }
  .cd-short { display: inline; }
  .blimp__count { font-size: clamp(16px, 6cqw, 30px); }
}
/* For screen readers only (the countdown's once-a-minute live region) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
@keyframes float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 2.5%;
  transform: translateX(-50%);
  font: 700 22px var(--font-hand);
  color: var(--cream);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  opacity: calc(1 - var(--p) * 4);
  animation: nudge 1.6s ease-in-out infinite;
  z-index: 3;
}
@keyframes nudge { 50% { translate: 0 6px; } }

/* ===================== CONTENT ===================== */
/* Split in two:
   top:    sunset water -> deep (meets the subway's top fade)
   bottom: the FAQ under the Sponsors: sea -> deep */
.content {
  position: relative;
  padding: 4rem 1.25rem 10rem;
}
.content--top {
  background: linear-gradient(var(--water-sunset), var(--water-deep) 45%);
  padding-bottom: 4rem;
}
.content--bottom {
  background: linear-gradient(#4ca8b3, var(--water-deep) 14rem);
  padding-bottom: 6rem;
}
.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 0;
  scroll-margin-top: 1rem;
}
.section h2 {
  font: 700 clamp(2.4rem, 5vw, 3.6rem)/1 var(--font-hand);
  color: var(--glow);
  margin: 0 0 1.25rem;
  text-shadow: 0 0 18px rgba(255, 233, 168, .35);
}
.section p { line-height: 1.65; font-size: 1.1rem; max-width: 65ch; }

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: .6em 1.4em;
  font: 700 1.4rem var(--font-hand);
  color: var(--ink);
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
/* unclickable (coming soon) */
.btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
  box-shadow: 0 4px 0 var(--ink);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 3 per row on desktop */
  gap: 1rem;
}
.card {
  background: rgba(246, 231, 200, .08);
  border: 2px solid rgba(246, 231, 200, .35);
  border-radius: 18px;
  padding: 1.25rem;
}
.card h3 { font: 700 1.6rem var(--font-hand); margin: 0 0 .4rem; color: var(--cream); }
.card p { margin: 0; opacity: .85; font-size: 1rem; line-height: 1.5; }
/* mobile: 2 per row, compact */
@media (max-width: 799px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .card { border-radius: 14px; padding: .8rem; }
  .card h3 { font-size: 1.3rem; margin-bottom: .3rem; }
  .card p { font-size: .8rem; line-height: 1.4; }
}
.person { text-align: center; }
.avatar {
  width: 96px; aspect-ratio: 1; margin: 0 auto 1rem;
  border-radius: 50%; background: var(--water-day);
  border: 3px solid var(--cream);
}

.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px dashed rgba(246, 231, 200, .5); }
.timeline li { position: relative; padding: .5rem 0 1.25rem 1.5rem; font-size: 1.1rem; }
.timeline li::before {
  content: ""; position: absolute; left: -9px; top: .85rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--glow); box-shadow: 0 0 10px var(--glow);
}
.time { font: 700 1.4rem var(--font-hand); color: var(--glow); margin-right: .5rem; }

details {
  border-bottom: 2px solid rgba(246, 231, 200, .25);
  padding: 1rem 0;
}
summary { cursor: pointer; font: 700 1.5rem var(--font-hand); }
details p { margin: .6rem 0 0; }


/* ===================== SPEAKERS & JUDGES (subway) ===================== */
/* Full-width platform scene, right above the Sponsors. Back to front:
     z0  the painting + bottom fade
     z1  far track   - left-bound train  (speakers)
     z2  pillar      - in front of the left-bound train...
     z3  near track  - ...behind the right-bound train (judges)
     z4  top fade
     z5  sign, sound button
   Both trains are the same size (--th tall: about one and a half cars per
   screen on desktop, one car on phones). One train at a time rolls through
   car by car (script.js); each car carries one person (name in the big
   window, info on the panel under it). The row of car dots sits under
   whichever train is in the station.
   The painting covers the section anchored to the bottom, and the section is
   never shorter than the painting's own aspect, so the painting is exactly
   as tall as the section and the tracks can be placed in % of its height:
     near track: wheels on the rails at the bottom (1% up, plus room for the
                 car dots under it)
     far track:  wheels in the dark pit under the platform edge (26% up), or
                 higher if needed so it clears the near track. */
.subway {
  --th: clamp(375px, 32.4vw, 660px);       /* train height (both trains) */
  --near-bottom: calc(1% + 3rem);          /* 3rem = room for the car dots */
  --far-bottom: max(26%, calc(var(--near-bottom) + var(--th) * .55));
  --sign-w: clamp(240px, 32vw, 540px);

  position: relative;
  isolation: isolate;
  overflow: hidden;                         /* trains enter/leave off-screen */
  /* the painting's 2360 x 1640, or taller when the trains + sign need it */
  height: max(69.5vw, calc(var(--th) * 1.6 + 13rem));
  background: #232a24 url("assets/subway.jpg") center bottom / cover no-repeat;
}
.subway::before,
.subway::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.subway::before {                           /* blend in from the section above */
  top: 0;
  height: clamp(3rem, 8vw, 7rem);
  background: linear-gradient(var(--water-deep), transparent);
  z-index: 4;
}
.subway::after {                            /* ...and down into the sea below */
  bottom: 0;
  height: 2.5rem;
  background: linear-gradient(transparent, var(--sea-top));
  z-index: 0;
}

/* ---------- Hanging sign (top left) ---------- */
.subway__sign {
  position: absolute;
  top: 0;                                   /* its poles run up to the ceiling */
  left: 4vw;
  width: var(--sign-w);
  margin: 0;
  z-index: 5;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .35));
  transform-origin: 50% 0;
  animation: sign-sway 6s ease-in-out infinite;
}
.subway__sign img { display: block; width: 100%; height: auto; }
@keyframes sign-sway {
  0%, 100% { rotate: -.6deg; }
  50%      { rotate: .6deg; }
}

/* ---------- Sound on/off ---------- */
.sound-toggle {
  position: absolute;
  top: 1rem;
  right: 4vw;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .25em .9em .25em .7em;
  font: 700 1.15rem/1.2 var(--font-hand);
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sound-toggle:hover { transform: translateY(1px); box-shadow: 0 2px 0 var(--ink); }
.sound-toggle:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }
.sound-toggle svg { display: block; width: 1.1em; height: 1.1em; }
.sound-toggle[aria-pressed="true"]  .icon-off { display: none; }
.sound-toggle[aria-pressed="false"] .icon-on  { display: none; }
/* phones: below the sign instead of beside it */
@media (max-width: 599px) {
  .sound-toggle { top: calc(var(--sign-w) * 0.2 + .6rem); left: 4vw; right: auto; font-size: 1rem; }
  .subway .pillar { max-width: 14vw; }   /* narrow: stays clear of the names */
}

/* ---------- Pillar ---------- */
/* The original drawing, whole: scaled to the height from the floor between
   the tracks up to the ceiling, proportions kept (aspect-ratio = the image's
   346 x 1228), never stretched, repeated or cropped. If that would make it
   wider than 16.5vw (14vw on phones), it's capped there and the drawing scales down,
   standing on the floor (object-position: bottom) instead of reaching the
   ceiling. In front of the far train, its base hidden behind the near one.
   script.js sets --pillar-x so it's clear of the names. */
.pillar {
  --pillar-floor: calc(var(--near-bottom) + var(--th) * .2);
  position: absolute;
  bottom: var(--pillar-floor);
  height: calc(100% - var(--pillar-floor));
  aspect-ratio: 346 / 1228;
  max-width: 16.5vw;
  left: var(--pillar-x, 50%);
  translate: -50% 0;
  z-index: 2;
  pointer-events: none;
}
.pillar__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
}

/* ---------- Tracks ---------- */
/* Full-width rows placed on the painting's tracks (see .subway). No z-index
   on .tracks itself, so the rows and the pillar layer against each other. */
.tracks { position: absolute; inset: 0; pointer-events: none; }
.track {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--th);
  font-size: var(--th);                     /* em = train height (lights) */
}
.track--far  { bottom: var(--far-bottom); z-index: 1; }
.track--near { bottom: var(--near-bottom); z-index: 3; }

/* ---------- Car dots ---------- */
/* Under the train in the station (data-track, set by script.js). The dot of
   the car nearest the middle of the screen is lit (aria-current). Buttons
   are 32px to tap; the dot is drawn inside. */
.car-dots {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .15rem;
  padding: .2rem .35rem;
  background: rgba(16, 26, 24, .6);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  transition: bottom .5s ease;
}
.car-dots[hidden] { display: none; }
.car-dots[data-track="near"] { bottom: calc(var(--near-bottom) - 2.75rem); }
.car-dots[data-track="far"]  { bottom: calc(var(--far-bottom) - 2.75rem); }
.car-dot,
.car-play {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.car-dot::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  transition: background .25s ease, scale .25s ease, box-shadow .25s ease;
}
.car-dot:hover::before { background: rgba(246, 231, 200, .45); }
.car-dot[aria-current="true"]::before {
  background: var(--glow);
  border-color: var(--glow);
  scale: 1.25;
  box-shadow: 0 0 8px rgba(255, 233, 168, .8);
}
.car-play {
  margin-left: .2rem;
  width: 28px;
  height: 28px;
  background: var(--cream);
}
.car-play svg { width: 16px; height: 16px; }
.car-play .icon-play { display: none; }
.subway[data-held] .car-play .icon-play  { display: inline; }
.subway[data-held] .car-play .icon-pause { display: none; }
.car-play[hidden] { display: none; }
.car-dot:focus-visible,
.car-play:focus-visible { outline: 3px solid var(--glow); outline-offset: 1px; }


/* ---------- Trains ---------- */
/* script.js moves them (translate, in px), sets data-state
   (waiting -> arrive -> stopped -> depart -> waiting) and data-moving while
   a car-length slide is under way. No JS: parked in the middle. */
.train {
  position: absolute;
  top: 0;
  left: 0;
  height: var(--th);
  aspect-ratio: 3600 / 406;
  translate: calc(50vw - 50%) 0;
  pointer-events: auto;
}
.train > img {
  position: relative;
  z-index: 1;                               /* frame on top of the window glow */
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.train--left { filter: brightness(.94); }   /* a touch further away */
.train[data-state="waiting"] { visibility: hidden; }
.subway[data-paused] .train > img { animation-play-state: paused; }
.train[data-moving] > img {
  animation: train-rumble .14s linear infinite alternate;
}
@keyframes train-rumble {
  from { translate: 0 0; }
  to   { translate: 0 .012em; }
}

/* ---------- People in the cars ---------- */
/* Name: on a warm lit "window" behind the frame (the big window is 8.58% of
   the train wide, 30-63% down). Info: on the panel under the windows. */
.rider { display: contents; }
.rider__name,
.rider__info {
  position: absolute;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  overflow: hidden;
}
.rider__name {
  z-index: 0;                               /* behind the frame */
  left: calc(var(--win) * 1%);
  width: 8.58%;
  top: 29.5%;
  height: 33.5%;
  padding: 0 .06em;
  background: radial-gradient(ellipse at 50% 40%, #fff6dc, #f6e3b4);
  font: 700 max(14px, calc(var(--th) * .105))/1 var(--font-hand);
  overflow-wrap: anywhere;
}
.rider__info {
  z-index: 2;                               /* painted on the car's panel */
  left: calc(var(--pan) * 1%);
  width: 12.7%;
  top: 66%;
  height: 15%;
  font: 700 max(11px, calc(var(--th) * .068))/1.1 var(--font-body);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Lights ---------- */
/* Headlights (warm yellow, with a beam ahead) on the FRONT end while pulling
   in; red tail lights on the BACK end while pulling out. Placed on the body's
   end edge (measured from the art): left-bound body 0.4% - 96.9%,
   right-bound 3.1% - 99.6%; 74% down. Sizes in em = train height. */
.light {
  position: absolute;
  z-index: 3;
  top: 74%;
  width: .085em;
  height: .085em;
  margin: -.0425em 0 0 -.0425em;
  border-radius: 50%;
  opacity: 0;
  transition: opacity .6s ease;
}
.light--head {
  background: #fffbe3;
  box-shadow: 0 0 .05em .03em #fff3c4,
              0 0 .35em .14em rgba(255, 233, 150, .7),
              0 0 .9em .3em rgba(255, 228, 140, .3);
}
.light--head::after {                       /* soft beam ahead of the train */
  content: "";
  position: absolute;
  top: 50%;
  width: 2.4em;
  height: .6em;
  translate: 0 -50%;
  background: linear-gradient(var(--beam-dir), rgba(255, 238, 170, .5), rgba(255, 238, 170, 0) 85%);
  clip-path: polygon(var(--beam-clip));
  mix-blend-mode: screen;
  pointer-events: none;
}
.light--tail {
  background: #ff6a55;
  box-shadow: 0 0 .05em .03em #ff4a36,
              0 0 .3em .12em rgba(255, 60, 40, .7),
              0 0 .8em .28em rgba(255, 40, 30, .3);
}
.train--left  .light--head { left: .4%; }
.train--left  .light--tail { left: 96.9%; }
.train--right .light--head { left: 99.6%; }
.train--right .light--tail { left: 3.1%; }
.train--left .light--head::after {          /* beam points left */
  right: 50%;
  --beam-dir: to left;
  --beam-clip: 100% 45%, 0 0, 0 100%, 100% 55%;
}
.train--right .light--head::after {         /* beam points right */
  left: 50%;
  --beam-dir: to right;
  --beam-clip: 0 45%, 100% 0, 100% 100%, 0 55%;
}
.train[data-state="arrive"]  .light--head { opacity: 1; }
.train[data-state="stopped"] .light--head { opacity: .3; }
.train[data-state="depart"]  .light--tail { opacity: 1; transition-duration: .3s; }
.train[data-state="depart"]  .light--head { transition-duration: .3s; }

/* ===================== SPONSORS (underwater) ===================== */
/* Positions use vw so the layout scales like the Figma frame (448 x 505 ->
   100vw x 112.7vw). The fish swim in the top 64vw; the sponsors block starts
   below that and the section grows to fit it (bigger logos need more room). */
.sea {
  position: relative;
  min-height: 112.7vw;
  padding: 64vw 0 14vw;        /* fish area above, breathing room below */
  overflow: hidden;            /* clips off-screen fish/bubbles: no sideways scrolling */
  /* sea.jpg = the sea painting stacked twice (2nd copy mirrored so the join is seamless) */
  background: var(--sea-top) url("assets/sea.jpg") top center / 100% auto repeat-y;
}

/* ---------- Fish: swim smoothly across, above the heading ---------- */
/* .fish (wrapper) does the crossing: linear, steady, --t per crossing.
   The img inside does the rest, so nothing rotates around a far-away point:
     fish-wave   a long smooth up/down curve (ease-in-out, alternate; one
                 full wave = 2 x --wh)
     fish-tilt   nose up while rising, nose down while falling: same speed as
                 the wave, a quarter-wave behind it so the tilt peaks when the
                 fish moves fastest
     fish-wiggle tiny horizontal squash/stretch (0.6s) for a tail-beat feel
   --flip mirrors the art so the fish faces the way it swims; --tilt-dir makes
   "nose up" correct for each direction. */
.fishes { position: absolute; inset: 0; pointer-events: none; }
.fish {
  position: absolute;
  left: 0;
  top: calc(var(--y) * 1vw);
  width: calc(var(--w) * 1vw);
  will-change: transform;
  transform: translateX(-100vw); /* parked off-screen until the animation runs */
  animation: var(--swim) var(--t, 16s) linear var(--delay, 0s) infinite;
}
.fish--ltr { --swim: swim-ltr; --tilt-dir: 1; }
.fish--rtl { --swim: swim-rtl; --tilt-dir: -1; }
.fish img {
  display: block;
  width: 100%;
  transform: scaleX(var(--flip, 1));
  animation:
    fish-wave var(--wh, 3s) ease-in-out var(--wd, 0s) infinite alternate,
    fish-tilt var(--wh, 3s) ease-in-out calc(var(--wd, 0s) - var(--wh, 3s) / 2) infinite alternate,
    fish-wiggle .3s ease-in-out infinite alternate;
}
/* enter fully off one side, leave fully off the other */
@keyframes swim-ltr {
  from { transform: translateX(calc(var(--w) * -1vw - 2vw)); }
  to   { transform: translateX(102vw); }
}
@keyframes swim-rtl {
  from { transform: translateX(102vw); }
  to   { transform: translateX(calc(var(--w) * -1vw - 2vw)); }
}
@keyframes fish-wave {          /* 3vw tall wave */
  from { translate: 0 -1.5vw; }
  to   { translate: 0 1.5vw; }
}
@keyframes fish-tilt {          /* from nose up to nose down */
  from { rotate: calc(-3.5deg * var(--tilt-dir)); }
  to   { rotate: calc(3.5deg * var(--tilt-dir)); }
}
@keyframes fish-wiggle {
  from { scale: .97 1; }
  to   { scale: 1.03 1; }
}

/* ---------- Big bubbles rising out of the sea ---------- */
/* Big bubbles (10vw+) drift up out of the sea, across its top edge and up
   into the subway section, fading out as they go. The subway section is its
   own layer (so its trains can sit in front), so each bubble is drawn twice
   with identical position, size and timing: once in .rising--sea (clipped at
   the sea's top edge) and once in .rising--subway (clipped at the subway's
   bottom edge, behind the trains and their names). Together they read as one
   bubble crossing over. Both strips are --rise-h tall: 45vw of sea plus
   --rise-up of subway. Never clickable. script.js adds the bubbles. */
.rising {
  --rise-up: min(70vh, 640px);
  --rise-h: calc(var(--rise-up) + 45vw);
  position: absolute;
  left: 0;
  right: 0;
  height: var(--rise-h);
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 55%);
  mask-image: linear-gradient(transparent, #000 55%);
}
.rising--sea    { top: calc(-1 * var(--rise-up)); z-index: 1; }   /* under the sponsors (z 2) */
.rising--subway { top: calc(100% - var(--rise-up)); z-index: 1; } /* under the trains (later in the DOM) */
.rise-bubble {
  position: absolute;
  top: 100%;                   /* starts just below the strip */
  left: calc(var(--x) * 1%);
  width: calc(var(--s) * 1vw);
  aspect-ratio: 1;
  background: url("assets/bubble.png") center / contain no-repeat;
  opacity: 0;
  animation: rise var(--t) linear var(--d) infinite,
             rise-sway var(--w) ease-in-out var(--d) infinite alternate;
}
@keyframes rise {
  0%   { translate: 0 0;                                  opacity: 0; }
  8%   { opacity: .75; }
  100% { translate: 0 calc(-1 * var(--rise-h) - 100%);    opacity: .75; }
}
@keyframes rise-sway {
  from { transform: translateX(-1vw); }
  to   { transform: translateX(1vw); }
}

/* ---------- Resting bubbles ---------- */
/* Own stacking layer (z-index 1) under the sponsors block (z-index 2), so the
   heading and logos are on top and clickable. script.js sets per bubble:
   --x/--y/--s (vw), --o opacity, z-index (small = in front), --bd bob delay,
   --in settle delay, --nx (push sideways, clear of the logos) and --px/--py
   (scroll parallax). */
.bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;            /* resting bubbles stay inside the sea */
  z-index: 1;
  pointer-events: none;
}
.bubble {
  pointer-events: auto;
  opacity: var(--o, .8);
  position: absolute;
  left: calc(var(--x) * 1vw);
  top: calc(var(--y) * 1vw);
  width: calc(var(--s) * 1vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%)
             translate(calc(var(--px, 0vw) + var(--nx, 0px)), var(--py, 0vw));
  background: url("assets/bubble.png") center / contain no-repeat;
  border: 0;
  padding: 0;
  cursor: pointer;
  animation: bubble-bob var(--d, 6s) ease-in-out var(--bd, 0s) infinite;
  transition: opacity .3s ease, scale .3s ease;
}
.bubble.popped { opacity: 0; scale: 1.4; pointer-events: none; }
/* gentle float up a little (and slightly sideways), then back */
@keyframes bubble-bob {
  0%, 100% { translate: 0 0; }
  50%      { translate: .3vw -1.4vw; }
}

/* ---------- Bubble-up transition (script.js sets data-phase on .sea) ----------
   armed   : waiting off-screen; resting bubbles and sponsors hidden
   burst   : temporary .burst-bubble elements rise through the screen
   settled : resting bubbles pop in with a bounce, the sponsors are revealed
   No data-phase (reduced motion / no JS): the final layout, no transition. */
.sea[data-phase="armed"] .bubble,
.sea[data-phase="burst"] .bubble   { opacity: 0; scale: .4; }
.sea[data-phase="armed"] .sponsors,
.sea[data-phase="burst"] .sponsors { opacity: 0; scale: .94; }
.sea[data-phase="settled"] .bubble {
  animation:
    bubble-in .8s cubic-bezier(.34, 1.56, .64, 1) var(--in, 0s) backwards,
    bubble-bob var(--d, 6s) ease-in-out var(--bd, 0s) infinite;
}
.sea[data-phase="settled"] .sponsors {
  animation: sponsors-reveal .7s cubic-bezier(.34, 1.4, .64, 1) .1s backwards;
}
@keyframes bubble-in {
  from { opacity: 0; scale: .3; }
  60%  { opacity: var(--o, .8); }
  to   { opacity: var(--o, .8); scale: 1; }
}
@keyframes sponsors-reveal {
  from { opacity: 0; scale: .9; }
  to   { opacity: 1; scale: 1; }
}
/* the temporary burst: above everything, never clickable; animated by
   script.js (Web Animations: transform + opacity only) and then removed */
.burst-layer {                 /* placed over the sea + subway by script.js */
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;            /* no sideways scrollbar from the wobble */
  z-index: 60;                 /* over the subway section's trains and signs */
  pointer-events: none;
}
.burst-bubble {
  position: absolute;
  left: 0;
  top: 0;
  aspect-ratio: 1;
  background: url("assets/bubble.png") center / contain no-repeat;
  opacity: 0;
  will-change: transform, opacity;
}

/* ---------- Sponsors ---------- */
.sponsors {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 4.2vw, 67px);  /* between heading and tiers */
  /* the block spans the full width; only the heading and logos catch clicks,
     so bubbles beside them can still be popped */
  pointer-events: none;
}
.sponsors h2, .sponsor { pointer-events: auto; }
.sponsors h2 {
  margin: 0;
  font: 700 clamp(2.8rem, 7vw, 6rem)/1 var(--font-hand);
  color: var(--cream);
  text-shadow: 0 3px 0 var(--ink), 0 0 24px rgba(29, 42, 68, .35);
}
/* several logos in a tier wrap onto centered rows */
.tier {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(17px, 4.2vw, 77px);
  max-width: 100%;
  padding: 0 4vw;
}
.sponsor { display: block; cursor: default; }
/* only real links react (a sponsor with a website) */
a.sponsor { cursor: pointer; transition: transform .2s ease; }
a.sponsor:hover, a.sponsor:focus-visible { transform: scale(1.06); }
.sponsor img { display: block; width: 100%; height: auto; }
.tier--gold   .sponsor { width: clamp(100px, 11vw, 200px); }
.tier--silver .sponsor { width: clamp(75px, 8vw, 145px); }
.tier--bronze .sponsor { width: clamp(55px, 5.5vw, 100px); }

.footer {
  text-align: center;
  padding: 2rem 1rem;
  background: #3a96a2;
  color: var(--cream);
}
.footer p {
  margin: 0;
  font: 700 clamp(1.6rem, 3vw, 2.2rem)/1.1 var(--font-hand);
  letter-spacing: .02em;
  text-shadow: 0 2px 0 var(--ink);
}

/* ===================== Reduced motion ===================== */
/* No swimming, bobbing, drifting, parallax or bubble burst: script.js skips
   the burst and parallax, so the sponsors show their final layout. The
   countdown still updates. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boat, .boat img, .blimp, .scroll-hint, .fish, .fish img, .bubble,
  .subway__sign { animation: none; }
  .rising { display: none; }
  /* fish rest at their spots from the Figma frame */
  .fish { transform: translateX(calc(var(--x) * 1vw)); }
}
