/* Affirm Away site — extends the existing landing/privacy design language.
   Palette mirrors the app: sage bg, ink text, slate accents, white cards.
   Typography is the APP's own: Newsreader (display + affirmations) and Hanken
   Grotesk (UI), self-hosted from the same @expo-google-fonts packages the app
   registers — see scripts/site/fonts.mjs. The CSP has no font-src directive so
   fonts fall back to default-src 'self'; a CDN would be blocked. */
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('/assets/fonts/newsreader-300i.woff2') format('woff2'); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/assets/fonts/hanken-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/assets/fonts/hanken-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Hanken Grotesk'; src: url('/assets/fonts/hanken-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
/* Metric-matched fallbacks so the swap doesn't reflow the page. */
@font-face { font-family: 'Newsreader Fallback'; src: local('Georgia'); size-adjust: 97%; ascent-override: 92%; descent-override: 24%; line-gap-override: 0%; }
@font-face { font-family: 'Hanken Fallback'; src: local('Helvetica Neue'), local('Arial'); size-adjust: 104%; ascent-override: 95%; descent-override: 25%; line-gap-override: 0%; }

:root {
  color-scheme: light;
  --bg: #EAF1ED;
  --ink: #28373D;
  --muted: #5D6F76;      /* lightest legal small-text ink on --bg (4.57:1) */
  --muted-2: #7C8B91;    /* 3.07:1 — NOT for text. Hairlines/decorative only. */
  --card: #ffffff;
  --slate: #43585F;
  --sage: #AFC8C4;
  --hairline: rgba(40, 55, 61, .12);
  --danger: #A9524A;
  --ok: #3E6B4F;
  --flame: #E1965E;      /* fill only — 2.10:1 as text, never a text colour */
  --gold: #C49A4A;       /* fill only */

  --font-display: 'Newsreader', 'Newsreader Fallback', Georgia, 'Times New Roman', serif;
  --font-ui: 'Hanken Grotesk', 'Hanken Fallback', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* fluid type scale, 1.25 → 1.333 */
  --step--1: clamp(.833rem, .80rem + .16vw, .9375rem);
  --step-0:  clamp(1.0625rem, 1.03rem + .18vw, 1.1875rem);
  --step-1:  clamp(1.25rem, 1.19rem + .30vw, 1.5rem);
  --step-2:  clamp(1.5rem, 1.38rem + .60vw, 2rem);
  --step-3:  clamp(1.875rem, 1.65rem + 1.10vw, 2.75rem);
  --step-4:  clamp(2.25rem, 1.85rem + 2.0vw, 4rem);
  --step-5:  clamp(2.75rem, 2.0rem + 3.4vw, 5.25rem);

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px; --space-10: 128px;
  --shell: 1200px; --measure: 68ch; --section-y: clamp(64px, 10vw, 128px);

  --r-sm: 12px; --r-md: 18px; --r-lg: 22px; --r-xl: 28px; --r-card: 30px; --r-pill: 999px;

  /* shadows tinted with --ink, never black (black over sage goes muddy);
     every one opens with a definition ring so cards read as objects */
  --shadow-1: 0 0 0 1px rgba(40,55,61,.055), 0 1px 2px rgba(40,55,61,.04), 0 2px 8px rgba(40,55,61,.04);
  --shadow-2: 0 0 0 1px rgba(40,55,61,.055), 0 1px 2px rgba(40,55,61,.05), 0 4px 12px -2px rgba(40,55,61,.06), 0 12px 28px -6px rgba(40,55,61,.08);
  --shadow-3: 0 0 0 1px rgba(40,55,61,.055), 0 2px 4px rgba(40,55,61,.06), 0 8px 20px -4px rgba(40,55,61,.09), 0 24px 48px -12px rgba(40,55,61,.12);

  --dur-fast: 160ms; --dur: 280ms; --dur-slow: 480ms;
  --ease-out: cubic-bezier(.22,.61,.36,1);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font: var(--step-0)/1.65 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--slate); }
img { max-width: 100%; }
p { text-wrap: pretty; }

/* links on the slate CTA card: `a { color: var(--slate) }` renders them
   invisible against the card's own slate background */
