/* ==========================================================================
   Crease — shared foundation. Every page loads this first.
   Tokens, type, layout, nav, footer, buttons, forms, motion.
   ========================================================================== */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("../assets/fonts/hanken-grotesk-normal-400-700.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
/* Serif is used only for book text (passages, page mockups) — never for site UI. */
@font-face {
  font-family: "Newsreader";
  src: url("../assets/fonts/newsreader-normal-400-600.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Paper and ink */
  --paper: #f4f1ea;
  --paper-2: #ece8df;
  --surface: #fbfaf6;
  --ink: #1f1e1b;
  --ink-2: #4a4a44;
  --muted: #6b6b63;
  --line: #e1dcd1;
  --line-2: #cfc8bb;

  /* Olive accent — used sparingly */
  --olive: #526348;
  --olive-2: #6f8462;
  --olive-soft: #dde5d5;

  /* Night sections (listen player, footer CTA) */
  --night: #1a1b18;
  --night-2: #24251f;
  --night-line: #34362f;
  --night-ink: #f1eee6;
  --night-muted: #a4a59b;

  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-book: "Newsreader", "Iowan Old Style", Georgia, serif;

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --pill: 999px;

  --shadow-sm: 0 1px 2px rgb(31 30 27 / 0.06), 0 2px 8px rgb(31 30 27 / 0.04);
  --shadow: 0 2px 6px rgb(31 30 27 / 0.06), 0 18px 40px -12px rgb(31 30 27 / 0.18);
  --shadow-lg: 0 4px 12px rgb(31 30 27 / 0.08), 0 40px 80px -24px rgb(31 30 27 / 0.32);

  --wrap: 1200px;
  --gutter: clamp(20px, 4vw, 40px);
  --section: clamp(88px, 12vw, 160px);
  --nav-h: 68px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; padding: 0; }
em, i { font-style: normal; } /* House rule: no italics anywhere. */
::selection { background: var(--olive-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; border-radius: 6px; }

[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; 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: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--pill);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.skip-link:focus { top: 12px; }

/* ---------- Type scale (one family; weight does the work) ---------- */
.display {
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 700;
  text-wrap: balance;
}
.h1 { font-size: clamp(40px, 6vw, 72px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; text-wrap: balance; }
.h2 { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; }
.h3 { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }
.h4 { font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 650; }
.lead { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
.body { font-size: 17px; color: var(--ink-2); }
.small { font-size: 15px; color: var(--muted); }
.tiny { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.strong { font-weight: 650; color: var(--ink); }
.center { text-align: center; }
.measure { max-width: 34ch; }
.measure-wide { max-width: 46ch; }
.center.measure, .center.measure-wide, .center .measure, .center .measure-wide { margin-inline: auto; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { width: 100%; max-width: calc(760px + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section); }
.section-sm { padding-block: calc(var(--section) * 0.6); }
.stack > * + * { margin-top: var(--stack, 20px); }
.section-head { display: grid; gap: 18px; margin-bottom: clamp(48px, 6vw, 80px); }
.section-head.center { justify-items: center; }

.night { background: var(--night); color: var(--night-ink); }
.night .lead, .night .body { color: var(--night-muted); }
.night .small, .night .tiny, .night .muted { color: var(--night-muted); }
.tint { background: var(--paper-2); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--ink); --btn-fg: var(--paper); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--pill); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 16px; font-weight: 600; letter-spacing: -0.005em; line-height: 1;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), background-color 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn-secondary { --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--line-2); }
.btn-secondary:hover { --btn-bd: var(--ink); box-shadow: none; }
.btn-olive { --btn-bg: var(--olive); --btn-fg: #fff; }
.btn-light { --btn-bg: var(--night-ink); --btn-fg: var(--night); }
.btn-ghost-light { --btn-bg: transparent; --btn-fg: var(--night-ink); --btn-bd: var(--night-line); }
.btn-ghost-light:hover { --btn-bd: var(--night-ink); box-shadow: none; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 17px; }
.btn-block { width: 100%; }

.link { color: var(--ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.link::after { content: "→"; transition: transform 0.2s var(--ease); }
.link:hover::after { transform: translateX(3px); }
.night .link { color: var(--night-ink); }

/* ---------- Forms (beta sign-up is the shared one) ---------- */
.field {
  width: 100%; min-height: 52px; padding: 0 20px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--pill);
  font-size: 16px; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgb(31 30 27 / 0.08); }
.field-box { border-radius: var(--radius-sm); }

.beta-form { display: flex; gap: 8px; width: 100%; max-width: 460px; }
.beta-form .field { flex: 1; min-width: 0; }
.beta-form .btn { min-height: 52px; }
.center .beta-form, .beta-form.center { margin-inline: auto; }
.beta-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.beta-note { margin-top: 12px; font-size: 14px; color: var(--muted); min-height: 1.4em; }
.beta-note[data-state="ok"] { color: var(--olive); font-weight: 600; }
.beta-note[data-state="error"] { color: #a2463d; }
.night .field { background: var(--night-2); border-color: var(--night-line); color: var(--night-ink); }
.night .field::placeholder { color: var(--night-muted); }
.night .field:focus { border-color: var(--night-ink); box-shadow: 0 0 0 4px rgb(241 238 230 / 0.1); }
.night .beta-note { color: var(--night-muted); }
.night .beta-note[data-state="ok"] { color: #b7c9a8; }
@media (max-width: 520px) {
  .beta-form { flex-direction: column; }
  .beta-form .btn { width: 100%; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: rgb(244 241 234 / 0.82);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav-inner { height: 100%; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: var(--pill);
  font-size: 15px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--ink); background: rgb(31 30 27 / 0.05); }
.nav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-cta { margin-left: 8px; }
.nav-links a.btn { color: var(--btn-fg); background: var(--btn-bg); padding: 0 18px; font-weight: 600; border-radius: var(--pill); }
.nav-links a.btn:hover { color: var(--btn-fg); background: var(--btn-bg); }
.nav-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; border: 0; background: transparent; border-radius: var(--pill);
  align-items: center; justify-content: center;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 20px; height: 1.75px; background: var(--ink); border-radius: 2px; position: relative;
  transition: transform 0.3s var(--ease), background-color 0.2s;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
.nav-open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 12px var(--gutter) 28px;
    background: var(--paper); border-bottom: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav-open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { padding: 14px 4px; font-size: 18px; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav-links a:hover { background: transparent; }
  .nav-cta { margin: 20px 0 0; }
  .nav-links .nav-cta { border-bottom: 0; padding: 0 22px; justify-content: center; }
}

/* ---------- Footer ---------- */
.footer { padding: 72px 0 40px; border-top: 1px solid var(--line); font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; }
.footer-brand p { margin-top: 14px; color: var(--muted); max-width: 26ch; }
.footer h4 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer ul { list-style: none; padding: 0; display: grid; gap: 10px; }
.footer a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.footer a:hover { color: var(--ink); }
.footer-base { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- Shared bits ---------- */
.pill-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: var(--pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.pill-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--olive); }
.night .pill-tag { background: var(--night-2); border-color: var(--night-line); color: var(--night-muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.cover {
  aspect-ratio: 2 / 3; width: 100%; object-fit: cover;
  border-radius: 6px; background: var(--paper-2);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 10px 24px -10px rgb(0 0 0 / 0.35);
}

/* Phone frame for in-HTML app mockups. Size with --phone-w. */
.phone {
  --phone-w: 300px;
  width: var(--phone-w); aspect-ratio: 9 / 19.5;
  padding: calc(var(--phone-w) * 0.035);
  border-radius: calc(var(--phone-w) * 0.16);
  background: #121311;
  box-shadow: var(--shadow-lg), inset 0 0 0 1.5px #3a3b36;
  position: relative; flex: none;
}
.phone-screen {
  width: 100%; height: 100%; overflow: hidden; position: relative;
  border-radius: calc(var(--phone-w) * 0.13);
  background: var(--paper); color: var(--ink);
  font-size: calc(var(--phone-w) * 0.042);
}
.phone-screen::before { /* dynamic island */
  content: ""; position: absolute; z-index: 5; top: calc(var(--phone-w) * 0.03); left: 50%; transform: translateX(-50%);
  width: 30%; height: calc(var(--phone-w) * 0.075); border-radius: var(--pill); background: #121311;
}

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* Above-the-fold entrance: pure CSS, starts at first paint, never waits on JS. Stagger with --d. */
.rise { animation: rise 0.8s var(--ease) backwards; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal, .rise { opacity: 1; transform: none; animation: none; }
}
