/* ==========================================================================
   Evan Promise — Data Analytics Portfolio
   Brand tokens come from the "Evan Promise New Logo Files" kit:
   deep navy #0F2847 · blue #1B3F6B · gold #C9993A / #E0B86A · ivory #FAF8F4
   ========================================================================== */

:root {
  --deep: #0F2847;
  --blue: #1B3F6B;
  --gold: #C9993A;
  --gold-lt: #E0B86A;
  --ivory: #FAF8F4;

  --bg: #FAF8F4;
  --bg-soft: #F3EFE6;
  --surface: #FFFFFF;
  --ink: #14213A;
  --muted: #566176;
  --line: #E4DED1;
  --link: #1B3F6B;
  --gold-text: #8A6417;
  --btn-bg: #0F2847;
  --btn-ink: #FAF8F4;
  --shadow: 0 1px 2px rgba(15, 40, 71, .06), 0 8px 24px rgba(15, 40, 71, .07);
  --shadow-lg: 0 2px 4px rgba(15, 40, 71, .08), 0 18px 48px rgba(15, 40, 71, .14);

  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1120px;
  --prose: 740px;
  --head-h: 68px;

  --font-ui: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0A1A31;
  --bg-soft: #0F2240;
  --surface: #0F2847;
  --ink: #F1EDE4;
  --muted: #A8B3C6;
  --line: #22406B;
  --link: #E0B86A;
  --gold-text: #E0B86A;
  --btn-bg: #E0B86A;
  --btn-ink: #0F2847;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1A31;
    --bg-soft: #0F2240;
    --surface: #0F2847;
    --ink: #F1EDE4;
    --muted: #A8B3C6;
    --line: #22406B;
    --link: #E0B86A;
    --gold-text: #E0B86A;
    --btn-bg: #E0B86A;
    --btn-ink: #0F2847;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 48px rgba(0, 0, 0, .4);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--head-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--font-ui); line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .5em; font-weight: 600; }
p { margin: 0 0 1em; }
.container { width: min(100% - 40px, var(--maxw)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn-bg); color: var(--btn-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--head-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 44px; width: auto; display: block; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  font-family: var(--font-ui); font-size: .9rem; font-weight: 500; color: var(--ink);
  text-decoration: none; padding: 8px 14px; border-radius: 999px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg-soft); }
.nav a[aria-current="page"] { background: var(--deep); color: var(--ivory); }
:root[data-theme="dark"] .nav a[aria-current="page"] { background: var(--gold-lt); color: var(--deep); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav a[aria-current="page"] { background: var(--gold-lt); color: var(--deep); }
}
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.icon-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; top: var(--head-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 20px 18px; gap: 2px;
    display: none; box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1rem; }
  .brand img { height: 38px; }
}

