/* The launch list (v3, 2026-11-27): the launch-news form in every state, and the letter the Worker's /waitlist pages
   show, which the 404 borrows. The form reads the surface tokens (site.css), so it works on the night (the home hero,
   /iphone-duo) and on paper. Its states live on .launch (site/waitlist.js): data-state sending | sent | error |
   available, and data-region="later" (the EU, the EEA, the UK, Switzerland). After launch (hero=out) the same block is
   .launch-live: Apple's badge and a line for the countries that open later. The letter's states are
   services/site/src/worker.js STATES (confirm, confirmed, expired, leave, left, not on the list, bad link, slow down,
   error): a paper card on the dusk, Wick on its top edge in the pose that fits, with one dry line. */

/* ------------------------------------------------------------------ the form */
.launch { --launch-danger: #FFB4A0; --launch-field: rgba(9,11,26,.62); position: relative; max-width: 34rem; }
:is(.is-paper, main.read, .paper, .notice-letter) .launch { --launch-danger: #A8341F; --launch-field: var(--card-paper); }
.launch-head { margin: 0; font-size: 1.02rem; line-height: 1.5; color: var(--fg-2); }
.launch-head strong { color: var(--fg); }
.launch form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .7rem; margin-top: .95rem; }
/* one field with the lamp button inside it */
.launch-row { display: flex; gap: .35rem; padding: .35rem; border-radius: 999px; background: var(--launch-field);
  box-shadow: inset 0 0 0 1px var(--edge), 0 14px 30px -18px rgba(4,4,16,.55); transition: box-shadow .25s; }
.launch-row:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent), 0 14px 30px -18px rgba(4,4,16,.55); }
.launch-row input { flex: 1; min-width: 0; min-height: 2.9rem; padding: .7rem .5rem .7rem 1.05rem; border: 0; border-radius: 999px; background: transparent; color: var(--fg); font-size: 1.02rem; }
.launch-row input::placeholder { color: var(--fg-3); opacity: 1; }
.launch-row input:focus-visible { outline: none; }
.launch-row input:disabled { cursor: not-allowed; }
.launch-row .button { flex: none; min-height: 2.9rem; padding: .7rem 1.25rem; }
.launch-row .button[disabled] { color: var(--fg-3); background: transparent; box-shadow: inset 0 0 0 1px var(--hair-2); }
/* narrow phones: the field and the button each get the full width */
@media (max-width: 26.25em) {
  .launch-row { flex-direction: column; border-radius: 1.4rem; }
  .launch-row input { padding-inline: .9rem; border-radius: 1.1rem; }
  .launch-row .button { width: 100%; }
}
/* what pressing the button signs you up for, then the optional box */
.launch-terms, .launch .optin label { margin: 0; font-size: .9rem; line-height: 1.5; color: var(--fg-3); text-wrap: pretty; }
.launch-terms a { color: var(--link); white-space: nowrap; }
.launch .optin { display: flex; align-items: start; gap: .15rem; }
.launch .optin input { flex: none; appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin: -.62rem -.25rem -.9rem -.8rem;
  padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.launch .optin input::before { content: ""; width: 1.2rem; height: 1.2rem; border-radius: 6px; background: var(--launch-field) 50% 52% / .8rem no-repeat;
  box-shadow: inset 0 0 0 1.5px var(--edge); transition: background-color .2s, box-shadow .2s; }
.launch .optin input:hover::before { box-shadow: inset 0 0 0 1.5px var(--fg-3); }
.launch .optin input:checked::before { background-color: var(--accent); box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.4l2.3 2.3 4.7-5.2' fill='none' stroke='%2324140A' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.launch .optin input:focus-visible { outline: none; }
.launch .optin input:focus-visible::before { outline: 2px solid var(--accent); outline-offset: 2px; }
.launch .optin input:disabled { cursor: not-allowed; }
.launch .optin input:disabled::before { opacity: .55; }
.launch .optin label { cursor: pointer; }
.launch .fine { margin: .95rem 0 0; font-size: .88rem; line-height: 1.5; color: var(--fg-3); }
.form-status { margin: 0; font-size: .95rem; line-height: 1.45; color: var(--fg); }
.form-status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
/* arriving from a "Get launch news" link: the field lights once */
.launch:target .launch-row { animation: beckon 1.8s var(--settle) .3s; }
@keyframes beckon { 30% { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 28%, transparent); } }

/* sending: the button says so and breathes; the status line is for screen readers only, so nothing below jumps */
.launch[data-state="sending"] .launch-row .button { color: #24140A; background: linear-gradient(180deg, var(--lamp-hi), var(--lamp)); box-shadow: none; cursor: progress; animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { filter: brightness(.9) saturate(.9); } }
.launch[data-state="sending"] .form-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* a problem or the sent note: the small print steps aside, so the form never grows past its first height */
.launch[data-state="error"] .fine, .launch[data-state="sent"] .fine { display: none; }

/* a problem: a line under the field, with a mark, the field ringed when it's the address */
.launch[data-state="error"] .form-status { display: flex; gap: .6rem; align-items: start; color: var(--launch-danger); font-weight: 700; }
.launch[data-state="error"] .form-status::before { content: "!"; flex: none; display: grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-top: .02rem; border-radius: 50%;
  background: var(--launch-danger); color: var(--bg, #0B0E1A); font: 700 .85rem/1 var(--body); }
.launch-row:has(input[aria-invalid="true"]) { box-shadow: inset 0 0 0 1.5px var(--launch-danger), 0 0 0 4px color-mix(in srgb, var(--launch-danger) 20%, transparent); }

/* available: after launch, from a country where it's out; no list to join, so only the line and its link */
.launch[data-state="available"] .launch-row, .launch[data-state="available"] .launch-terms, .launch[data-state="available"] .optin { display: none; }
.launch[data-state="available"] .form-status { padding: .9rem 1.1rem; border-radius: var(--r); background: var(--card); box-shadow: inset 0 0 0 1px var(--hair); }
.launch[data-state="available"] .form-status a { color: var(--link); font-weight: 700; }

/* sent: the field folds into a note, Wick's mark lit beside it */
.launch-done { display: none; }
.launch[data-state="sent"] .launch-row, .launch[data-state="sent"] .launch-terms, .launch[data-state="sent"] .optin { display: none; }
.launch[data-state="sent"] .form-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.launch[data-state="sent"] .launch-done { display: grid; grid-template-columns: 2.9rem minmax(0, 1fr); gap: .15rem 1rem; align-items: start; margin-top: .15rem;
  padding: 1.1rem 1.2rem 1.15rem; border-radius: var(--r-l); color: var(--fg); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--hair-2), 0 18px 36px -22px rgba(4,4,16,.6);
  animation: unfold .5s var(--settle); }
@keyframes unfold { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.seal { grid-row: span 3; position: relative; width: 2.9rem; height: 2.9rem; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--lamp-core), var(--lamp) 70%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lamp) 25%, transparent), 0 6px 18px -4px rgba(244,169,97,.6); }
.seal img { width: 2.25rem; height: 2.25rem; border-radius: 28%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.seal::after { content: ""; position: absolute; right: -.2rem; bottom: -.2rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--moss) 50% 50% / .7rem no-repeat;
  box-shadow: 0 0 0 2px var(--bg, #0B0E1A);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.4l2.3 2.3 4.7-5.2' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.launch-done:focus { outline: none; }
.launch-done:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.launch-done .done-title { margin: .05rem 0 0; font: 700 1.3rem/1.2 var(--display); letter-spacing: -.01em; color: var(--fg); }
.launch-done p { margin: .3rem 0 0; font-size: 1rem; line-height: 1.5; color: var(--fg-2); }
.launch-done .addr { font-weight: 700; color: var(--fg); overflow-wrap: anywhere; }
.launch-done .later { display: none; margin-top: .7rem; padding: .7rem .9rem .75rem; border-left: 3px solid var(--accent); border-radius: 3px var(--r-s) var(--r-s) 3px; background: var(--card); }
.launch-done .later strong { display: block; margin-bottom: .1rem; font: 700 1.02rem/1.25 var(--display); color: var(--fg); }
.launch[data-region="later"] .launch-done .later { display: block; }
.launch-done .again { grid-column: 2; justify-self: start; min-height: 2.75rem; margin: .2rem 0 -.6rem; padding: 0; border: 0; background: none; color: var(--link); font: 700 .95rem/1.3 var(--body);
  text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: .2em; cursor: pointer; }
.launch-done .again:hover { text-decoration-color: currentColor; }
@media (max-width: 26.25em) {
  .launch-row .button { padding-inline: 1rem; }
  .launch[data-state="sent"] .launch-done { grid-template-columns: 2.5rem minmax(0, 1fr); padding: 1rem 1rem 1.05rem; gap: .15rem .85rem; }
  .seal { width: 2.5rem; height: 2.5rem; } .seal img { width: 1.95rem; height: 1.95rem; }
}

/* after launch: Apple's badge where the form was, the later countries' line under it */
.launch-live { display: grid; justify-items: start; gap: .9rem; }
.launch-live .store-badge { margin: .15rem 0; }
.launch-live .fine, .launch-live .live-later { margin: 0; }
.live-later { font-size: .95rem; line-height: 1.5; color: var(--fg-2); }
.live-later a { color: var(--link); font-weight: 700; }

/* ------------------------------------------------------------------ the /waitlist letter
   A strip of the dusk, the paper card rising out of it, Wick on its top edge. */
/* the card's lap over the band, and Wick's height on its edge: the band is tall enough that Wick and his line always
   clear the fixed header (--head-h) by at least 1.5rem */
.notice-top, .notice { --notice-lap: clamp(4rem, 7vw, 6.5rem); --wick-h: 9.6rem; }
.page-top.notice-top { padding-bottom: calc(var(--wick-h) + 2.5rem + var(--notice-lap)); }
.page-top.notice-top .band { object-position: 50% 78%; }
.page-top.notice-top::after { content: ""; position: absolute; inset: auto 0 0; height: 9rem; z-index: -1; pointer-events: none; background: linear-gradient(rgba(11,14,26,0), var(--night) 92%); }
.notice { position: relative; z-index: 3; width: min(100% - 2 * var(--gutter), 39rem); margin: calc(-1 * var(--notice-lap)) auto 0; padding-bottom: clamp(4.5rem, 9vw, 7.5rem); }
.notice-frame { position: relative; }
/* the letter: paper (its tokens restated, since the Worker's markup can't carry .is-paper) */
.notice-letter { --edge: #958670; --bg: var(--card-paper); --fg: var(--ink); --fg-2: var(--ink-2); --fg-3: var(--ink-3); --hair: var(--line); --hair-2: var(--line-2);
  --link: var(--ember-ink); --accent: var(--ember); --card: var(--paper); --card-2: #fff;
  position: relative; padding: clamp(2rem, 6vw, 3rem) clamp(1.4rem, 6vw, 3.25rem) clamp(1.8rem, 5vw, 2.6rem); border-radius: var(--r-xl); color: var(--ink);
  background: var(--card-paper); box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 50px 90px -40px rgba(0,0,0,.85), 0 18px 36px -18px rgba(0,0,0,.5); }
.notice .kicker { margin: 0 0 .85rem; font: 600 1rem/1.3 var(--display); font-variant-caps: all-small-caps; letter-spacing: .09em; color: var(--ember-ink); }
.notice h1 { max-width: 14ch; font-size: clamp(2.3rem, 6.4vw, 3.4rem); line-height: .98; letter-spacing: -.025em; color: var(--ink); }
.notice p { margin: 0 0 1rem; font-size: 1.08rem; line-height: 1.6; color: var(--ink-2); }
.notice .intro { margin-top: 1.15rem; font-size: clamp(1.15rem, 2.6vw, 1.26rem); line-height: 1.55; color: var(--ink-2); }
.notice a:not(.button) { color: var(--ember-ink); font-weight: 700; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.notice a:not(.button):hover { text-decoration-color: currentColor; }
.notice :focus-visible { outline-color: var(--ember-ink); }
.notice form, .notice .next { margin: 1.6rem 0 .5rem; }
.notice form + p { margin-top: 1.3rem; }
.notice form .button, .notice .next .button { min-height: 3.1rem; padding-inline: 1.5rem; }
.notice .button.quiet { color: var(--ink); box-shadow: inset 0 0 0 1px var(--edge); }
.notice .button.quiet:hover { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink-3); }
.notice .later { margin: 1.3rem 0 .4rem; padding: .95rem 1.15rem 1rem; border-left: 3px solid var(--ember); border-radius: 4px var(--r) var(--r) 4px; background: var(--paper); }
.notice .later p { margin: 0; font-size: 1.02rem; line-height: 1.55; color: var(--ink-2); }
/* the three diamonds: a quiet rule with the mark in it */
.notice .pips { display: flex; align-items: center; gap: 1rem; margin: 1.9rem 0 1.25rem; font-size: .5rem; line-height: 1; letter-spacing: .7em; color: var(--ember); opacity: .75; }
.notice .pips::before, .notice .pips::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice .help { margin: 0; font-size: .98rem; color: var(--ink-3); }
/* Wick on the card's top edge, his line beside him */
.notice-wick { position: absolute; z-index: 2; right: clamp(1rem, 5vw, 2.5rem); bottom: calc(100% - 1.15rem); width: 9.25rem; margin: 0; pointer-events: none; }
.notice-wick img { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 14px rgba(6,6,20,.5)); transform-origin: 50% 95%; animation: idle 3.8s ease-in-out 1; }
.notice-say, .lost-say { position: absolute; width: max-content; margin: 0; padding: .6rem .9rem .55rem; border-radius: 16px 16px 4px 16px; background: var(--card-paper); color: var(--ink);
  font: 700 1rem/1.3 var(--body); box-shadow: 0 0 0 1px rgba(27,24,34,.06), 0 14px 28px -12px rgba(6,6,20,.65); animation: say .45s var(--spring) .3s both; }
.notice-say { right: 86%; bottom: 56%; max-width: 13.5rem; }
.notice-say::after, .lost-say::after { content: ""; position: absolute; right: .9rem; top: calc(100% - 1px); border: .5rem solid transparent; border-top-color: var(--card-paper); border-right-width: 0; border-bottom-width: 0; }
@keyframes say { from { opacity: 0; transform: translateY(6px) scale(.92); } }
@media (max-width: 35em) {
  .notice-top, .notice { --notice-lap: 3.5rem; --wick-h: 6.75rem; }
  .notice-wick { width: 6.5rem; right: .9rem; bottom: calc(100% - .8rem); }
  .notice-say { right: 96%; bottom: 22%; font-size: .92rem; max-width: 11rem; padding: .5rem .75rem .45rem; }
  .notice h1 { max-width: none; padding-right: 2.5rem; }
}

/* ------------------------------------------------------------------ the 404 (404.html)
   The same card under its own painting (world.mjs "lost"): the trail runs to a gorge where the bridge is out, Wick at
   the lip with his back to it, sure the map is right. The ways back are quest runes that light when you point at one. */
.page-top.lost-top { padding-bottom: clamp(15rem, 31vw, 27rem); }
.page-top.lost-top::after { height: 6rem; }
.lost-scene { position: absolute; inset: 0; z-index: -2; container-type: size; --vbw: 1600; --vbh: 640; --u: max(100cqw / var(--vbw), 100cqh / var(--vbh)); }
.lost-scene .world { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; }
.lost-wick { z-index: 2; width: calc(var(--w) * var(--u)); margin: 0; transform: translate(-55%, -96%); }
.lost-wick img { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(10,6,20,.45)); transform-origin: 55% 96%; animation: idle 3.8s ease-in-out 1; }
.lost-say { right: 76%; bottom: 76%; white-space: nowrap; }
.notice.lost { margin-top: calc(-1 * clamp(2.5rem, 5vw, 4rem)); width: min(100% - 2 * var(--gutter), 44rem); }
.lost .ways { margin: 1.8rem 0 .4rem; }
.lost .ways h2 { margin: 0 0 .75rem; font: 600 1rem/1.3 var(--display); font-variant-caps: all-small-caps; letter-spacing: .09em; color: var(--ink-3); }
.lost .ways ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: 0; padding: 0; list-style: none; }
.lost .ways a { display: flex; gap: .9rem; align-items: center; height: 100%; min-height: 4.5rem; padding: .85rem 1rem .9rem .85rem; border-radius: var(--r); text-decoration: none; font-weight: 400; color: var(--ink-2);
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .2s, box-shadow .2s, transform .2s var(--settle); }
.lost .ways a:hover, .lost .ways a:focus-visible { background: #fff; box-shadow: inset 0 0 0 1px var(--line-2), 0 14px 26px -18px rgba(27,24,34,.45); transform: translateY(-1px); }
.lost .ways a:focus-visible { outline: 2px solid var(--ember-ink); outline-offset: 2px; }
.lost .ways span { display: grid; gap: .15rem; font-size: .97rem; line-height: 1.4; }
.lost .ways strong { font: 700 1.14rem/1.2 var(--display); color: var(--ink); }
/* the rune (#i-rune in the sprite): drawn inside <use>, where only inherited values reach it, so it's coloured by custom
   properties (as compare.css does): a quiet stone until you point at it, then lamplit, the tick drawn */
.way-rune { flex: none; width: 2.5rem; height: 2.5rem; overflow: visible; --rune-slab: var(--card-paper); --rune-edge: var(--line-2); --rune-ring: rgba(200,100,42,.45); --rune-tick: var(--ember-ink); --rune-draw: 20; }
.lost .ways a:hover .way-rune, .lost .ways a:focus-visible .way-rune { --rune-slab: url(#rune-lit); --rune-edge: #D98A48; --rune-ring: transparent; --rune-tick: #6B2E0C; --rune-draw: 0; }
@media (max-width: 38.75em) { .lost .ways ul { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 35em) {
  .page-top.lost-top { padding-bottom: 15rem; }
  /* on a phone he's near the left edge: the line goes up and to his right, over the gorge */
  .lost-say { right: auto; left: 62%; bottom: 90%; font-size: .9rem; padding: .5rem .75rem .45rem; border-radius: 16px 16px 16px 4px; }
  .lost-say span { display: block; }
  .lost-say::after { right: auto; left: .9rem; border-left-width: 0; border-right-width: .5rem; }
  .notice.lost { margin-top: -2.25rem; }
}
@media (prefers-reduced-motion: reduce) { .notice-wick img, .notice-say, .lost-wick img, .lost-say, .launch-done, .launch[data-state="sending"] .launch-row .button, .launch:target .launch-row { animation: none; } }

/* forced colours (Windows contrast themes): box-shadows are dropped, so the field and the opt-in fall back to real
   borders, a native checkbox and the system focus colour */
@media (forced-colors: active) {
  .launch-row, .lost .ways a, .notice-letter { border: 1px solid CanvasText; }
  .launch-row input:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
  .launch .optin input { appearance: auto; -webkit-appearance: checkbox; width: 1.2rem; height: 1.2rem; margin: .15rem .6rem 0 0; }
  .launch .optin input::before { display: none; }
  .launch .optin input:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}
