/* ============================================================
   The Definitive Guide to AI Data Centers — design system
   "Engineering atlas / control room at night"
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #0a0c10;
  --bg-2:      #0e1116;
  --panel:     #12161d;
  --panel-2:   #161b23;
  --line:      rgba(232, 230, 222, 0.09);
  --line-2:    rgba(232, 230, 222, 0.16);

  /* ink */
  --ink:       #e9e6dd;
  --ink-2:     #b7bcc4;
  --muted:     #7d848e;
  --faint:     #565d67;

  /* the two spines + spectrum */
  --power:     #e0913a;   /* copper-amber — grid-to-chip power */
  --power-dim: #8a5e2a;
  --heat:      #46c7d8;   /* cyan — chip-to-atmosphere heat */
  --heat-dim:  #2b7d88;
  --signal:    #c8d44a;   /* signal/data green-gold */

  --font-display: 'Archivo', system-ui, -apple-system, sans-serif;
  --font-body:    'Spectral', Georgia, 'Times New Roman', serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --rail: 320px;
  --header-h: 60px;
  --maxread: 76ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* blueprint grid + vignette */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    radial-gradient(120% 80% at 80% -10%, rgba(224,145,58,0.07), transparent 60%),
    radial-gradient(100% 90% at -10% 110%, rgba(70,199,216,0.06), transparent 55%);
  background-size: 44px 44px, 44px 44px, 100% 100%, 100% 100%;
  background-attachment: fixed;
}

/* faint film grain overlay */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(224,145,58,0.28); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); }

a { color: inherit; text-decoration: none; }

/* ============================================================ HEADER */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: rgba(10,12,16,0.82);
  backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 6px;
  background:
     linear-gradient(135deg, var(--power), var(--power-dim));
  position: relative; box-shadow: 0 0 0 1px var(--line-2), 0 6px 20px -8px var(--power);
}
.brand-mark::after {
  content:""; position:absolute; inset: 6px 6px auto auto; width: 10px; height: 10px;
  border-right: 2px solid var(--heat); border-bottom: 2px solid var(--heat); opacity:.9;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-text b {
  font-family: var(--font-display); font-weight: 800; font-size: 14.5px; letter-spacing: .2px;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-text span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }

.search-wrap { margin-left: auto; position: relative; width: min(340px, 40vw); }
.search-wrap input {
  width: 100%; height: 38px; padding: 0 14px 0 38px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px;
  color: var(--ink); font-family: var(--font-mono); font-size: 13px; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.search-wrap input::placeholder { color: var(--faint); }
.search-wrap input:focus { border-color: var(--power-dim); box-shadow: 0 0 0 3px rgba(224,145,58,0.12); }
.search-wrap svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; stroke: var(--muted); }
.search-kbd { position:absolute; right:10px; top:9px; font-family:var(--font-mono); font-size:10px; color:var(--faint); border:1px solid var(--line-2); border-radius:4px; padding:2px 5px; }

.hamburger { display: none; background: none; border: 1px solid var(--line-2); border-radius: 8px; width: 38px; height: 38px; cursor: pointer; color: var(--ink); }
.hamburger svg { width: 18px; height: 18px; stroke: currentColor; }

/* ============================================================ LAYOUT */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; padding-top: var(--header-h); }

/* ---- NAV RAIL ---- */
.rail {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  border-right: 1px solid var(--line); background: linear-gradient(180deg, var(--bg-2), var(--bg));
  padding: 14px 10px 60px; z-index: 30;
}
.rail-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: .24em; text-transform: uppercase; color: var(--faint); padding: 8px 12px 12px; }

.part { margin-bottom: 2px; }
.part-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border: none; background: none; cursor: pointer;
  color: var(--ink-2); text-align: left; border-radius: 8px;
  border-left: 2px solid transparent; transition: background .15s, color .15s;
}
.part-head:hover { background: var(--panel); color: var(--ink); }
.part.open > .part-head { color: var(--ink); }
.part-num {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; flex: none;
  width: 26px; height: 22px; display: grid; place-items: center; border-radius: 5px;
  color: var(--pc, var(--power)); background: color-mix(in srgb, var(--pc, var(--power)) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc, var(--power)) 30%, transparent);
}
.part-name { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; line-height: 1.25; flex: 1; }
.part-caret { width: 13px; height: 13px; flex: none; stroke: var(--muted); transition: transform .2s; }
.part.open .part-caret { transform: rotate(90deg); }

