/* HyperNatural — base
   Reset, type ramp, layout primitives, bands, utilities.
   Tokens come from tokens.css (generated by brand/tokens/build.mjs). */

/* ---------- Fonts (Literata display + Inter text — Google Fonts, not bundled) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Literata:ital,opsz,wght@0,7..72,300;0,7..72,400;0,7..72,500;1,7..72,300;1,7..72,400&display=swap');

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; min-height: 100dvh; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }

/* ---------- Page-level vars ---------- */
:root {
  /* Semantic surface pair. Night bands flip these. */
  --bg: var(--color-cotton);
  --bg-raised: var(--color-highlight);
  --fg: var(--color-ink);
  --fg-muted: var(--color-label);
  --rule: var(--color-dusk);
  --moment: var(--color-mineral);
  --fiber: var(--color-shell);
  --buy: var(--color-dried);
  --key: var(--color-magpie);
  --key-soft: #E2E9F3; /* magpie at ~12% over highlight — a cool paper */

  /* Layout */
  --site-max: 1440px;
  --gutter: clamp(20px, 5vw, 72px);
  --section: clamp(64px, 8.5vw, 104px);
  --block: clamp(40px, 5vw, 64px);

  /* Fluid type — 390 → 1440 */
  --fs-display: clamp(3.25rem, 1.5rem + 7.5vw, 8rem);
  --fs-h1: clamp(2.75rem, 1.5rem + 5.5vw, 6rem);
  --fs-h2: clamp(2.125rem, 1.25rem + 3.6vw, 4rem);
  --fs-h3: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
  --fs-h4: clamp(1.375rem, 1.05rem + 1.3vw, 2rem);
  --fs-sub: clamp(1.25rem, 1.05rem + 0.8vw, 1.5rem);
  --fs-body-l: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --fs-body: 1rem;
  --fs-body-s: 0.875rem;
  --fs-label: 0.8125rem;
  --fs-caption: 0.75rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 700ms;

  color-scheme: light;
}

/* ---------- Body type ---------- */
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: 0.01em;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
}

/* Literata for statements. Weight 300/400, tight tracking, optical size follows font-size. */
.display, .h1, .h2, .h3, .h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.05;
  text-wrap: balance;
}
.display { font-size: var(--fs-display); font-weight: 300; letter-spacing: -0.025em; line-height: 0.98; }
.h1 { font-size: var(--fs-h1); font-weight: 300; letter-spacing: -0.02em; line-height: 1.0; }
.h2 { font-size: var(--fs-h2); }
.h3 { font-size: var(--fs-h3); line-height: 1.1; }
.h4 { font-size: var(--fs-h4); line-height: 1.15; letter-spacing: -0.01em; }
.sub { font-family: var(--font-heading); font-weight: 400; font-size: var(--fs-sub); line-height: 1.35; letter-spacing: -0.005em; }
.lede { font-size: var(--fs-body-l); line-height: 1.55; color: inherit; max-width: 34em; text-wrap: pretty; }
.body { font-size: var(--fs-body); max-width: 38em; text-wrap: pretty; }
.body-s { font-size: var(--fs-body-s); line-height: 1.5; }
.muted { color: var(--fg-muted); }
em, .em { font-style: italic; font-weight: inherit; }
.serif-i { font-family: var(--font-heading); font-style: italic; font-weight: 300; }

/* Label — Inter Medium 13, uppercase, 0.14em. The technical register. */
.label {
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.label--moment { color: var(--moment); }
.label--key { color: var(--key); }
.text-key { color: var(--key); }
.label--fiber { color: var(--fiber); }
.caption { font-size: var(--fs-caption); line-height: 1.4; color: var(--fg-muted); letter-spacing: 0.01em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--site-max) - 2 * var(--gutter)); margin-inline: auto; }
.wrap--full { width: 100%; }
.section { padding-block: var(--section); }
.section--tight { padding-block: var(--block); }
.section--flush-top { padding-top: 0; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(16px, 2vw, 32px); row-gap: var(--block); }
.col-4 { grid-column-end: span 4; }
.col-5 { grid-column-end: span 5; }
.col-6 { grid-column-end: span 6; }
.col-7 { grid-column-end: span 7; }
.col-8 { grid-column-end: span 8; }
.col-10 { grid-column-end: span 10; }
.col-12 { grid-column: 1 / -1; }
.start-2 { grid-column-start: 2; }
.start-3 { grid-column-start: 3; }
.start-5 { grid-column-start: 5; }
.start-7 { grid-column-start: 7; }
@media (max-width: 900px) {
  .col-4, .col-5, .col-6, .col-7, .col-8, .col-10 { grid-column-end: span 12; }
  .start-2, .start-3, .start-5, .start-7 { grid-column-start: 1; }
}
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack--lg { gap: var(--space-4); }
.stack > .link, .stack > .btn { align-self: flex-start; }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { text-align: center; }
.center > * { margin-inline: auto; }
.measure { max-width: 24ch; }
.measure-l { max-width: 32ch; }

