/* Hop: one dotted line runs down the page; every section is a numbered stop it arrives at.
   Progressive enhancement. The BASE styles are the complete static page (line drawn in full, everything visible). Scroll-driven motion is added
   inside @supports + prefers-reduced-motion: no-preference, and only transform and opacity animate. Colours live in tokens.css only.

   How the line works with no scripting: the traveller dot is `position: sticky` at the middle of the screen. Each stop has a segment of dotted line;
   its lit "trail" slides inside a clipped box, driven by that segment's own view timeline, so the lit front stays level with the traveller. */

:root { --rail-x: 1.5rem; --gutter: clamp(1.25rem, 6vw, 4rem); --stop-pad: clamp(5rem, 14svh, 9rem); }
.dark { --ink: var(--ink-dark); --muted: var(--muted-dark); --line: var(--accent-dark); color: var(--ink); }
.stop { --line: var(--accent); }
.stop.dark { --line: var(--accent-dark); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 17px/1.5 var(--rounded); position: relative; }
button, input { font-family: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.dark :focus-visible { outline-color: var(--accent-dark); }
.skip { position: absolute; left: .75rem; top: -4rem; z-index: 20; padding: .6rem 1rem; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: 700 1rem/1 var(--rounded); text-decoration: none; }
.skip:focus { top: .75rem; }
.wrap { width: min(100%, 76rem); margin-inline: auto; padding-inline: var(--gutter); }
.soft { color: var(--muted); }

/* ---------- The rail: traveller dot ---------- */
.rail { position: absolute; z-index: 1; top: 78svh; bottom: 0; left: var(--rail-x); width: 0; pointer-events: none; }
.traveller { position: sticky; top: 50svh; display: block; width: 1.5rem; height: 1.5rem; margin-left: -.75rem; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--card), 0 0 28px rgba(111,191,142,.55); }

/* ---------- Stops ---------- */
.stop { position: relative; padding: var(--stop-pad) var(--gutter); color: var(--ink); }
.seg { position: absolute; z-index: 1; top: 0; bottom: 0; left: calc(var(--rail-x) - .4rem); width: .8rem; }
.track, .trail { position: absolute; inset: 0; display: block; background: radial-gradient(circle at 50% 50%, var(--line) 0 2.6px, transparent 3.2px) 0 0 / .8rem 1.25rem repeat-y; }
.track { opacity: .28; }
.clip { position: absolute; inset: 0; overflow: clip; }
.trail { height: calc(100% + 100svh); }               /* taller than the stop so it can slide in and stay lit */
.hero .seg { top: 78svh; }
.pin { position: absolute; z-index: 2; top: var(--stop-pad); left: calc(var(--rail-x) - 1.5rem); display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0;
  border-radius: 50%; background: var(--card); color: var(--accent); border: 3px solid var(--accent); font: 800 1.15rem/1 var(--rounded); font-style: normal; }
.dark .pin { background: var(--card-dark); color: var(--accent-dark); border-color: var(--accent-dark); }
.pin.home { overflow: hidden; padding: 0; border-radius: 28%; border: 0; }
.pin.home img { display: block; width: 100%; height: 100%; }
.inner { position: relative; z-index: 2; display: grid; gap: 2.5rem; padding-left: 3.25rem; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -.04em; line-height: 1.04; text-wrap: balance; }
h2 { font-size: clamp(2.1rem, 5.6vw, 4.5rem); }
.sub { margin: 1.1rem 0 0; max-width: 32rem; font-size: clamp(1.0625rem, 1.6vw, 1.3rem); line-height: 1.5; color: var(--muted); }
.center { text-align: center; } .center .sub { margin-inline: auto; }
.visual { margin: 0; display: grid; justify-items: start; }

