/* Case-study pages. Brand tokens match the live static site (Direction B). */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0F1E33;
  --navy2: #16263d;
  --cyan: #16A6D9;
  --clay: #C8502D;
  --slate: #5B6B7F;
  --cream: #F1EBDD;
  --soft: #F3F1EC;
  --white: #ffffff;
  --ink: #1c2733;
  --warmdark: #1A1815;
  --warmtext: #E6E0D4;
  --line: rgba(15, 30, 51, .12);
  --read-font: 'Atkinson Hyperlegible', sans-serif;
  --read-scale: 1;
  --read-tracking: normal;
  --surface: var(--cream);
  --surface-text: var(--ink);
  --nav-h: 72px;
}

html[data-surface="cream"] { --surface: var(--cream); --surface-text: var(--ink); }
html[data-surface="soft"]  { --surface: var(--soft);  --surface-text: var(--ink); }
html[data-surface="white"] { --surface: var(--white); --surface-text: var(--ink); }
html[data-theme="dark"] {
  --surface: #0A1422;
  --surface-text: var(--warmtext);
  --line: rgba(91, 107, 127, .35);
  --ink: var(--warmtext);
  --navy2: #1A2A40;
  /* #5B6B7F on #0A1422 is 3.39:1. Same secondary text the work map already uses in dark. */
  --slate: #b7c3d1;
}
html[data-theme="dark"] .rc-panel { --slate: #5B6B7F; }
/* Brand clay #C8502D is 4.09:1 on #0A1422. Clay soft is the dark-surface pair. */
html[data-theme="dark"] .callout.mine h3 { color: #D98A6A; }

html { scroll-behavior: smooth; font-size: calc(100% * var(--read-scale, 1)); scroll-padding-top: 132px; }
body {
  font-family: var(--read-font), 'Atkinson Hyperlegible', sans-serif;
  background: var(--surface);
  color: var(--surface-text);
  line-height: 1.65;
  letter-spacing: var(--read-tracking, normal);
}
img { max-width: 100%; }
a { color: var(--cyan); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 2px; }
.skip {
  position: absolute; left: 12px; top: -40px; z-index: 300;
  background: var(--clay); color: var(--white); padding: 8px 12px; text-decoration: none;
}
.skip:focus { top: 12px; }

.site-nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(15, 30, 51, .96);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--cyan); text-decoration: none;
  font-family: Archivo, sans-serif; font-weight: 700; font-size: 1.15rem;
}
.brand-mark {
  display: inline-block; height: 36px; aspect-ratio: 351 / 560;
  background: var(--cream);
  -webkit-mask: url("/assets/brand/dhagota-mark.svg") no-repeat center / contain;
  mask: url("/assets/brand/dhagota-mark.svg") no-repeat center / contain;
}
.nav-actions { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; gap: 22px; list-style: none; }
.nav-links a {
  color: rgba(255,255,255,.78); text-decoration: none;
  font-size: .92rem; font-weight: 600;
}
.nav-links a[aria-current="page"] { color: var(--white); }
.nav-links a:hover { color: var(--cyan); }

.icon-btn, .rc-toggle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn {
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,.32);
}
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-btn .ic-sun { display: none; }
html[data-theme="dark"] .icon-btn .ic-sun { display: block; }
html[data-theme="dark"] .icon-btn .ic-moon { display: none; }
.rc-toggle {
  background: var(--cyan); color: var(--navy); border: none;
  font-family: Archivo, sans-serif; font-weight: 900;
}
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; }