.chapters { display: none; padding: 3px 0 8px 12px; margin-left: 18px; border-left: 1px solid var(--line); }
.part.open .chapters { display: block; animation: slideDown .22s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.chap-link {
  display: flex; gap: 9px; padding: 6px 10px; border-radius: 7px; cursor: pointer;
  color: var(--muted); font-size: 13px; line-height: 1.35; transition: background .14s, color .14s;
}
.chap-link:hover { background: var(--panel); color: var(--ink-2); }
.chap-link.active { background: color-mix(in srgb, var(--pc, var(--power)) 14%, transparent); color: var(--ink); }
.chap-link.active .chap-n { color: var(--pc, var(--power)); }
.chap-n { font-family: var(--font-mono); font-size: 11px; color: var(--faint); flex: none; padding-top: 1px; }

/* ============================================================ MAIN */
.main { min-width: 0; position: relative; z-index: 1; }
.view { max-width: 920px; margin: 0 auto; padding: 38px 40px 120px; animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* breadcrumb */
.crumb { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-bottom: 22px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb a:hover { color: var(--ink); }
.crumb .sep { color: var(--faint); }
.crumb .now { color: var(--pc, var(--power)); }

/* ---- HOME / HERO ---- */
.hero { padding: 18px 0 8px; }
.hero .eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--power); margin-bottom: 22px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 800; font-size: clamp(32px, 5vw, 54px);
  line-height: 1.04; letter-spacing: -.015em; margin: 0 0 20px; color: #fff;
}
.hero h1 .hl { color: var(--power); }
.hero h1 .hl2 { color: var(--heat); }
.hero .lede { font-size: 19px; color: var(--ink-2); max-width: 64ch; margin: 0 0 30px; }

.stats { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 40px; }
.stat { border: 1px solid var(--line); border-radius: 11px; padding: 14px 18px; background: var(--panel); min-width: 116px; }
.stat b { font-family: var(--font-display); font-weight: 700; font-size: 28px; color: var(--ink); display: block; }
.stat span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.stat.power b { color: var(--power); } .stat.heat b { color: var(--heat); }

/* spines diagram */
.spines { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, var(--panel), var(--bg-2)); padding: 22px 24px; margin: 6px 0 44px; }
.spines h3 { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; font-weight: 500; }
.spine { display: flex; align-items: center; gap: 0; margin: 12px 0; font-family: var(--font-mono); font-size: 11.5px; flex-wrap: wrap; }
.spine .lbl { width: 132px; flex: none; color: var(--ink-2); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.spine .node { color: var(--ink-2); white-space: nowrap; }
.spine .arr { color: var(--faint); padding: 0 7px; }
.spine.pw .node:hover { color: var(--power); }
.spine.ht .node:hover { color: var(--heat); }
.spine.pw .track { box-shadow: inset 0 0 0 1px var(--power-dim); }
.spine-line { height: 2px; margin-top: 4px; border-radius: 2px; }
.spine.pw .spine-line { background: linear-gradient(90deg, var(--power), transparent); }
.spine.ht .spine-line { background: linear-gradient(90deg, var(--heat), transparent); }

/* part grid */
.section-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--faint); margin: 40px 0 16px; border-top: 1px solid var(--line); padding-top: 22px; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }
.pcard {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 18px; background: var(--panel);
  cursor: pointer; position: relative; overflow: hidden; transition: transform .16s, border-color .16s, background .16s;
}
.pcard::before { content:""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--pc, var(--power)); opacity: .85; }
.pcard:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--panel-2); }
.pcard .pc-num { font-family: var(--font-mono); font-size: 11px; color: var(--pc, var(--power)); letter-spacing: .1em; }
.pcard h4 { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.18; margin: 8px 0 8px; color: var(--ink); }
.pcard .pc-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.pcard .pc-chaps { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; line-height: 1.5; opacity: .82; }

/* ---- PART VIEW ---- */
.part-hero { border-left: 3px solid var(--pc, var(--power)); padding-left: 20px; margin-bottom: 30px; }
.part-hero .pk { font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--pc, var(--power)); }
.part-hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px,4vw,40px); line-height: 1.08; margin: 12px 0 0; color: #fff; }