/* ---------- Hero ---------- */
.hero { min-height: 100svh; display: flex; flex-direction: column; padding-top: 0; padding-bottom: 0; }
.hero .bar { padding: 1.75rem 0 0 3.25rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; text-decoration: none; color: inherit; font: 700 1.35rem/1 var(--rounded); letter-spacing: -.01em; }
.brand img { width: 2rem; height: 2rem; border-radius: 22%; display: block; }
.hero-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 0 22svh 3.25rem; max-width: 52rem; }
h1 { font-size: clamp(2.9rem, 10.5vw, 7rem); letter-spacing: -.045em; line-height: .98; }
.lede { margin: 1.4rem 0 0; max-width: 30rem; font-size: 1.15rem; line-height: 1.45; text-wrap: pretty; color: var(--ink); }
.actions { margin: 1.75rem 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: .9rem 1.25rem; }
.btn, button { display: inline-flex; align-items: center; justify-content: center; flex: none; min-height: 56px; padding: 0 1.5rem; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font: 700 1.0625rem/1 var(--rounded); text-decoration: none; touch-action: manipulation; transition: transform .15s ease; }
.dark .btn, .dark button { background: var(--accent-dark); color: var(--on-accent-dark); }
.btn:active, button:active { transform: scale(.98); }
.avail { font: 600 .9375rem/1 var(--rounded); letter-spacing: .02em; color: var(--muted); }

/* ---------- Phones ---------- */
.device { --pw: min(300px, 70vw); --b: calc(var(--pw) * .026); position: relative; width: var(--pw); height: calc(var(--pw) * 2.1072); border-radius: calc(var(--pw) * .163);
  background: var(--bezel); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 30px 60px -24px rgba(27,38,32,.5); }
