/* Wanedays. One stylesheet for all four pages.
 *
 * Tokens are the app's own (App/Design/Theme.swift). The only colour that moves
 * across the page is the chapter hue, exposed as --hue and re-declared per
 * section, which is the same structural idea the app uses across its chapters.
 *
 * The app is dark only on #0A0B0C, where chroma and hue say nothing about
 * whether a colour is visible and luminance contrast is the only measure that
 * does. Every text colour below is checked against the canvas in README.md.
 */

/* ---------- tokens ---------- */

:root {
  --canvas: #0a0b0c;
  --surface: #17191d;
  --surface-high: #22252a;
  --hairline: rgba(255, 255, 255, 0.08);

  --text: #f4f3f0;
  --text-muted: #a2a7ad;
  --text-faint: #7e848b;

  --ember: #ff5a2b;
  --amber: #ff7a2b;
  --gold: #ffa83d;
  --arrival: #4fbe7a;

  --hue: var(--ember);

  --display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;

  --measure: 68ch;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 14px;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--hue);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--hue) 35%, transparent);
  transition: border-color 140ms ease, color 140ms ease;
}

a:hover { border-bottom-color: var(--hue); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: color-mix(in srgb, var(--hue) 30%, transparent); }

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose { max-width: var(--measure); }

section { padding: clamp(56px, 9vw, 104px) 0; }

.rule { border-top: 1px solid var(--hairline); }

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(38px, 6.2vw, 68px); }
h2 { font-size: clamp(27px, 3.6vw, 38px); }
h3 { font-size: clamp(19px, 2vw, 22px); letter-spacing: -0.01em; }

p { margin: 0 0 1.15em; }

.lede {
  font-size: clamp(18px, 2.1vw, 22px);
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 60ch;
}

.eyebrow {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hue);
  margin: 0 0 18px;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 14.5px; }

strong { color: var(--text); font-weight: 600; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-high);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  color: var(--text);
}

/* ---------- header ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
  flex: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 26px);
  font-size: 14.5px;
}

.nav a {
  color: var(--text-muted);
  border: 0;
}

.nav a:hover { color: var(--text); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 12vw, 140px) 0 clamp(56px, 8vw, 96px);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 620px;
  background:
    radial-gradient(52% 60% at 22% 8%, rgba(255, 90, 43, 0.24), transparent 68%),
    radial-gradient(46% 56% at 78% 22%, rgba(255, 168, 61, 0.14), transparent 70%);
  filter: blur(24px);
  pointer-events: none;
}

.hero .wrap { position: relative; }

.hero h1 span { color: var(--hue); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 22px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 14px 26px;
  border-radius: 999px;
  border: 0;
  background: var(--text);
  color: var(--canvas);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 0;
}

.btn svg { flex: none; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.btn-ghost:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34); }

/* ---------- cards ---------- */

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  margin-top: 40px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 26px 24px;
}

.card h3 { margin-bottom: 0.4em; }
.card p { margin: 0; color: var(--text-muted); font-size: 15.5px; }

.card .tick {
  display: block;
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--hue);
  margin-bottom: 20px;
}

/* ---------- the milligram figure ---------- */

.figure {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: clamp(22px, 3.4vw, 34px);
}

.figure table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
}

.figure th,
.figure td {
  text-align: right;
  padding: 11px 8px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.figure th:first-child,
.figure td:first-child { text-align: left; }

.figure th {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.figure tr:last-child td { border-bottom: 0; }

.figure .total { color: var(--hue); font-weight: 600; }
.figure .rise { color: var(--text-muted); }

.scroll-x { overflow-x: auto; }

/* ---------- screenshot strip ---------- */

.shots {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-top: 40px;
}

.shot {
  aspect-ratio: 9 / 19.5;
  border-radius: 22px;
  border: 1px solid var(--hairline);
  background:
    linear-gradient(170deg, color-mix(in srgb, var(--hue) 16%, var(--surface)), var(--surface) 62%);
  display: flex;
  align-items: flex-end;
  padding: 18px;
  overflow: hidden;
}

.shot img {
  border-radius: 22px;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot figcaption {
  font-size: 13.5px;
  color: var(--text-muted);
  font-family: var(--display);
}

/* ---------- evidence / disclaimer ---------- */

.note {
  border-left: 2px solid var(--hue);
  padding: 4px 0 4px 22px;
  margin: 32px 0;
  color: var(--text-muted);
  font-size: 15.5px;
  max-width: var(--measure);
}

.note strong { color: var(--text); }

/* ---------- legal pages ---------- */

.doc { padding: clamp(48px, 7vw, 84px) 0 clamp(64px, 9vw, 104px); }

.doc h2 {
  font-size: clamp(21px, 2.5vw, 26px);
  margin-top: 2.2em;
  padding-top: 0.2em;
}

.doc h2:first-of-type { margin-top: 1.4em; }

.doc h3 { margin-top: 1.8em; font-size: 18px; }

.doc ul { padding-left: 20px; margin: 0 0 1.15em; }
.doc li { margin-bottom: 0.5em; color: var(--text-muted); }
.doc li strong { color: var(--text); }
.doc p { color: var(--text-muted); }
.doc p.lede { color: var(--text-muted); }

.stamp {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 2.4em;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 0 0 2.6em;
  max-width: var(--measure);
}

.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin-bottom: 0.35em; color: var(--text-muted); font-size: 15.5px; }

/* ---------- faq ---------- */

.faq {
  max-width: var(--measure);
  border-top: 1px solid var(--hairline);
}

.faq details {
  border-bottom: 1px solid var(--hairline);
  padding: 18px 0;
}

.faq summary {
  cursor: pointer;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  color: var(--hue);
  font-size: 20px;
  line-height: 1;
  flex: none;
}

.faq details[open] summary::after { content: "\00d7"; }

.faq details p {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 15.5px;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--hairline);
  padding: 48px 0 60px;
  color: var(--text-faint);
  font-size: 14.5px;
}

.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 40px;
  justify-content: space-between;
  align-items: flex-start;
}

.foot a { color: var(--text-muted); border: 0; }
.foot a:hover { color: var(--text); }

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.foot .quitline { color: var(--text-muted); }

/* ---------- hue drift ---------- */

.hue-ember { --hue: var(--ember); }
.hue-amber { --hue: var(--amber); }
.hue-gold { --hue: var(--gold); }
.hue-arrival { --hue: var(--arrival); }

/* ---------- skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--canvas);
  padding: 10px 18px;
  border: 0;
  z-index: 50;
}

.skip:focus { left: 12px; top: 12px; }
