/* One accent per state, used for every piece of text on screen. Text is never white.
   Salmon while the twin is missing, ice while filling in the form, lime only once they are found. */
:root {
  --page: #1d1d1d;
  --accent: #f18a8a;
  --wide: "Anybody", "Arial Black", sans-serif;
  --text: "Figtree", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: min(6.5vw, 28px);
}
html[data-state="form"] { --accent: #c5ecff; }
html[data-state="found"] { --accent: #cde581; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); } /* on html, not body: a body background would cover the field canvas */
body { margin: 0; color: var(--accent); font: 600 16px/1.45 var(--text); -webkit-font-smoothing: antialiased; }

#field { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100lvh; }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.55; }

main { max-width: 440px; margin: 0 auto; padding: 0 var(--gutter) 40px; }

/* ---------- the poster (home and status) ---------- */
/* Sized from the screen height so the headline, portrait, pitch, counter and button share one phone screen. */
.poster { display: flex; flex-direction: column; align-items: center; gap: clamp(14px, 3dvh, 30px); padding-top: clamp(24px, 5dvh, 56px); text-align: center; }
h1 { margin: 0; }
.shout, .sub, h2, .city, .reveal { font-family: var(--wide); font-weight: 900; font-stretch: 150%; letter-spacing: -0.03em; }
.shout { display: block; font-size: min(12.4vw, 54px); line-height: 0.82; text-transform: uppercase; }
.sub { display: block; margin-top: 12px; font-size: min(5.4vw, 24px); line-height: 1; }

.portrait { width: min(62%, 33dvh); aspect-ratio: 1; border-radius: 50%;
  box-shadow: 0 0 0 4px var(--page), 0 0 0 8px var(--accent), 0 0 0 12px var(--page), 0 0 0 14px #8487f8,
    0 0 44px 22px rgba(63, 95, 36, 0.85); }
.heat, .scanview { display: block; width: 100%; height: 100%; border-radius: 50%; }
.heat { touch-action: pan-y; cursor: crosshair; }

.lede, .clues { max-width: 30ch; margin: 0; font-size: 17px; text-wrap: balance; }
#scan .portrait { width: min(66%, 38dvh); }
#scanbody .fine { margin: 6px auto 0; }
.cluelist { display: flex; flex-direction: column; gap: 18px; }
.clue { margin: 0; animation: rise 0.55s var(--ease) both; }
.clue small { display: block; font-size: 13px; font-weight: 600; opacity: 0.75; }
.clue b { display: block; margin-top: 2px; font-family: var(--wide); font-weight: 900; font-stretch: 150%; letter-spacing: -0.03em;
  font-size: min(5.6vw, 24px); line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; }
.where { margin: 0; }
.where small { display: block; font-size: 14px; font-weight: 600; opacity: 0.75; }
.city { display: block; margin-top: 4px; font-size: min(7vw, 30px); line-height: 1.05; text-wrap: balance; }
.count { margin: 0; font-size: 15px; }
.count b { font-family: var(--wide); font-stretch: 150%; font-weight: 900; font-size: 22px; letter-spacing: -0.02em; }
.count a { color: inherit; font-weight: 700; text-underline-offset: 3px; }
.count small { display: block; font-size: 13px; font-weight: 500; opacity: 0.75; }
.note { max-width: 34ch; margin: 20px 0 0; font-size: 15px; font-weight: 500; opacity: 0.8; text-align: left; }
.fine { max-width: 36ch; margin: 0; font-size: 13px; font-weight: 500; opacity: 0.7; }
/* Home is one screen with no scrolling: everything, footer included, is sized from the visible height. */
#home { gap: clamp(6px, 1.4svh, 22px); padding-top: clamp(12px, 2.6svh, 40px); }
#home .portrait { width: clamp(110px, 100svh - 615px, 60%); margin: 8px 0; } /* takes whatever height the text leaves */
#home .lede { font-size: 16px; }
#home .btn { padding: 13px 26px; }
#home .fine, #home .note { max-width: none; margin: 0; font-size: 12.5px; text-align: center; text-wrap: balance; }
/* Which two screenshots: tiny drawings of the two Wrapped screens, not copies of them. */
.shots { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 0; font-size: 12.5px; font-weight: 600; }
.shot { display: flex; align-items: center; gap: 8px; max-width: 13ch; line-height: 1.2; text-align: left; }
.shot i { flex: none; width: 22px; height: 38px; border: 2px solid var(--accent); border-radius: 6px; --bar: linear-gradient(var(--accent), var(--accent)); }
.shot.card i { background: radial-gradient(circle at 50% 30%, var(--accent) 0 5px, transparent 5.5px),
  var(--bar) 50% 66% / 12px 2px no-repeat, var(--bar) 50% 82% / 12px 2px no-repeat; }
.shot.conn i { background: radial-gradient(circle at 32% 26%, var(--accent) 0 3.5px, transparent 4px),
  radial-gradient(circle at 68% 26%, var(--accent) 0 3.5px, transparent 4px),
  var(--bar) 50% 54% / 12px 2px no-repeat, var(--bar) 50% 68% / 12px 2px no-repeat, var(--bar) 50% 82% / 12px 2px no-repeat; }
main:has(#home:not([hidden])) { padding-bottom: 10px; }
main:has(#home:not([hidden])) footer { margin-top: clamp(6px, 1.4svh, 28px); font-size: 11px; }
main:has(#home:not([hidden])) footer p { margin: 4px 0; }
.busy::after { content: "..."; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { to { width: 1.1em; } }

/* The one orchestrated moment. The headline pulls into focus, the portrait pops in cold and then
   develops (the heat is driven from app.js), and the text rises in behind it. */
.rise .shout { animation: focus 0.8s var(--ease) both; }
.rise .sub { animation: rise 0.55s var(--ease) 0.45s both; }
.rise > .portrait, .rise > .duo { animation: pop 0.7s var(--ease) 0.3s both; }
.rise > :nth-child(n + 3) { animation: rise 0.55s var(--ease) calc(1.5s + var(--i, 0) * 0.1s) both; }
.rise > :nth-child(4) { --i: 1; }
.rise > :nth-child(5) { --i: 2; }
.rise > :nth-child(n + 6) { --i: 7; } /* the quiet lines wait a beat, as they do in the story */
@keyframes focus { from { opacity: 0; filter: blur(18px); transform: scale(1.35); } }
@keyframes pop { from { opacity: 0; transform: scale(0.5); } }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }

/* ---------- controls ---------- */
button { font: inherit; color: inherit; cursor: pointer; }
.btn { display: inline-block; padding: 16px 28px; border: 0; border-radius: 999px; background: var(--accent); color: var(--page);
  font: 700 17px/1.2 var(--text); cursor: pointer; transition: transform 0.15s var(--ease); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; }
.btn.quiet { background: none; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.link { display: block; margin: 14px auto 0; padding: 6px; border: 0; background: none; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.btn:focus-visible, .link:focus-visible, .btn:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
a.link { color: inherit; white-space: nowrap; }
.links .link { white-space: nowrap; }
.links .link { margin: 0; }

/* ---------- the form: left-aligned, no boxes, rules only ---------- */
form { padding-top: max(7dvh, 44px); }
h2 { margin: 0 0 10px; font-size: min(8vw, 34px); line-height: 0.95; text-wrap: balance; }
h3 { margin: 40px 0 0; font: 800 19px/1.2 var(--text); }
form .fine { margin-top: 8px; }
label { display: block; margin-top: 18px; font-size: 13px; font-weight: 600; opacity: 0.95; }
input:not([type="checkbox"]) { display: block; width: 100%; padding: 6px 0 8px; border: 0; border-radius: 0;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); background: none;
  color: var(--accent); font: 600 19px/1.3 var(--text); }
input::placeholder { color: color-mix(in srgb, var(--accent) 30%, transparent); }
input:focus { outline: none; border-bottom-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.check { display: flex; align-items: center; gap: 12px; margin-top: 34px; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.error { margin: 16px 0 0; font-weight: 700; }
form .btn { margin-top: 26px; }

/* ---------- sightings and the found moment ---------- */
.sighting { width: 100%; padding-top: 26px; border-top: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.sighting h3 { margin: 0 0 6px; }
/* The banner above the sightings: the one thing on the poster page in a second colour. */
.alert { margin: 0; padding: 12px 24px; border-radius: 999px; rotate: -3deg; background: #b6edfc; color: var(--page);
  font-family: var(--wide); font-weight: 900; font-stretch: 150%; letter-spacing: -0.03em; font-size: min(5vw, 20px); line-height: 1.05;
  text-wrap: balance; animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 0.9s both; }
.lines { display: inline-block; margin: 0 0 18px; padding: 0; list-style: none; text-align: left; font-size: 14px; font-weight: 700; }
.lines li { margin: 5px 0; }
.lines li::before { display: inline-block; width: 1.5em; }
.lines .yes::before { content: "\2713"; }
.lines .half::before { content: "\00BD"; }
.lines .no { opacity: 0.6; font-weight: 500; }
.lines .no::before { content: "\2717"; }
.sighting p { max-width: 32ch; margin: 0 auto 14px; text-wrap: balance; }
.reveal { margin: 0; font-size: min(7vw, 30px); line-height: 1.05; overflow-wrap: anywhere; }

.duo { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; }
/* The stamp lands on the two portraits once they have slid together. */
.stamp { position: absolute; left: 50%; top: 50%; z-index: 1; translate: -50% -50%; rotate: -9deg; padding: 10px 24px; border-radius: 999px;
  background: var(--accent); color: var(--page); font-family: var(--wide); font-weight: 900; font-stretch: 150%; letter-spacing: -0.03em;
  font-size: min(8vw, 34px); text-transform: uppercase; animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 1.9s both; }
@keyframes stamp { from { opacity: 0; scale: 3; } }
.confetti { position: fixed; inset: 0; z-index: 5; width: 100%; height: 100%; pointer-events: none; }
.duo .portrait { width: 40%; }
.duo .portrait:first-child { animation: join-left 0.9s var(--ease) 1s both; }
.duo .portrait:last-child { animation: join-right 0.9s var(--ease) 1s both; }
@keyframes join-left { from { transform: translateX(-30px); } to { transform: translateX(12px); } }
@keyframes join-right { from { transform: translateX(30px); } to { transform: translateX(-12px); } }

footer { margin-top: 56px; text-align: center; font-size: 12px; font-weight: 500; opacity: 0.6; }
footer a { margin: 0 6px; color: inherit; font-weight: 700; }
.tip { width: 100%; padding-top: 24px; border-top: 2px dashed color-mix(in srgb, var(--accent) 45%, transparent); font-size: 15px; }
.tip h3 { margin: 0 0 4px; }
.tip p { margin: 0 0 6px; }
.tip .btn { margin-top: 10px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .rise > *, .duo .portrait { animation-name: fade !important; }
  .busy::after { animation: none; width: 1.1em; }
  @keyframes fade { from { opacity: 0; } }
}
