/* =====================================================================
   Love, Argo — landing + completion
   Design language pulled from the app's 393×852 onboarding screens:
   warm paper, ABC Favorit Edu, underline input fields with the label
   beneath, dark sheen pills. One scroll-driven landing (the "world" pans
   as a plane, --p 0→1) plus a clean /on-the-list completion page.
   ===================================================================== */

/* The real typeface — the ABC Favorit files this service ships in /fonts.
   Regular stands in for the 300 / 350 weights the design uses; Medium is 500. */
@font-face { font-family:"ABC Favorit Edu"; font-weight:300 400; src:url("/fonts/ABCFavorit-Regular.woff2") format("woff2"); font-display:swap; }
@font-face { font-family:"ABC Favorit Edu"; font-weight:500; src:url("/fonts/ABCFavorit-Medium.woff2") format("woff2"); font-display:swap; }

:root {
  --font: "ABC Favorit Edu", "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  /* ---- colour roles (from the app screens) ---- */
  --ink: #101010;
  --label: rgba(16, 16, 16, 0.40);   /* field labels */
  --placeholder: rgba(16, 16, 16, 0.25);
  --line: rgba(16, 16, 16, 0.10);    /* hairline / underline */
  --paper: #f7f7f7;                  /* app screen surface */
  --card: #f1f1f1;                   /* arc / card surface */
  --danger: #ff2727;
  --on-ink: #f6f5f2;
  /* subtle top-left sheen on ink surfaces (buttons, emphasis) */
  --sheen: linear-gradient(135deg, rgba(255,255,255,0.20) 21%, rgba(20,20,20,0.02) 100%);

  /* ---- grid & spacing (the structure everything aligns to) ---- */
  --gutter: clamp(20px, 5vw, 64px);   /* page side margin */
  --content: min(92vw, 1120px);       /* max content column */
  --field-w: min(86vw, 340px);        /* form column, ~ the app field */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* ---- scroll transition ---- */
  --p: 0;
  --travel: 20vh;
  --lede-top: 25%;
  --tallies-top: 53%;
  --description-top: 71%;
  --glow-strength: 0.72;   /* landing: slightly faint; completion overrides to 1 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  letter-spacing: -0.01em;
  background: var(--paper);
  background-image: linear-gradient(180deg, #ffffff 0%, #f1f1f1 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  min-height: 100dvh;
}

::selection { background: var(--ink); color: var(--on-ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:where(button, input, a, [tabindex]):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 3px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =====================================================================
   Shared app components (used by the landing + completion page)
   ===================================================================== */

/* ---- underline input field (value on top, label beneath) ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  width: var(--field-w);
  text-align: left;
}
.field__row { display: flex; align-items: center; min-height: 26px; }
.field__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.field__input::placeholder { color: var(--placeholder); }
.field__input:focus { outline: none; }
.field__line {
  height: 1px;
  width: 100%;
  background: var(--line);
  transition: background 0.2s ease;
}
.field__meta { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); }
.field__label {
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--label);
}
.field__error {
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--danger);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.field.is-invalid .field__line { background: var(--danger); }
.field.is-invalid .field__error { opacity: 1; }
/* a quiet note in the same slot (already on the list), not an error */
.field.is-note .field__error { opacity: 1; color: var(--label); }
.field.is-note .field__line { background: var(--ink); }
/* while the request is in flight */
.signup[aria-busy="true"] .btn { opacity: 0.6; pointer-events: none; }
/* the honeypot: off-screen, never display:none (bots skip hidden fields) */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.field__error a { color: inherit; }

/* ---- pill buttons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;                /* starts slightly squared */
  background-color: var(--ink);
  background-image: var(--sheen);
  color: var(--on-ink);
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  transition: transform 0.18s var(--ease), filter 0.18s ease, border-radius 0.3s var(--ease);
}
.btn:hover { filter: brightness(1.28); border-radius: 24px; }     /* rounds a bit on hover */
.btn:active { transform: scale(0.96); border-radius: 100px; }     /* fully round on press */
.btn--light {
  background-color: #fff;
  background-image: none;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn--light:hover { filter: none; background-color: #fafafa; }

/* ---- selectable pills (the app's role picker) --------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;                 /* unselected: slightly squared */
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  transition: transform 0.15s var(--ease), background 0.18s ease,
              color 0.18s ease, box-shadow 0.18s ease, border-radius 0.28s var(--ease);
}
.pill:hover { background: #fafafa; }
.pill:active { transform: scale(0.97); }
.pill[aria-pressed="true"] {
  background-color: var(--ink);
  background-image: var(--sheen);
  color: var(--on-ink);
  box-shadow: none;
  border-radius: 100px;                /* selected: rounds fully */
}
/* dashed square "add your own" button */
.pill--add {
  width: 50px;
  padding: 0;
  justify-content: center;
  box-shadow: none;
  outline: 1px dashed var(--line);
  outline-offset: -1px;
}
.pill--add svg { width: 20px; height: 20px; fill: currentColor; }
.pill--add[aria-pressed="true"] { outline: none; }
/* inline input the pencil expands into */
.pill--input {
  width: 220px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  transition: width 0.32s var(--ease);
}
.pill--input::placeholder { color: var(--placeholder); }
.pill--input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); }

