/* ============================================================
   ATLAS DECODED — design system
   "Editorial Amber" — warm ink, paper text, disciplined gold.
   See DESIGN.md / theme.js.
   ============================================================ */

:root {
  --ink: #0E0C09;
  --ink-2: #16130E;
  --ink-3: #221C13;
  --line: #2E2718;
  --amber: #E8A33D;
  --gold: #F5C668;
  --deep: #B26A1B;
  --terra: #C96F4A;
  --dim: #4A4030;
  --text: #F2EDE3;
  --muted: #A29783;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  --maxw: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--amber); color: var(--ink); }

/* ---------- graticule backdrop ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.13;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 30%, transparent 100%);
  z-index: 0;
}

main, header, footer, nav { position: relative; z-index: 1; }

/* ---------- nav ---------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.nav-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
}
.nav-brand img { width: 34px; height: 34px; }
.nav-brand .wordmark {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.nav-brand .wordmark em { color: var(--amber); font-style: normal; }

.nav-links { display: flex; gap: 26px; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--gold); }

@media (max-width: 760px) {
  nav { padding: 12px 16px; }
  .nav-links { display: none; }
  .nav-brand img { width: 28px; height: 28px; }
  .nav-brand .wordmark { font-size: 11.5px; }
}

/* ---------- hero ---------- */
.hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 140px 28px 60px;
  position: relative;
  overflow: hidden;
}
.hero-art, .hero-gl {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0.55;
  mask-image: linear-gradient(to bottom, black 40%, transparent 98%);
}
.hero-gl { width: 100%; height: 100%; opacity: 0.85; }
.hero-inner { max-width: var(--maxw); margin: 0 auto; width: 100%; position: relative; }

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex; align-items: center; gap: 14px;
}
.kicker::before { content: ""; width: 44px; height: 1px; background: var(--gold); }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(44px, 7.4vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 22px 0 18px;
  max-width: 14ch;
}
.hero h1 .accent {
  background: linear-gradient(92deg, var(--deep), var(--amber) 60%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
}

.hero-meta {
  margin-top: 26px;
  display: flex; gap: 22px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.hero-meta span b { color: var(--text); font-weight: 500; }

@media (max-width: 760px) {
  .hero { padding: 110px 20px 44px; min-height: 88vh; }
  .hero h1 { font-size: clamp(38px, 11vw, 54px); }
  .hero-meta { gap: 10px 18px; font-size: 10.5px; }
}

/* ---------- coordinates strip ---------- */
.coords {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink-2) 62%, transparent);
}
.coords-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}
.coord {
  padding: 26px 18px;
  border-left: 1px solid var(--line);
}
.coord:first-child { border-left: none; }
.coord .num {
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.6vw, 34px);
  color: var(--gold);
  font-weight: 500;
}
.coord .lbl {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
@media (max-width: 900px) {
  .coords-inner { grid-template-columns: repeat(3, 1fr); }
  .coord:nth-child(4) { border-left: none; }
  .coord { border-top: 1px solid var(--line); }
  .coord:nth-child(-n+3) { border-top: none; }
}
@media (max-width: 560px) {
  .coords-inner { grid-template-columns: repeat(2, 1fr); }
  .coord { border-left: none !important; border-top: 1px solid var(--line); padding: 18px 14px; }
  .coord:nth-child(-n+2) { border-top: none; }
  .coord .num { font-size: 22px; }
}

/* ---------- sections ---------- */
section.chapter { padding: 110px 28px 40px; max-width: var(--maxw); margin: 0 auto; }

.chapter-head { display: grid; grid-template-columns: 1fr minmax(0, 420px); gap: 40px; align-items: end; margin-bottom: 54px; }
@media (max-width: 900px) { .chapter-head { grid-template-columns: 1fr; gap: 18px; } }

.chapter-no {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.chapter-head h2 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.chapter-head .chapter-blurb { color: var(--muted); font-size: 15.5px; }

.chapter-art {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: block;
  margin-bottom: 54px;
  mask-image: linear-gradient(to bottom, black 70%, transparent);
}

@media (max-width: 760px) {
  section.chapter { padding: 72px 18px 24px; }
  .chapter-head { margin-bottom: 34px; }
  .chapter-art { max-height: 300px; object-fit: cover; margin-bottom: 34px; }
}

/* ---------- findings grid ---------- */
.findings { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 820px) { .findings { grid-template-columns: 1fr; } }

.finding {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 22px;
  position: relative;
  transition: border-color 0.25s, transform 0.25s;
}
.finding:hover { border-color: var(--amber); transform: translateY(-3px); }
.finding .f-no {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--amber);
}
.finding h3 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 21px;
  line-height: 1.25;
  margin: 10px 0 10px;
}
.finding p { color: var(--muted); font-size: 14px; }
.finding .f-stat {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--gold);
}