/* ---------- Bands ---------- */
.band { background: var(--bg); color: var(--fg); }
.band--raised { --bg: var(--color-highlight); }
.band--night {
  --bg: var(--color-ink);
  --bg-raised: #46423D;
  --fg: var(--color-cotton);
  --fg-muted: #B8B0A3;
  --rule: #5A554E;
  --moment: #7FB1B8;
  --key: var(--color-wing);
  color-scheme: dark;
}
/* Magpie — the key color. Deep PMS 301 ground, cotton type, wing-blue rules. */
.band--magpie {
  --bg: var(--color-magpie);
  --bg-raised: #1F5590;
  --fg: var(--color-cotton);
  --fg-muted: #B7CBE3;
  --rule: #3A6BA6;
  --moment: #9CC7CD;
  --key: var(--color-cotton);
  color-scheme: dark;
}
/* Key-tinted light surface — cotton with a breath of blue. */
.band--key-soft { --bg: var(--key-soft); --rule: #B9C5D3; }
.band--fiber {
  --bg: var(--color-shell);
  --bg-raised: #CB8E6E;
  --fg: var(--color-highlight);
  --fg-muted: #F4DFD0;
  --rule: #D9A687;
}

/* Hairline rules */
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.rule-b { border-bottom: 1px solid var(--rule); }
.rule-t { border-top: 1px solid var(--rule); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-body-s); font-weight: 500; letter-spacing: 0.02em;
  border: 1px solid var(--fg);
  color: var(--fg); background: transparent;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  white-space: nowrap;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn--solid { background: var(--fg); color: var(--bg); }
.btn--solid:hover { background: transparent; color: var(--fg); }
.btn--key { background: var(--color-magpie); border-color: var(--color-magpie); color: var(--color-cotton); }
.btn--key:hover { background: #12365E; border-color: #12365E; color: var(--color-cotton); }
.band--magpie .btn--key { background: var(--color-cotton); border-color: var(--color-cotton); color: var(--color-magpie); }
.band--magpie .btn--key:hover { background: transparent; color: var(--color-cotton); }
.btn--buy { background: var(--buy); border-color: var(--buy); color: var(--color-highlight); }
.btn--buy:hover { background: #875C44; border-color: #875C44; color: var(--color-highlight); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--fs-label); }
.btn .arrow { transition: transform var(--dur) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }
.link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-body-s); font-weight: 500; color: var(--fg);
  border-bottom: 1px solid var(--rule); padding-bottom: 2px;
  transition: border-color var(--dur) var(--ease-out);
}
.link:hover { border-color: var(--fg); }
.link--moment { color: var(--moment); }

/* ---------- Media frame ---------- */
.frame { position: relative; overflow: hidden; background: var(--color-dusk); }
.frame > img, .frame > video, .frame > canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame--4x5 { aspect-ratio: 4 / 5; }
.frame--3x4 { aspect-ratio: 3 / 4; }
.frame--1x1 { aspect-ratio: 1; }
.frame--16x9 { aspect-ratio: 16 / 9; }
.frame--21x9 { aspect-ratio: 21 / 9; }
.frame--r { border-radius: var(--radius-md); }

/* ---------- Reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 900ms var(--ease-out), transform 900ms var(--ease-out); }
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal-delay='1'] { transition-delay: 90ms; }
[data-reveal-delay='2'] { transition-delay: 180ms; }
[data-reveal-delay='3'] { transition-delay: 270ms; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .link, .btn .arrow { transition: none; }
}

/* ---------- a11y ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--key); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 100; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); }
.skip:focus { top: 12px; }
::selection { background: var(--color-dusk); color: var(--color-ink); }