.cta-card a { color: var(--cta-muted); text-decoration: underline; text-underline-offset: 2px; }

/* focus: the two `outline:none` rules this file used to carry are gone. */
:focus-visible { outline: 2px solid var(--slate); outline-offset: 2px; border-radius: inherit; }

@media (forced-colors: active) { :focus-visible { outline-color: Highlight; } }

/* shared: waitlistForm's <label for> uses this on EVERY page, not just the
   homepage — it must live in the stylesheet all 57 pages load */
.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;
}

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 12px 18px; border-radius: 0 0 var(--r-md) 0; z-index: 100; }
.skip-link:focus { left: 0; }

/* film grain — the single noise source, applied as a pseudo-element so the
   blend mode never lives inside a filtered SVG (Safari is unreliable there) */
.film { position: relative; }
.film::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url(/assets/grain.svg) repeat; background-size: 220px 220px;
  mix-blend-mode: multiply; opacity: .05;
}
@media (max-width: 480px) { .film::after { opacity: .035; } }
@media (prefers-contrast: more) { .film::after { display: none; } }

.wrap { max-width: var(--shell); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: var(--measure); margin: 0 auto; padding: 0 24px; }

/* header / nav */
.site-header { padding: 26px 0 0; }
.site-header .bar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand {
  font-family: var(--font-display); font-size: 24px; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; display: block; }
.nav { display: flex; gap: 18px; font-size: 15px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* hero */
.hero { padding: 56px 0 8px; }
.hero h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-4); line-height: 1.06; letter-spacing: -.022em; max-width: 15ch; text-wrap: balance; }
.hero .tag { color: var(--muted); margin-top: 14px; font-size: 19px; max-width: 640px; }

/* headings */
h2.section { font-family: var(--font-display); font-weight: 400; font-size: var(--step-2); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 6px; }
.section-sub { color: var(--muted); font-size: 15px; margin-bottom: 18px; }

/* cards + grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-top: 20px; }
.card {
  background: linear-gradient(158deg, #FFFFFF 0%, #F5F9F8 55%, #EAF1F2 100%);
  border-radius: var(--r-card); padding: 26px 28px; box-shadow: var(--shadow-2);
}
a.card { display: block; text-decoration: none; color: inherit; transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); }
.card .kicker { font-size: 12px; letter-spacing: .10em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.card h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-1); line-height: 1.3; margin-top: 8px; }
.card .excerpt { color: var(--muted); font-size: 15px; margin-top: 8px; }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 14px; }
.card-featured { grid-column: 1 / -1; }
.card-featured h3 { font-size: 27px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px; background: var(--card);
  color: var(--slate); font-size: 14px; text-decoration: none; border: 1px solid var(--hairline);
}
.chip:hover { border-color: var(--slate); }
.chip[aria-current="page"] { background: var(--slate); color: #fff; border-color: var(--slate); }

/* breadcrumbs + answer box */
.crumbs { font-size: var(--step--1); color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted); padding: 0 2px; }
.answer-box {
  background: linear-gradient(158deg, #EAF1ED 0%, #DCE8E7 52%, #CFE0E2 100%);
  border-radius: var(--r-lg); padding: 20px 24px; margin-top: 22px;
  box-shadow: var(--shadow-1);
}
.answer-box .answer-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.answer-box p { margin-top: 6px; font-size: 16px; }

/* article body */
.article-head { padding-top: 48px; }
.article-head h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-3); line-height: 1.12; letter-spacing: -.018em; text-wrap: balance; }
.article-head .subtitle { color: var(--muted); font-size: 19px; margin-top: 10px; }
.article-head .meta { color: var(--muted); font-size: 14px; margin-top: 14px; }
.prose { margin-top: 28px; }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-2); line-height: 1.16; margin: 36px 0 10px; }
.prose h3 { font-size: 18px; margin: 26px 0 8px; }
.prose p { margin: 14px 0; }
.prose ul, .prose ol { margin: 14px 0; padding-left: 26px; }
.prose li { margin: 6px 0; }
.prose blockquote {
  margin: 20px 0; padding: 16px 22px; background: var(--card); border-radius: 14px;
  border-left: 3px solid var(--slate); font-family: var(--font-display); font-size: var(--step-1);
}
.prose hr { border: none; border-top: 1px solid var(--hairline); margin: 30px 0; }