@media (max-width: 760px) {
  .finding { padding: 20px; }
  .finding h3 { font-size: 19px; }
}

/* ---------- plates (charts) ---------- */
.plate {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 26px;
  position: relative;
}
.plate::before, .plate::after {
  content: "+";
  position: absolute;
  font-family: var(--font-mono);
  color: var(--line);
  font-size: 14px;
}
.plate::before { top: 6px; left: 10px; }
.plate::after { bottom: 6px; right: 10px; }

.plate-head { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; margin-bottom: 6px; flex-wrap: wrap; }
.plate-no {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--amber);
  white-space: nowrap;
}
.plate h4 {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 22px;
  line-height: 1.25;
}
.plate .reading {
  color: var(--gold);
  font-size: 14px;
  margin: 6px 0 22px;
  max-width: 72ch;
}
.plate .reading::before { content: "The reading — "; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.plate .src { margin-top: 18px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; }

.plate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 900px) { .plate-grid { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .plate { padding: 20px 16px; }
  .plate h4 { font-size: 19px; }
  .plate .reading { font-size: 13px; margin-bottom: 16px; }
  .plate .src { font-size: 9.5px; }
}

/* ---------- pull quote ---------- */
.pullquote {
  max-width: 840px;
  margin: 90px auto;
  padding: 0 28px;
  text-align: center;
}
.pullquote blockquote {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: 480;
  font-style: italic;
  line-height: 1.35;
  color: var(--text);
}
.pullquote blockquote::before { content: "“"; color: var(--amber); }
.pullquote blockquote::after { content: "”"; color: var(--amber); }
.pullquote cite {
  display: block;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 760px) { .pullquote { margin: 56px auto; padding: 0 20px; } }

/* ---------- charts ---------- */
.chart { width: 100%; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.bar-row .bar-label { font-size: 13px; color: var(--text); text-align: right; line-height: 1.3; }
.bar-track { background: var(--ink); border-radius: 6px; height: 22px; position: relative; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 6px;
  width: 0;
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-row .bar-val { font-family: var(--font-mono); font-size: 12.5px; color: var(--gold); min-width: 58px; }
.bar-row.dim .bar-val { color: var(--muted); }
.bar-row.dim .bar-label { color: var(--muted); }

@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; }
  .bar-row .bar-label { grid-column: 1 / -1; text-align: left; font-size: 12.5px; }
  .bar-row .bar-track { height: 18px; }
  .bar-row .bar-val { min-width: 0; font-size: 11.5px; align-self: center; }
}

.legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.legend span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.donut-wrap { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.donut-wrap svg { flex: 0 0 auto; max-width: 100%; }
.donut-center-num { font-family: var(--font-mono); font-size: 30px; fill: var(--text); }
.donut-center-lbl { font-family: var(--font-mono); font-size: 9.5px; fill: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; }

@media (max-width: 760px) {
  .ou-grid, .stat-grid { grid-template-columns: 1fr !important; }
}

/* ---------- footer ---------- */
footer {
  margin-top: 120px;
  border-top: 1px solid var(--line);
  padding: 50px 28px 60px;
  background: var(--ink-2);
}
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
@media (max-width: 800px) { .footer-inner { grid-template-columns: 1fr; } }
footer h5 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
footer p { color: var(--muted); font-size: 13.5px; max-width: 52ch; }

@media (max-width: 760px) { footer { margin-top: 72px; padding: 40px 20px 48px; } }

@media print {
  nav { position: absolute; }
}

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar-row .bar-fill { transition: none; }
  html { scroll-behavior: auto; }
}