.chap-list { display: flex; flex-direction: column; gap: 10px; }
.chap-card { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); padding: 16px 18px; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.chap-card:hover { border-color: var(--line-2); background: var(--panel-2); transform: translateX(3px); }
.chap-card .cc-top { display: flex; align-items: baseline; gap: 12px; }
.chap-card .cc-n { font-family: var(--font-mono); font-size: 13px; color: var(--pc, var(--power)); flex: none; }
.chap-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 17px; margin: 0; color: var(--ink); line-height: 1.25; }
.chap-card .cc-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 8px; padding-left: 38px; }

/* ---- CHAPTER VIEW ---- */
.chap-view h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(25px,3.6vw,37px); line-height: 1.1; margin: 6px 0 6px; color: #fff; letter-spacing: -.01em; }
.chap-view .chap-key { font-family: var(--font-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--pc, var(--power)); }
.decide-box {
  border: 1px solid var(--line-2); border-left: 3px solid var(--pc, var(--power)); border-radius: 10px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2)); padding: 16px 20px; margin: 26px 0 30px;
}
.decide-box .db-l { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.decide-box p { margin: 0; color: var(--ink-2); font-size: 15.5px; }

.sec-h { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.sec-list { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.sec-list li {
  position: relative; padding: 13px 14px 13px 46px; border-bottom: 1px solid var(--line);
  color: var(--ink); font-size: 16px; line-height: 1.5;
}
.sec-list li::before {
  counter-increment: s; content: counter(s, decimal-leading-zero);
  position: absolute; left: 12px; top: 15px; font-family: var(--font-mono); font-size: 11px; color: var(--faint);
}
.sec-list li:hover { background: rgba(255,255,255,0.015); }
.sec-list li.xref { color: var(--ink-2); }
.sec-list li .xchip {
  display: inline-block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--heat); border: 1px solid var(--heat-dim); border-radius: 4px; padding: 1px 6px; margin-right: 8px; vertical-align: 1px;
}

/* chapter footer nav */
.chap-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 40px; }
.chap-nav a { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel); transition: border-color .15s, background .15s; }
.chap-nav a:hover { border-color: var(--line-2); background: var(--panel-2); }
.chap-nav .dir { font-family: var(--font-mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.chap-nav .ttl { font-family: var(--font-display); font-size: 14px; color: var(--ink); margin-top: 4px; line-height: 1.25; }
.chap-nav a.next { text-align: right; }
.chap-nav a.disabled { opacity: .35; pointer-events: none; }

.phase-note { margin-top: 34px; font-family: var(--font-mono); font-size: 12px; color: var(--faint); border: 1px dashed var(--line-2); border-radius: 10px; padding: 14px 16px; }

/* ---- SEARCH RESULTS ---- */
.results .rlabel { font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.ritem { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 13px 16px; margin-bottom: 9px; background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s; }
.ritem:hover { border-color: var(--line-2); background: var(--panel-2); }
.ritem .rpath { font-family: var(--font-mono); font-size: 11px; color: var(--pc, var(--power)); margin-bottom: 4px; }
.ritem .rtext { color: var(--ink); font-size: 15px; }
.ritem mark { background: rgba(224,145,58,.25); color: #fff; border-radius: 2px; padding: 0 2px; }
.empty { color: var(--muted); font-family: var(--font-mono); font-size: 13px; padding: 30px 0; }

/* footer */
.foot { max-width: 920px; margin: 0 auto; padding: 26px 40px 50px; border-top: 1px solid var(--line); color: var(--faint); font-family: var(--font-mono); font-size: 11px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.foot a:hover { color: var(--ink-2); }

/* scrim for mobile nav */
.scrim { display: none; position: fixed; inset: var(--header-h) 0 0; background: rgba(0,0,0,.55); z-index: 25; backdrop-filter: blur(2px); }

/* ============================================================ RESPONSIVE */
@media (max-width: 940px) {
  :root { --rail: 300px; }
  .shell { grid-template-columns: 1fr; }
  .hamburger { display: grid; place-items: center; order: -1; }
  .rail {
    position: fixed; top: var(--header-h); left: 0; width: var(--rail); max-width: 86vw;
    transform: translateX(-104%); transition: transform .26s cubic-bezier(.4,0,.2,1); box-shadow: 30px 0 80px -30px #000;
  }
  body.nav-open .rail { transform: none; }
  body.nav-open .scrim { display: block; }
  .view, .foot { padding-left: 22px; padding-right: 22px; }
  .brand-text span { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .search-wrap { width: 44vw; }
  .search-kbd { display: none; }
  .view { padding-top: 26px; }
}

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

/* ============================================================ PHASE 2 — COMPONENT KIT */

/* pinned "Explore" nav section */
.rail-explore { margin: 0 0 10px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.xlink { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 8px; cursor: pointer; color: var(--ink-2); border-left: 2px solid transparent; transition: background .14s, color .14s; }
.xlink:hover { background: var(--panel); color: var(--ink); }
.xlink.active { background: var(--panel-2); color: var(--ink); border-left-color: var(--power); }
.xlink svg { width: 15px; height: 15px; flex: none; stroke: currentColor; opacity: .8; }
.xlink b { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; }

/* home tool cards */
.tools-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.tool-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; background: var(--panel); cursor: pointer; transition: transform .15s, border-color .15s, background .15s; }
.tool-card:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--panel-2); }
.tool-card .ti { width: 32px; height: 32px; flex: none; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--ac, var(--power)) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac, var(--power)) 32%, transparent); }
.tool-card .ti svg { width: 17px; height: 17px; stroke: var(--ac, var(--power)); }
.tool-card h5 { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; margin: 0 0 3px; color: var(--ink); }
.tool-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

/* ---- authored chapter ---- */
.thesis { font-family: var(--font-body); font-size: 20px; font-style: italic; color: var(--ink); line-height: 1.5; margin: 4px 0 20px; padding-left: 16px; border-left: 3px solid var(--pc, var(--power)); }
.threads { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.thread-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; border: 1px solid; }
.thread-tag.tg-power { color: var(--power); border-color: var(--power-dim); }
.thread-tag.tg-goodput { color: var(--signal); border-color: #6f7a2a; }
.thread-tag.tg-density { color: var(--heat); border-color: var(--heat-dim); }

.c-h { font-family: var(--font-display); font-weight: 700; font-size: 21px; color: #fff; margin: 38px 0 12px; padding-top: 8px; }
.c-prose p { font-size: 16.5px; line-height: 1.68; color: var(--ink); margin: 0 0 16px; }
.c-prose strong { color: #fff; font-weight: 600; }
.c-prose ul { margin: 0 0 16px; padding-left: 22px; }
.c-prose li { margin: 5px 0; line-height: 1.6; }
.c-prose code, code { font-family: var(--font-mono); font-size: .88em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--heat); }
a[data-ch] { color: var(--heat); border-bottom: 1px solid var(--heat-dim); cursor: pointer; }
a[data-ch]:hover { color: #7fe3f0; }

/* decision / comparison table */
.dtable-wrap { margin: 22px 0 26px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.dtable-cap { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 16px 0; }
.dtable-note { font-size: 13px; color: var(--muted); padding: 2px 16px 10px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); text-align: left; padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line-2); cursor: pointer; white-space: nowrap; user-select: none; position: relative; }
.dtable th:hover { color: var(--ink); }
.dtable th.sorted::after { content: "↕"; position: absolute; right: 8px; opacity: .6; font-size: 10px; }
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; line-height: 1.45; }
.dtable tr:last-child td { border-bottom: none; }
.dtable tbody tr:hover { background: rgba(255,255,255,0.018); }
.dtable td:first-child, .dtable th:first-child { font-weight: 600; color: var(--ink); position: sticky; left: 0; background: var(--bg-2); }
.dtable td:first-child { font-family: var(--font-display); }

/* callouts */
.callout { border: 1px solid var(--line-2); border-left-width: 3px; border-radius: 10px; padding: 14px 18px; margin: 20px 0; background: var(--panel); }
.callout .co-l { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.callout p { margin: 0; color: var(--ink); font-size: 15.5px; line-height: 1.6; }
.callout.decision { border-left-color: var(--power); } .callout.decision .co-l { color: var(--power); }
.callout.warning { border-left-color: #e0563a; } .callout.warning .co-l { color: #e0563a; }
.callout.insight { border-left-color: var(--heat); } .callout.insight .co-l { color: var(--heat); }

/* key numbers */
.keynums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 22px 0 26px; }
.keynum { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: var(--panel); }
.keynum .kv { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--power); line-height: 1.1; }
.keynum .kl { font-size: 12.5px; color: var(--ink-2); margin: 5px 0 8px; line-height: 1.35; }
.keynum .ks { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); letter-spacing: .03em; }
.keynum .ks b { color: var(--muted); font-weight: 500; }

/* details deep-dive */
details.cdetails { border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; background: var(--bg-2); overflow: hidden; }
details.cdetails > summary { cursor: pointer; padding: 13px 16px; font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 10px; }
details.cdetails > summary::-webkit-details-marker { display: none; }
details.cdetails > summary::before { content: "+"; font-family: var(--font-mono); color: var(--heat); font-size: 16px; width: 14px; }
details.cdetails[open] > summary::before { content: "–"; }
details.cdetails[open] > summary { border-bottom: 1px solid var(--line); }
details.cdetails .dd { padding: 14px 16px; }
details.cdetails .dd p { font-size: 15px; line-height: 1.62; color: var(--ink-2); margin: 0 0 12px; }
.c-xref { font-size: 14px; color: var(--muted); margin: 18px 0; padding: 12px 16px; border: 1px dashed var(--line-2); border-radius: 10px; font-style: italic; }

/* ---- ATLAS (interactive diagrams) ---- */
.atlas-intro { color: var(--ink-2); font-size: 16px; max-width: 70ch; margin: 8px 0 26px; }
.atlas-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.spine-col h3 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 0 0 4px; }
.spine-col .sh { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.spine-col.pw h3 { color: var(--power); } .spine-col.ht h3 { color: var(--heat); }
.snode { cursor: pointer; }
.snode rect { transition: fill .15s, stroke .15s; }
.snode:hover rect { stroke-width: 2; }
.snode .nl { font-family: var(--font-display); font-weight: 600; font-size: 13px; fill: var(--ink); }
.snode .nv { font-family: var(--font-mono); font-size: 10.5px; fill: var(--muted); }
.snode:hover .nv { fill: var(--ink-2); }
.atlas-tip { position: fixed; z-index: 60; max-width: 260px; background: #05070a; border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; color: var(--ink); box-shadow: 0 12px 40px -10px #000; pointer-events: none; opacity: 0; transition: opacity .12s; }
.atlas-tip .tt-ch { font-family: var(--font-mono); font-size: 10px; color: var(--power); display: block; margin-top: 4px; }
.atlas-note { margin-top: 26px; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }

/* ---- CALCULATORS ---- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.calc { border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); padding: 18px 20px; }
.calc h4 { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin: 0 0 3px; color: var(--ink); }
.calc .csub { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.calc .field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 9px 0; }
.calc .field label { font-size: 13px; color: var(--ink-2); flex: 1; }
.calc .field input { width: 118px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 7px; color: var(--ink); font-family: var(--font-mono); font-size: 13px; padding: 6px 9px; text-align: right; }
.calc .field input:focus { outline: none; border-color: var(--power-dim); }
.calc .field select { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 7px; color: var(--ink); font-family: var(--font-mono); font-size: 13px; padding: 6px 9px; }
.calc-out { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.calc-out .big { font-family: var(--font-display); font-weight: 800; font-size: 30px; color: var(--power); line-height: 1; }
.calc-out .big.heat { color: var(--heat); }
.calc-out .bl { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.calc-out .brk { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.5; }
.calc-out .brk b { color: var(--ink); font-family: var(--font-mono); }
.calc .verdict { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--heat); }

/* ---- PROVENANCE REGISTER ---- */
.reg-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 18px; }
.reg-controls input { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; padding: 7px 11px; width: 230px; }
.reg-chip { font-family: var(--font-mono); font-size: 11px; padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line-2); color: var(--muted); cursor: pointer; transition: all .14s; }
.reg-chip:hover { color: var(--ink); }
.reg-chip.on { background: color-mix(in srgb, var(--power) 16%, transparent); color: var(--power); border-color: var(--power-dim); }
.reg-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.reg-table th { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.reg-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.reg-table .rm { color: var(--ink); font-weight: 600; }
.reg-table .rv { font-family: var(--font-mono); color: var(--power); white-space: nowrap; }
.reg-table .rc { color: var(--muted); font-size: 12.5px; }
.reg-table .rsrc a { color: var(--heat); }
.reg-table .rasof { font-family: var(--font-mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.reg-cat { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--heat); }

@media (max-width: 820px) {
  .atlas-wrap { grid-template-columns: 1fr; }
}