/* ---------- Buttons / chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-weight: 500; font-size: .95rem;
  padding: 12px 22px; border-radius: 999px; text-decoration: none; border: 1.5px solid transparent;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s, border-color .15s; cursor: pointer;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn-gold { background: var(--gold); color: var(--deep); }
.btn-gold:hover { background: var(--gold-lt); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn svg { width: 16px; height: 16px; flex: none; }
.chip {
  display: inline-block; font-family: var(--font-ui); font-size: .75rem; font-weight: 500; letter-spacing: .02em;
  padding: 4px 11px; border-radius: 999px; background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.eyebrow {
  font-family: var(--font-ui); text-transform: uppercase; letter-spacing: .16em; font-size: .75rem; font-weight: 600;
  color: var(--gold-text); margin-bottom: 14px; display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--gold); display: inline-block; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: var(--ivory);
  background:
    radial-gradient(1000px 420px at 85% -10%, rgba(201, 153, 58, .22), transparent 60%),
    linear-gradient(180deg, #0F2847 0%, #0B2040 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: url("brand/pattern-on-dark.svg") repeat; background-size: 48px auto; opacity: .9;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
  pointer-events: none;
}
.hero .container { position: relative; padding-block: clamp(56px, 9vw, 112px); }
.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero .eyebrow { color: var(--gold-lt); }
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.7rem); font-weight: 600; letter-spacing: -0.025em; margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--gold-lt); }
.hero p.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: rgba(250, 248, 244, .84); max-width: 58ch; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero .btn-primary { background: var(--gold); color: var(--deep); }
.hero .btn-primary:hover { background: var(--gold-lt); }
.hero .btn-ghost { color: var(--ivory); border-color: rgba(250, 248, 244, .4); }
.hero .btn-ghost:hover { border-color: var(--gold-lt); }
.hero-stats { display: grid; gap: 14px; }
.stat {
  background: rgba(250, 248, 244, .06); border: 1px solid rgba(250, 248, 244, .14);
  border-radius: var(--radius); padding: 18px 22px; backdrop-filter: blur(6px);
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px;
}
.stat b { font-family: var(--font-ui); font-size: 2.1rem; font-weight: 600; color: var(--gold-lt); line-height: 1; min-width: 4.6ch; }
.stat span { color: rgba(250, 248, 244, .8); font-size: .95rem; line-height: 1.4; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-stats { grid-template-columns: 1fr; } }

/* ---------- Sections ---------- */
.section { padding-block: clamp(48px, 7vw, 88px); }
.section.soft { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); }
.section-head p { color: var(--muted); font-size: 1.1rem; }