/* =====================================================================
   Landing (scroll-driven)
   ===================================================================== */

.stage {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  opacity: 1;
  transition: opacity 0.6s var(--ease);
}
.scroll-spacer { height: 70vh; }

.world {
  position: absolute;
  inset: 0;
  transform: translateY(calc(var(--p) * var(--travel) * -1));
  will-change: transform;
}

.lede, .tallies, .description {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: var(--content);
  text-align: center;
}

.lede { top: var(--lede-top); }
.headline {
  font-weight: 500;
  font-size: clamp(32px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.subhead {
  margin-top: var(--s4);
  font-weight: 350;
  font-size: clamp(20px, 2.4vw, 29px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: rgba(16,16,16,0.62);
}

/* brand mark (loader.js renders into #page-loader) */
.brandmark {
  position: fixed;
  left: 50%;
  top: calc(35px + var(--p) * 40px);
  transform: translateX(-50%);
  width: calc(98px + var(--p) * 60px);
  height: calc(88px + var(--p) * 52px);
  z-index: 10;
  pointer-events: none;
  visibility: hidden;
}
.brandmark.is-visible { visibility: visible; }
.brandmark canvas { display: block; width: 100% !important; height: 100% !important; }

/* tallies */
.tallies {
  top: var(--tallies-top);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(94vw, 860px);
  align-items: start;
  justify-items: center;
  /* on scroll the row shrinks and the three parts pull together */
  transform: translateX(-50%) scale(calc(1 - var(--p) * 0.2));
  transform-origin: 50% 30%;
}
.tally {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: 14px;
  cursor: help;
  transition: transform 0.2s var(--ease);
}
.tally:hover, .tally:focus-visible { transform: translateY(-4px); outline: none; }
.tally__num {
  font-weight: 350;
  font-size: clamp(38px, 4vw, 48px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tally__label {
  font-weight: 400;
  font-size: clamp(15px, 1.6vw, 19px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.tally__tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 232px;
  padding: 12px 14px;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s var(--ease);
  box-shadow: 0 10px 28px rgba(16,16,16,0.13);
  z-index: 5;
  pointer-events: none;
}
.tally__tip b { font-weight: 600; }
.tally__tip::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ink);
}
.tally:hover .tally__tip, .tally:focus-visible .tally__tip {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

.description {
  top: var(--description-top);
  width: min(90vw, 520px);
  font-weight: 350;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.55;
  letter-spacing: -0.015em;
  text-wrap: pretty;
  color: rgba(16,16,16,0.62);
  opacity: 0;
}
.description__sign {
  display: block;
  margin-top: var(--s4);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* fade the scrolling content out before it reaches the fixed sign-up,
   so the paragraph is only ever slightly visible behind the footer */
.stage-fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 260px;
  background: linear-gradient(180deg, rgba(241, 241, 241, 0) 0%, #f1f1f1 60%);
  z-index: 2;
  pointer-events: none;
}

/* bottom-of-page glow in the mark's pink — mostly below the fold, top peeking up.
   (CSS for now; a WebGL version could replace this later without touching layout.) */
.glow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(1500px, 135vw);
  height: 52vh;
  /* Scroll-linked: at the top it's wide, flat and receded (spread along the
     bottom edge); scrolled down it fills out to the taller, rounder glow. */
  transform: translateX(-50%)
             scaleX(calc(1 + (1 - var(--p)) * 0.22))
             scaleY(calc(1 - (1 - var(--p)) * 0.44));
  transform-origin: 50% 100%;
  opacity: calc((0.72 + var(--p) * 0.28) * var(--glow-strength));
  z-index: 2;
  pointer-events: none;
}
.glow__orb {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 64% at 50% 100%,
      rgba(238, 0, 68, 0.40) 0%,
      rgba(238, 0, 68, 0.15) 42%,
      rgba(238, 0, 68, 0) 74%);
  filter: blur(24px);
  will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .glow__orb { animation: glow-drift 20s ease-in-out infinite alternate; }
}
@keyframes glow-drift {
  0%   { transform: translateX(-2.5%); }
  100% { transform: translateX(2.5%); }
}

/* ---- footer sign-up (app-style field + pill) ---------------------- */
.footer {
  position: absolute;
  left: 0; right: 0;
  bottom: clamp(18px, 2.5vh, 26px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s7);            /* clear separation between the field and the footnote */
  padding: 0 var(--gutter);
  z-index: 3;
}
.signup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s5);
}
.signup .field { width: var(--field-w); }   /* centred field */
/* the Join button hugs its label (tight padding), centred beneath the field */

.footer__meta {
  display: flex;
  align-items: center;
  gap: var(--s4);
  font-size: 13px;
  color: rgba(16,16,16,0.55);
}
.footer__meta a { color: inherit; text-decoration: none; position: relative; }
.footer__meta a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform 0.22s var(--ease);
}
.footer__meta a:hover::after, .footer__meta a:focus-visible::after { transform: scaleX(1); }
.footer__meta .sep { opacity: 0.4; }

/* ---- intro / loading ---------------------------------------------- */
#intro {
  position: fixed; inset: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f1f1f1 100%);
  z-index: 20;
}
#intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
body.is-loading { overflow: hidden; }
body.is-loading .stage { opacity: 0; visibility: hidden; }
body.is-ready #intro { display: none; }