/* CTA / waitlist */
.cta-card {
  /* the app's real `mist` card stops. --cta-muted is a darker ramp than the
     page's --muted, which fails AA against the gradient's #A6C5D6 end. */
  --cta-muted: #33454B;
  background: linear-gradient(158deg, #EAF1ED 0%, #C7DBDC 52%, #A6C5D6 100%);
  color: var(--ink); border-radius: var(--r-card); padding: 32px 32px 28px;
  margin: 40px 0; box-shadow: var(--shadow-3);
}
.cta-card h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--step-2); line-height: 1.14; }
.cta-card p { color: var(--cta-muted); margin-top: 8px; font-size: var(--step-0); }
.cta-card .store-links { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
/* official badges: Apple's SVG is trim; Google's PNG carries ~15% internal padding —
   the height bump keeps their VISIBLE badge sizes matched */
.cta-card .store-badge { height: 52px; width: auto; display: block; }
/* the "other store is still coming" line above the retained waitlist form */
.cta-card .cta-pending { margin-top: 22px; font-size: 15px; color: var(--cta-muted); }
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px; font-size: 15px; font-weight: 600;
  text-decoration: none; border: none; cursor: pointer;
}
.btn-light { background: #fff; color: var(--ink); }
.btn-light:hover { background: #f0f4f2; }
.cta-card .btn-light { background: var(--slate); color: #fff; }
.cta-card .btn-light:hover { background: #35474d; }
.btn-dark { background: var(--slate); color: #fff; }
.btn[disabled] { opacity: .5; cursor: default; }

.waitlist-form { margin-top: 18px; }
.waitlist-form .row { display: flex; gap: 10px; flex-wrap: wrap; }
.waitlist-form input[type="email"] {
  flex: 1; min-width: 220px; padding: 13px 18px; border-radius: var(--r-md);
  border: 1px solid rgba(40, 55, 61, .14);
  font-size: var(--step-0); color: var(--ink); background: #fff;
}
.waitlist-survey { margin-top: 16px; }
.waitlist-survey .q { font-size: 14px; color: var(--cta-muted); margin-bottom: 8px; }
.waitlist-survey .chips { margin-top: 4px; }
.waitlist-survey .chip { background: rgba(255, 255, 255, .78); color: var(--cta-muted); border-color: rgba(40, 55, 61, .18); cursor: pointer; }
.waitlist-survey .chip[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: var(--slate); }
.waitlist-survey input[type="text"] {
  width: 100%; margin-top: 10px; padding: 11px 16px; border-radius: var(--r-sm);
  border: 1px solid rgba(40, 55, 61, .14);
  font-size: var(--step--1); background: rgba(255, 255, 255, .72); color: var(--ink);
}
.waitlist-survey input[type="text"]::placeholder { color: var(--cta-muted); }
.waitlist-note { font-size: 13px; color: var(--cta-muted); margin-top: 12px; }
.waitlist-status { margin-top: 12px; font-size: 14.5px; min-height: 20px; }
.waitlist-status.ok { color: #2A5138; }
.waitlist-status.err { color: #6E2E29; }
.turnstile-slot { margin-top: 14px; }

/* footer */
.site-footer {
  margin-top: 72px; padding: 22px 0 48px; border-top: 1px solid var(--hairline);
  font-size: 14px; color: var(--muted);
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

@media (max-width: 560px) {
  .hero h1 { font-size: 32px; }
  .article-head h1 { font-size: 30px; }
}

/* section rhythm — replaces the ad-hoc `margin: 44px 0 6px` on headings */
.wrap > h2.section, .wrap-narrow > h2.section { margin-top: var(--space-7); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}


/* ============================================================ editorial grid
   Newspaper hierarchy: one lead, two mid, the tail compact — so a list of
   articles stops reading as a wall of identical boxes. Cards are tinted by
   topic with the app's own gradients (see EDITORIAL in scripts/site/art.mjs).
   The lead rotates daily; the inline script after the grid does the swap
   during parse, before first paint. */
.editorial { display: grid; gap: clamp(14px, 1.6vw, 22px); margin-top: var(--space-6); }

/* a.card sets display:block and out-specifies a bare .ed-card, so qualify it */
a.ed-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
/* the app's mid gradient stops are too dark for --muted, so tinted cards get a
   darker ink ramp — same trick as the CTA card */
.ed-card[data-topic] { --card-ink: #33454B; }
.ed-card .kicker { color: var(--card-ink, var(--muted)); }
.ed-card .excerpt, .ed-card .meta { color: var(--card-ink, var(--muted)); }
.ed-card h3 { color: var(--ink); }
.ed-card .meta { margin-top: auto; padding-top: 14px; }

/* the day's story */
.ed-lead { min-height: 300px; padding: 32px 34px; }
.ed-lead h3 { font-size: var(--step-3); line-height: 1.14; letter-spacing: -.015em; }
.ed-lead .excerpt { font-size: var(--step-0); margin-top: 12px; max-width: 52ch; }
/* topic glyph as a watermark — an app element doing the job a stock photo
   would do in a real newspaper */
.ed-lead .card-mark {
  position: absolute; right: -26px; bottom: -26px; width: 190px; height: 190px;
  color: var(--ink); opacity: .07; stroke-width: 1.1; pointer-events: none;
}

.ed-mid h3 { font-size: var(--step-1); }
.ed-compact { padding: 20px 22px; }
.ed-compact h3 { font-size: 17px; line-height: 1.32; margin-top: 6px; }
.ed-compact .kicker { font-size: 11px; }
/* the tail shows title only; the watermark belongs to the lead alone */
.ed-compact .excerpt, .ed-compact .meta { display: none; }
.ed-mid .card-mark, .ed-compact .card-mark, .ed-note .card-mark, .ed-tall .card-mark { display: none; }

/* --- tail variants, so a long list isn't one repeated shape --------------- */

/* "note": keeps its description */
.ed-note { padding: 22px 24px; }
.ed-note h3 { font-size: 17px; line-height: 1.32; margin-top: 6px; }
.ed-note .kicker { font-size: 11px; }
.ed-note .excerpt { font-size: 14px; margin-top: 10px; }
.ed-note .meta { display: none; }

/* "tall": portrait, like an affirmation card in the app — title only, set in
   the display face and centred, so the eye gets a change of rhythm */
.ed-tall { padding: 26px 24px; justify-content: center; text-align: center; }
.ed-tall .kicker { font-size: 11px; margin-bottom: 10px; }
.ed-tall h3 {
  font-family: var(--font-display); font-weight: 400; font-size: var(--step-1);
  line-height: 1.26; margin-top: 0; text-wrap: balance;
}
.ed-tall .excerpt, .ed-tall .meta { display: none; }

/* a playful divider instead of a plain rule: the brand's sparkle on a hairline */
.ed-rule {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px;
  margin: var(--space-3) 0 var(--space-1); color: var(--muted);
}
.ed-rule::before, .ed-rule::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline) 22%, var(--hairline) 78%, transparent);
}
.ed-star { font-size: 13px; color: var(--gold); line-height: 1; }

@media (min-width: 700px) {
  .editorial { grid-template-columns: repeat(2, 1fr); }
  .ed-lead { grid-column: 1 / -1; }
}
@media (min-width: 700px) {
  /* dense flow lets the portrait cards slot in without leaving holes */
  .editorial { grid-auto-flow: row dense; }
}
@media (min-width: 1000px) {
  .editorial { grid-template-columns: repeat(12, 1fr); grid-auto-rows: minmax(96px, auto); }
  .ed-lead { grid-column: span 7; grid-row: span 3; }
  .ed-mid { grid-column: span 5; }
  .ed-compact { grid-column: span 4; }
  .ed-note { grid-column: span 4; grid-row: span 2; }
  .ed-tall { grid-column: span 4; grid-row: span 2; }
}