/* ---------- Feature (home) ---------- */
.feature {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-lg);
}
.feature-media { background: #fff; display: grid; place-items: center; padding: 22px; border-right: 1px solid var(--line); }
.feature-media img { border-radius: 8px; box-shadow: 0 8px 28px rgba(15, 40, 71, .18); border: 1px solid var(--line); }
.feature-body { padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.feature-body h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.feature-body p { color: var(--muted); margin: 0; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 4px; }
.mini-kpis div { border-left: 3px solid var(--gold); padding-left: 12px; }
.mini-kpis b { display: block; font-family: var(--font-ui); font-size: 1.5rem; line-height: 1.1; color: var(--ink); }
.mini-kpis span { font-size: .8rem; color: var(--muted); line-height: 1.3; display: block; margin-top: 4px; }
.feature .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 900px) { .feature { grid-template-columns: 1fr; } .feature-media { border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- Project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s, border-color .2s; position: relative;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--gold); }
.card-media { aspect-ratio: 16 / 10; background: #fff; border-bottom: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.card-media.cover img { object-fit: cover; padding: 0; object-position: top left; }
.card-body { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-kicker { font-family: var(--font-ui); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); font-weight: 600; }
.card h3 { font-size: 1.28rem; margin: 0; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { color: var(--muted); font-size: .98rem; margin: 0; }
.card .chips { margin-top: auto; padding-top: 6px; }
.card-links { display: flex; gap: 16px; font-family: var(--font-ui); font-size: .85rem; font-weight: 500; position: relative; z-index: 2; padding-top: 6px; }
.card-links a { text-decoration: none; border-bottom: 1.5px solid var(--gold); padding-bottom: 1px; }
.card-links a:hover { border-bottom-width: 2.5px; }

/* ---------- Steps / process ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; position: relative; }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero); font-family: var(--font-ui); font-weight: 600; font-size: 2rem;
  color: var(--gold); display: block; line-height: 1; margin-bottom: 10px;
}
.step h3 { font-size: 1.1rem; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); font-size: .98rem; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Reader paths ---------- */
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.path { border-radius: var(--radius); padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.path.dark { background: var(--deep); color: var(--ivory); border-color: var(--deep); }
.path h3 { font-size: 1.25rem; }
.path p { color: var(--muted); }
.path.dark p { color: rgba(250, 248, 244, .78); }
.path ul { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.path li a { font-family: var(--font-ui); font-size: .92rem; font-weight: 500; }
.path.dark li a { color: var(--gold-lt); }
@media (max-width: 800px) { .paths { grid-template-columns: 1fr; } }

/* ---------- Toolbox ---------- */
.toolbox { display: flex; flex-wrap: wrap; gap: 10px; }
.tool { font-family: var(--font-ui); font-size: .9rem; font-weight: 500; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.tool.lead { background: var(--deep); color: var(--ivory); border-color: var(--deep); }
:root[data-theme="dark"] .tool.lead { background: var(--gold-lt); color: var(--deep); border-color: var(--gold-lt); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tool.lead { background: var(--gold-lt); color: var(--deep); border-color: var(--gold-lt); } }
.path .toolbox { margin-top: 16px; gap: 8px; }
.path.dark .tool, :root[data-theme] .path.dark .tool { background: rgba(250, 248, 244, .08); color: var(--ivory); border-color: rgba(250, 248, 244, .22); }
.path.dark .tool.lead, :root[data-theme] .path.dark .tool.lead { background: var(--gold-lt); color: var(--deep); border-color: var(--gold-lt); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .path.dark .tool { background: rgba(250, 248, 244, .08); color: var(--ivory); border-color: rgba(250, 248, 244, .22); } :root:not([data-theme="light"]) .path.dark .tool.lead { background: var(--gold-lt); color: var(--deep); border-color: var(--gold-lt); } }
.path.dark .eyebrow { color: var(--gold-lt); }

/* ---------- CTA band ---------- */
.band { background: var(--deep); color: var(--ivory); position: relative; overflow: hidden; }
.band::before { content: ""; position: absolute; inset: 0; background: url("brand/pattern-on-dark.svg") repeat; background-size: 48px auto; opacity: .6; }
.band .container { position: relative; padding-block: 64px; display: flex; gap: 28px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 6px; }
.band p { margin: 0; color: rgba(250, 248, 244, .8); }

/* ---------- Page head (inner pages) ---------- */
.page-head { background: var(--deep); color: var(--ivory); position: relative; overflow: hidden; }
.page-head::before { content: ""; position: absolute; inset: 0; background: url("brand/pattern-on-dark.svg") repeat; background-size: 48px auto; opacity: .7; -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent); }
.page-head .container { position: relative; padding-block: clamp(40px, 6vw, 72px); }
.page-head h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); margin-bottom: 12px; }
.page-head p { color: rgba(250, 248, 244, .82); max-width: 62ch; font-size: 1.15rem; margin-bottom: 0; }
.page-head .eyebrow { color: var(--gold-lt); }
.crumbs { font-family: var(--font-ui); font-size: .82rem; color: rgba(250, 248, 244, .7); margin-bottom: 18px; }
.crumbs a { color: var(--gold-lt); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin-inline: 8px; opacity: .6; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter { appearance: none; font-family: var(--font-ui); font-size: .85rem; font-weight: 500; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: all .15s; }
.filter:hover { border-color: var(--gold); }
.filter[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.card[hidden] { display: none; }
.count { color: var(--muted); font-family: var(--font-ui); font-size: .85rem; margin-left: auto; align-self: center; }

/* ---------- Project page ---------- */
.proj-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 22px 0 0; font-size: .92rem; color: rgba(250, 248, 244, .85); }
.proj-meta div b { display: block; font-family: var(--font-ui); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-lt); font-weight: 600; }
.proj-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.page-head .btn-gold { background: var(--gold); }
.page-head .btn-ghost { color: var(--ivory); border-color: rgba(250, 248, 244, .4); }
.kpi-strip { margin-top: -34px; position: relative; z-index: 2; }
.kpi-strip .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.kpi { padding: 20px 22px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi b { display: block; font-family: var(--font-ui); font-size: 1.9rem; font-weight: 600; line-height: 1.05; color: var(--ink); }
.kpi b i { font-style: normal; color: var(--gold-text); }
.kpi span { display: block; margin-top: 6px; font-size: .84rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 700px) { .kpi { border-right: 0; border-bottom: 1px solid var(--line); } .kpi:last-child { border-bottom: 0; } }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); padding-block: 56px 24px; align-items: start; }
.toc { position: sticky; top: calc(var(--head-h) + 24px); font-family: var(--font-ui); font-size: .85rem; }
.toc h2 { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--gold); font-weight: 600; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

.prose { max-width: var(--prose); min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); margin: 2.4em 0 .6em; padding-top: .4em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.2rem; margin: 1.8em 0 .4em; }
.prose h4 { font-size: 1rem; margin: 1.4em 0 .3em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--gold); }
.prose strong { font-weight: 600; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--gold); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--bg-soft); border: 1px solid var(--line); padding: .1em .4em; border-radius: 5px; }
.prose pre { background: #0B1D38; color: #EDE9DF; padding: 18px 20px; border-radius: var(--radius-sm); overflow-x: auto; font-size: .86rem; line-height: 1.6; border: 1px solid #16335D; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .94rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--font-ui); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg-soft); }
.prose figure { margin: 1.8em 0; }
.prose figure img { border-radius: var(--radius-sm); border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; display: block; width: 100%; }
.prose figcaption { font-size: .86rem; color: var(--muted); margin-top: 10px; }
.zoomable img { cursor: zoom-in; }

.callout { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius-sm); padding: 20px 24px; margin: 0 0 1.6em; box-shadow: var(--shadow); }
.callout h3 { margin: 0 0 .5em; font-size: 1.05rem; font-family: var(--font-ui); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.navy { background: var(--deep); border-color: var(--deep); border-left-color: var(--gold); color: var(--ivory); }
.callout.navy h3 { color: var(--gold-lt); }
.callout.soft { background: var(--bg-soft); box-shadow: none; }

.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 1.4em 0; }
.cols-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 1.4em 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; }
.tile b { display: block; font-family: var(--font-ui); font-size: 1.6rem; line-height: 1.1; }
.tile b i { color: var(--gold-text); font-style: normal; }
.tile span { font-size: .88rem; color: var(--muted); display: block; margin-top: 6px; line-height: 1.4; }
.tile.h { border-top: 3px solid var(--gold); }
.tile h4 { margin: 0 0 4px; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 1rem; }
.tile p { margin: 0; font-size: .92rem; color: var(--muted); }
@media (max-width: 700px) { .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.timeline { display: grid; gap: 14px; margin: 1.4em 0; }
.horizon { display: grid; grid-template-columns: 120px 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.horizon .when { background: var(--deep); color: var(--ivory); padding: 18px; font-family: var(--font-ui); display: flex; flex-direction: column; justify-content: center; }
.horizon .when small { color: var(--gold-lt); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.horizon .when b { font-size: 1.05rem; line-height: 1.2; margin-top: 4px; }
.horizon .what { padding: 16px 20px 16px 0; }
.horizon .what h4 { margin: 0 0 4px; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 1.05rem; }
.horizon .what p { margin: 0 0 8px; font-size: .94rem; color: var(--muted); }
.horizon .what .kpi-pill { display: inline-block; font-family: var(--font-ui); font-size: .78rem; font-weight: 500; background: var(--bg-soft); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; }
@media (max-width: 640px) { .horizon { grid-template-columns: 1fr; gap: 0; } .horizon .what { padding: 16px 18px; } }

.files { display: grid; gap: 10px; margin: 1.2em 0; }
.file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.file:hover { border-color: var(--gold); transform: translateX(3px); }
.file .ext { font-family: var(--font-ui); font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-align: center; padding: 8px 0; border-radius: 6px; background: var(--deep); color: var(--gold-lt); }
.file b { display: block; overflow-wrap: anywhere; font-family: var(--font-ui); font-size: .94rem; font-weight: 500; }
.file span.d { display: block; font-size: .84rem; color: var(--muted); line-height: 1.4; }
.file .go { font-family: var(--font-ui); font-size: .8rem; color: var(--gold-text); font-weight: 500; white-space: nowrap; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 1.6em 0; }
.gallery figure { margin: 0; }
.gallery figcaption { font-size: .84rem; }
@media (max-width: 700px) { .gallery { grid-template-columns: 1fr; } }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-block: 24px 72px; }
.pager a { display: block; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px 22px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.pager a:hover { border-color: var(--gold); transform: translateY(-2px); }
.pager small { font-family: var(--font-ui); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); font-weight: 600; display: block; margin-bottom: 4px; }
.pager b { font-family: var(--font-ui); font-size: 1.05rem; }
.pager .next { text-align: right; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; } }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 300px; gap: 56px; align-items: start; }
.about-aside { position: sticky; top: calc(var(--head-h) + 24px); display: grid; gap: 14px; }
.about-aside .tile h4 { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text); margin-bottom: 8px; }
.about-aside ul { margin: 0; padding-left: 1.1em; font-size: .94rem; }
@media (max-width: 900px) { .about-grid { grid-template-columns: minmax(0, 1fr); } .about-aside { position: static; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--deep); color: rgba(250, 248, 244, .78); font-size: .94rem; }
.site-footer .container { padding-block: 48px 36px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.site-footer img.foot-logo { height: 48px; width: auto; display: block; margin-bottom: 16px; }
.site-footer h2 { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-lt); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--ivory); text-decoration: none; }
.site-footer a:hover { color: var(--gold-lt); text-decoration: underline; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid rgba(250, 248, 244, .14); padding-top: 20px; font-size: .82rem; color: rgba(250, 248, 244, .6); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
@media (max-width: 760px) { .site-footer .container { grid-template-columns: 1fr; } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(6, 16, 32, .92); display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(96vw, 1400px); max-height: 90vh; border-radius: 8px; background: #fff; box-shadow: 0 20px 80px rgba(0, 0, 0, .6); }
.lightbox button { position: absolute; top: 18px; right: 18px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .site-header, .toc, .site-footer, .pager, .band { display: none; }
  .layout { grid-template-columns: 1fr; }
}

/* ---------- In-page charts (pure HTML/CSS, readable without JavaScript) ---------- */
.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 20px 22px 18px; margin: 1.6em 0; box-shadow: var(--shadow); }
.chart h4 { margin: 0 0 2px; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 1.02rem; }
.chart .sub { font-size: .85rem; color: var(--muted); margin: 0 0 16px; }
.bars { display: grid; gap: 9px; }
.bar { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 12px; font-size: .9rem; }
.bar .l { font-family: var(--font-ui); font-weight: 500; font-size: .84rem; }
.bar .t { height: 14px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar .t i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
:root[data-theme="dark"] .bar .t i { background: #5C86BD; }
.bar.hi .t i { background: var(--gold); }
.bar .v { font-family: var(--font-ui); font-weight: 600; text-align: right; font-size: .86rem; }
.bar.ref .l, .bar.ref .v { color: var(--muted); font-weight: 500; }
.bar.ref .t i { background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 10px); opacity: .6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar .t i { background: #5C86BD; } :root:not([data-theme="light"]) .bar.hi .t i { background: var(--gold); } }
:root[data-theme="dark"] .bar.hi .t i { background: var(--gold); }
@media (max-width: 560px) { .bar { grid-template-columns: 110px 1fr 42px; gap: 8px; } }

.stack { display: grid; gap: 14px; }
.srow { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 12px; }
.srow .l { font-family: var(--font-ui); font-weight: 600; font-size: .84rem; }
.srow .t { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.srow .t i { display: block; height: 100%; }
.srow .t .a { background: var(--gold); }
.srow .t .b { background: var(--blue); }
.srow .t .c { background: #A9B7CC; }
:root[data-theme="dark"] .srow .t .b { background: #5C86BD; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .srow .t .b { background: #5C86BD; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; color: var(--muted); margin-top: 14px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; background: var(--c); vertical-align: -1px; }
.srow-nums { font-size: .82rem; color: var(--muted); margin: -6px 0 0 82px; }