/* =====================================================================
   Completion page (/on-the-list)
   ===================================================================== */
.page { min-height: 100dvh; }
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s7);             /* space between the lede, picker and share */
  width: var(--content);
  max-width: 860px;
  margin: 0 auto;
  /* content flows from ~a quarter down, clearing the pinned mark above it */
  padding: clamp(150px, 24vh, 240px) var(--gutter) var(--s9);
}
/* mark pinned top-centre, exactly like the landing */
.done__logo {
  position: fixed;
  top: clamp(28px, 4vh, 44px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  border-radius: 8px;
  transition: opacity 0.18s ease;
}
.done__logo img { height: clamp(60px, 8vh, 80px); width: auto; display: block; }
.done__logo:hover { opacity: 0.8; }
.done__lede { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }
.done__title {
  font-weight: 500;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.done__body {
  font-weight: 350;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.45;
  letter-spacing: -0.02em;
  max-width: 46ch;      /* longer line length; still reflows at narrow widths */
  text-wrap: balance;
  color: rgba(16,16,16,0.72);
}
.done__body b { font-weight: 500; color: var(--ink); }
.done__link {
  align-self: center;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
}
.done__link:hover { color: var(--danger); border-color: var(--danger); }

/* work-type selection (same grid + spacing scale as the rest of the page) */
.work { display: flex; flex-direction: column; align-items: center; gap: var(--s4); }
.work__head { display: flex; align-items: baseline; justify-content: center; gap: var(--s3); }
.work__q { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; }
.work__optional { font-size: 13px; color: var(--label); flex-shrink: 0; }
.work__pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 360px; }
.work__note { font-size: 13px; line-height: 1.5; color: rgba(16, 16, 16, 0.5); }

.done__share { align-self: center; }

/* completion page: full-strength glow fixed to the viewport bottom, content above */
.is-completion { --p: 1; --glow-strength: 1; }
.is-completion .glow { position: fixed; z-index: 0; }
.is-completion .page { position: relative; z-index: 1; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 720px) {
  :root {
    --travel: 18vh;
    --lede-top: 26%;
    --tallies-top: 50%;
    --description-top: 66%;
  }
  .brandmark {
    top: calc(26px + var(--p) * 30px);
    width: calc(84px + var(--p) * 48px);
    height: calc(75px + var(--p) * 43px);
  }
  .subhead { margin-top: var(--s3); }
  .tallies { width: 96vw; }
  .description { width: min(92vw, 440px); }

  /* keep the footer compact so it never meets the paragraph */
  .footer { gap: var(--s5); bottom: 18px; }
  .signup { gap: var(--s4); }
}
@media (max-width: 400px) {
  .tally__num { font-size: 32px; }
  .tally__label { font-size: 13px; }
}
@media (max-height: 620px) and (max-width: 900px) {
  :root { --travel: 0px; }
  .description { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #intro { display: none; }
  body.is-loading .stage { opacity: 1; visibility: visible; }
}