.rc-panel {
  position: fixed; top: 84px; right: 16px; z-index: 200;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--cream); color: #1c2733;
  border: 1px solid #d3dae1; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15,30,51,.22);
  padding: 20px; display: none;
}
.rc-panel.open { display: block; }
.rc-panel h2 {
  font-family: Archivo, sans-serif; font-size: .95rem; font-weight: 800;
  color: var(--navy); margin-bottom: 4px;
}
.rc-intro { font-size: .8rem; color: var(--slate); margin-bottom: 14px; }
.rc-group { margin-bottom: 14px; }
.rc-label {
  display: block; font-size: .68rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--slate); margin-bottom: 8px;
}
.rc-row { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-btn {
  border: 1px solid rgba(15,30,51,.18); background: #fff; color: #1c2733;
  border-radius: 8px; padding: 7px 11px; cursor: pointer; font: inherit; font-size: .82rem;
}
.rc-btn[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.rc-why { font-size: .76rem; color: var(--slate); margin-top: 8px; }
.rc-why .star { color: var(--clay); font-weight: 700; }
.rc-darkhint { display: none; font-size: .76rem; color: var(--slate); margin-top: 4px; }
html[data-theme="dark"] #rcSurfaceGroup .rc-row { display: none; }
html[data-theme="dark"] #rcSurfaceGroup .rc-darkhint { display: block; }

.wrap { width: min(760px, calc(100% - 40px)); margin: 0 auto; }
.wide { width: min(980px, calc(100% - 40px)); margin: 0 auto; }

.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .72rem; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 12px;
}
h1 {
  font-family: Archivo, sans-serif;
  font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.08;
  color: var(--surface-text);
}
.deck { font-size: 1.15rem; max-width: 38rem; margin-top: 16px; }
.meta { margin-top: 18px; color: var(--slate); font-size: .92rem; }

.chapters {
  position: sticky; top: var(--nav-h); z-index: 90;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.chapters ol {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none;
  width: min(980px, calc(100% - 24px)); margin: 0 auto; padding: 8px 0 10px;
}
.chapters a {
  display: inline-block; text-decoration: none; white-space: nowrap;
  color: var(--surface-text); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 700;
}
.chapters a[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
html[data-theme="dark"] .chapters a[aria-current="true"] { background: var(--cyan); color: var(--navy); border-color: var(--cyan); }

section { padding: 56px 0; border-top: 1px solid var(--line); }
section h2 {
  font-family: Archivo, sans-serif; font-size: 1.7rem; font-weight: 800;
  line-height: 1.2; margin-bottom: 14px; color: var(--surface-text);
}
.prose p { margin: 0 0 14px; max-width: 62ch; }
.prose p:last-child { margin-bottom: 0; }

.callout {
  border-left: 3px solid var(--slate);
  padding: 14px 16px; margin: 14px 0;
  background: color-mix(in srgb, var(--surface-text) 5%, var(--surface));
}
.callout.mine { border-left-color: var(--clay); }
.callout h3 {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 8px; color: var(--slate);
}
.callout.mine h3 { color: var(--clay); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.tabs button, .seg button, .ask form button, .text-btn {
  font: inherit; cursor: pointer;
  border-radius: 8px; padding: 8px 12px;
  border: 1px solid var(--line); background: transparent; color: var(--surface-text);
}
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
html[data-theme="dark"] .tabs button[aria-selected="true"],
html[data-theme="dark"] .seg button[aria-pressed="true"] {
  background: var(--cyan); color: var(--navy); border-color: var(--cyan);
}
.panel[hidden] { display: none; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.card, .metric {
  text-align: left; font: inherit; color: inherit;
  background: color-mix(in srgb, var(--surface-text) 4%, var(--surface));
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
}
.metric { cursor: pointer; width: 100%; }
.kicker {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan);
}
.card h3, .metric strong { display: block; margin-top: 6px; font-family: Archivo, sans-serif; font-size: 1.02rem; }
.card p, .metric p { margin-top: 8px; color: var(--slate); font-size: .92rem; }
html[data-theme="dark"] .card p, html[data-theme="dark"] .metric p { color: #c5d0dc; }

.roles { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: .92rem; }
.roles th, .roles td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.roles th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }

.translate { display: grid; gap: 10px; }
.translate button { text-align: left; }
.translate .now { margin-top: 8px; }

.ask form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 12px; }
.ask form label { grid-column: 1 / -1; }
.ask input {
  flex: 1; font: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--white); color: #1c2733;
}
.ask form button { background: var(--cyan); color: var(--navy); border-color: var(--cyan); font-weight: 700; }
.answer {
  margin-top: 14px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--line); min-height: 3.2em;
}

.agent {
  width: min(760px, calc(100% - 40px));
  margin: 28px auto 64px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .82rem; line-height: 1.55;
  background: var(--navy); color: #E6E0D4;
  border-radius: 12px; padding: 22px;
  overflow-x: auto;
}
.agent h2 { font-family: Archivo, sans-serif; color: var(--cyan); font-size: 1.2rem; margin-bottom: 10px; }
.agent dt { color: var(--cyan); margin-top: 12px; }
.agent dd { margin-left: 0; }
body.agent-mode .human { display: none; }
body.agent-mode .chapters { display: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 22px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; border-radius: 0; }

.graph-wrap { margin-top: 28px; }
.graph {
  width: 100%; height: auto; display: block;
  background: var(--navy); border-radius: 16px;
}
.graph text { font-family: Archivo, sans-serif; font-size: 13px; fill: #E6E0D4; }
.graph .node-btn { cursor: pointer; }
.graph-note {
  margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
}
.study-card {
  display: block; text-decoration: none; color: inherit;
  margin-top: 22px; padding: 22px;
  border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--cyan) 8%, var(--surface));
}
.study-card:hover { border-color: var(--cyan); }
.study-card h2 { font-size: 1.45rem; margin: 8px 0; }
.study-card .go { display: inline-block; margin-top: 12px; font-weight: 700; color: var(--cyan); }

.page-footer {
  border-top: 1px solid var(--line);
  padding: 28px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--slate); font-size: .85rem;
}
.page-footer a { color: var(--slate); }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 20px 16px;
    background: rgba(15, 30, 51, .98);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .cards, .translate { grid-template-columns: 1fr; }
  .ask form { grid-template-columns: 1fr; }
  .roles, .roles tbody, .roles tr, .roles td { display: block; }
  .roles thead { display: none; }
  .roles td { border-bottom: none; padding: 4px 0; }
  .roles tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
}

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