.screen { position: absolute; inset: var(--b); border-radius: calc(var(--pw) * .137); background: var(--canvas-dark); overflow: clip; }
.ui { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.island { position: absolute; top: calc(var(--pw) * .03); left: 50%; transform: translateX(-50%); width: calc(var(--pw) * .285); height: calc(var(--pw) * .082); border-radius: 999px; background: var(--island); }

/* ---------- Small demos (play once at 60% visible; the completed state is the base) ---------- */
.moments { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 2.25rem; }
.moment h3 { margin: 1.1rem 0 0; font: 700 1.5rem/1.1 var(--rounded); letter-spacing: -.025em; }
.moment p { margin: .35rem 0 0; color: var(--muted); font-size: 1.0625rem; }
.tile { position: relative; aspect-ratio: 16 / 10; border-radius: 28px; overflow: hidden; background: var(--card-dark); border: 1px solid var(--divider-dark); display: grid; place-items: center; color: var(--ink-dark); }
.stop:not(.dark) .tile { background: var(--card); border-color: var(--divider); color: var(--ink); }
.tile .row { display: flex; align-items: center; gap: .75rem; width: min(78%, 20rem); padding: .7rem .9rem; border-radius: 18px; background: var(--card-dark-2); }
.tile .row b { display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--divider-dark); font-weight: 400; }
.tile .bar { flex: 1; height: .6rem; border-radius: 99px; background: var(--divider-dark); } .tile .bar.short { flex: 0 0 45%; }
.places { align-content: center; gap: .6rem; } .guess { align-content: center; gap: .9rem; }
.chip { padding: .4rem .8rem; border-radius: 999px; background: var(--accent-dark); color: var(--on-accent-dark); font: 700 .82rem/1.3 var(--rounded); }
.share { align-content: center; } .sheet { display: flex; gap: .9rem; }
.sheet i { display: block; width: 3.4rem; height: 3.4rem; border-radius: 22%; background: var(--divider-dark); overflow: hidden; }
.sheet i.hop { position: relative; } .sheet i.hop img { display: block; width: 100%; height: 100%; }
.sheet i.hop::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 3px var(--accent-dark); }
.toast { position: absolute; left: 50%; bottom: 1.1rem; translate: -50% 0; padding: .55rem 1rem; border-radius: 999px; background: var(--toast); color: var(--ink-dark); font: 700 .9rem/1 var(--rounded); white-space: nowrap; border: 1px solid var(--divider-dark); }
.js-anim .share:not(.play) .hop::after { opacity: 0; } .js-anim .share:not(.play) .toast { opacity: 0; transform: translateY(14px); }
.js-anim .share.play .hop { animation: pick .5s .4s both; } .js-anim .share.play .hop::after { animation: in .3s .6s both; } .js-anim .share.play .toast { animation: toast-in .5s 1.3s cubic-bezier(.2,.9,.3,1.2) both; }
.js-anim .places:not(.play) .row, .js-anim .guess:not(.play) .row, .js-anim .guess:not(.play) .chip { opacity: 0; transform: translateY(10px); }
.js-anim .places.play .row, .js-anim .guess.play .row, .js-anim .guess.play .chip { animation: toast-in .5s both; }
.js-anim .places.play .row:nth-child(2) { animation-delay: .25s; } .js-anim .places.play .row:nth-child(3) { animation-delay: .5s; } .js-anim .guess.play .chip { animation-delay: .6s; }
.duo { margin-top: 2rem; display: grid; gap: 1.25rem; max-width: 26rem; }
.duo .tile { aspect-ratio: 16 / 8; }
.stepper { display: inline-flex; align-items: center; gap: 1.1rem; padding: .6rem 1rem; border-radius: 999px; background: var(--divider); font: 700 1.5rem/1 var(--rounded); }
.stepper i { font-style: normal; color: var(--accent); width: 2rem; text-align: center; }
.count { display: grid; min-width: 2.2rem; text-align: center; font-size: 2.25rem; } .count span { grid-area: 1 / 1; }
.nights { align-content: center; gap: .6rem; } .nights .cap { color: var(--muted); font-weight: 600; }
.n2 { opacity: 0; } .n3 { opacity: 1; }
.js-anim .nights:not(.play) .n2 { opacity: 1; } .js-anim .nights:not(.play) .n3 { opacity: 0; }
.js-anim .nights.play .n2 { animation: out .01s 1s forwards; } .js-anim .nights.play .n3 { opacity: 0; animation: in .3s 1s forwards; } .js-anim .nights.play .plus { animation: tap .4s .85s; }
.seg3 { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: .3rem; border-radius: 999px; background: var(--divider); font: 700 .88rem/1 var(--rounded); }
.seg3 span { position: relative; z-index: 1; text-align: center; padding: .7rem .6rem; color: var(--ink); white-space: nowrap; }
.seg3 .sel { position: absolute; z-index: 0; top: .3rem; bottom: .3rem; left: calc(.3rem + (100% - .6rem + .5rem) / 3 * 2); width: calc((100% - .6rem - .5rem) / 3); border-radius: 999px; background: var(--card); box-shadow: inset 0 0 0 2px var(--accent); }
.js-anim .status:not(.play) .sel { transform: translateX(calc(-200% - .5rem)); }
.js-anim .status.play .sel { animation: slide 1.2s .5s cubic-bezier(.45,0,.1,1) both; }
@keyframes pick { 0% { transform: none; } 40% { transform: scale(.9); } 100% { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes out { to { opacity: 0; } }
@keyframes tap { 50% { transform: scale(1.5); } }
@keyframes slide { from { transform: translateX(calc(-200% - .5rem)); } to { transform: none; } }

/* ---------- Form, footer ---------- */
.signup { margin: 2rem auto 0; max-width: 29rem; text-align: left; }
.signup label { display: block; margin-bottom: .5rem; font: 600 .95rem/1 var(--rounded); }
.field { display: flex; gap: .5rem; }
input[type="email"] { flex: 1; min-width: 0; min-height: 56px; padding: 0 1rem; border-radius: 16px; border: 1.5px solid var(--field-border-dark); background: var(--card-dark); color: var(--ink-dark); font: 400 1.0625rem/1 var(--rounded); }
input::placeholder { color: var(--muted-dark); opacity: 1; }
.msg { margin: .6rem 0 0; font-weight: 600; font-size: .9375rem; } .msg:empty { display: none; }
.note { margin: .6rem 0 0; font-size: .9rem; line-height: 1.4; color: var(--muted); } .note a { color: inherit; text-underline-offset: 3px; }
.site-footer { background: var(--canvas-dark); color: var(--ink); padding-block: 2.5rem 3rem; border-top: 1px solid var(--divider-dark); position: relative; z-index: 2; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; justify-content: space-between; }
.foot nav { display: flex; gap: 1.5rem; }
.foot nav a { color: var(--muted); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; text-underline-offset: 4px; }
.foot p { margin: 0; color: var(--muted); font-size: .9375rem; }
.site-footer .brand { color: var(--ink-dark); }
main, .site-footer { overflow-x: clip; }
@media (max-width: 420px) { .field { flex-direction: column; } .field button { width: 100%; } .seg3 { font-size: .78rem; } .seg3 span { padding: .7rem .3rem; } }
@media (max-width: 359px) { input[type="email"] { padding: 0 .75rem; font-size: 1rem; } }

/* ---------- Static colour bands (base). The animated version replaces them with full-viewport colour layers below. ---------- */
.stop.dark { background: var(--canvas-dark); }
#country { background: linear-gradient(to bottom, var(--canvas-dark), var(--canvas) 14svh); }
#join { background: linear-gradient(to bottom, var(--canvas), var(--canvas-dark) 14svh); }

/* ---------- Desktop: the line runs down the middle, copy and phones alternate either side ---------- */
@media (min-width: 900px) {
  :root { --rail-x: 50%; }
  .rail, .seg { left: 50%; } .seg { margin-left: -.4rem; } .rail { margin-left: 0; }
  .pin { left: calc(50% - 1.5rem); }
  .inner { grid-template-columns: 1fr 1fr; column-gap: 9rem; padding-left: 0; align-items: center; max-width: 72rem; margin-inline: auto; }
  .inner.flip .copy { order: 2; } .inner.flip .visual { order: 1; justify-items: end; }
  .inner .copy { max-width: 30rem; } .inner:not(.flip) .copy { justify-self: end; text-align: left; }
  .visual { justify-items: start; } .device { --pw: min(320px, 36svh); }
  .inner.solo { display: block; max-width: 64rem; padding-top: 0; }
  .moments { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
  .hero .bar { padding-left: 0; } .hero-main { padding: 0 0 22svh; margin-inline: auto; align-items: center; text-align: center; } .hero .lede { margin-inline: auto; }
  .hero .actions { justify-content: center; } h1 { font-size: clamp(3rem, 7vw, 7rem); }
  .hero .seg, .rail { left: 50%; }
}

/* ---------- SCROLL-DRIVEN motion ---------- */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .in { animation: rise both cubic-bezier(.2,.7,.2,1) .9s; } .lede.in { animation-delay: .12s; } .actions.in { animation-delay: .24s; }
    .reveal { animation: rise both linear; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    /* the lit trail follows the traveller: front level with the middle of the screen */
    .trail { animation: lit both linear; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    .pin { animation: arrive both linear; animation-timeline: view(); animation-range: entry 40% entry 100%; }
    .settle { animation: settle both linear; animation-timeline: view(); animation-range: entry 0% entry 75%; }
    .tile.reveal { animation-range: entry 0% entry 60%; }
    .hero .seg .trail { animation-range: contain 0% contain 100%; }
    @keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
    @keyframes lit { from { transform: translateY(calc(-100% - 50svh)); } to { transform: translateY(-50svh); } }
    @keyframes arrive { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: none; } }
    @keyframes settle { from { opacity: 0; transform: translateY(9svh) scale(.94); } to { opacity: 1; transform: none; } }
  }
}
/* Colour changes: fixed full-viewport layers cross-fade in step with scroll (light -> dark at stop 3, back to light at 4, dark for the finale). */
@supports (timeline-scope: --a) and (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (min-height: 521px) {
    body { timeline-scope: --to-dark-a, --to-light, --to-dark-b; }
    .bg i { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; animation: fade-in both linear; }
    .bg .b1 { background: var(--canvas-dark); animation-timeline: --to-dark-a; animation-range: entry 24% entry 58%; }
    .bg .b2 { background: var(--canvas); animation-timeline: --to-light; animation-range: entry 24% entry 58%; }
    .bg .b3 { background: var(--canvas-dark); animation-timeline: --to-dark-b; animation-range: entry 24% entry 58%; }
    .stop.dark, #country, #join { background: transparent; }
    .seam { position: absolute; left: 0; top: 0; width: 1px; height: 60svh; pointer-events: none; }
    .to-dark-a { view-timeline: --to-dark-a block; } .to-light { view-timeline: --to-light block; } .to-dark-b { view-timeline: --to-dark-b block; }
    .traveller { animation: gone both linear; animation-timeline: --to-dark-b; animation-range: entry 45% entry 75%; }   /* it has arrived: the line ends at Hop's icon */
    @keyframes gone { to { opacity: 0; } }
    @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  }
}
