:root {
  color-scheme: dark;
  --ink-950: #071013;
  --ink-900: #0b171b;
  --ink-850: #102027;
  --ink-800: #162a31;
  --ink-700: #26414a;
  --paper: #f3f0e8;
  --paper-muted: #b7c2c0;
  --signal: #ffb454;
  --signal-strong: #ff8f3f;
  --aqua: #79d7cf;
  --risk: #ff756f;
  --ok: #8cd49a;
  --line: rgba(183, 194, 192, 0.22);
  --line-strong: rgba(183, 194, 192, 0.42);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --radius-sm: 0.45rem;
  --radius: 0.85rem;
  --radius-lg: 1.35rem;
  --measure: 74ch;
  --page: min(92rem, calc(100% - 2rem));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  background: var(--ink-950);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(rgba(121, 215, 207, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(121, 215, 207, 0.035) 1px, transparent 1px),
    var(--ink-950);
  background-size: 32px 32px;
  font-size: clamp(1rem, 0.975rem + 0.125vw, 1.075rem);
  line-height: 1.65;
}

body::before {
  position: fixed;
  inset: 0 0 auto;
  z-index: -1;
  height: 32rem;
  background: radial-gradient(circle at 82% 12%, rgba(255, 180, 84, 0.13), transparent 42%);
  content: "";
  pointer-events: none;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--aqua); text-underline-offset: 0.2em; text-decoration-thickness: 0.08em; }
a:hover { color: #b5f3ed; }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--ink-950);
  background: var(--paper);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }

.site-header, header[role="banner"] {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 19, 0.92);
  backdrop-filter: blur(14px);
}

.site-header > *, header[role="banner"] > *, main, .site-footer > *, footer > * {
  width: var(--page);
  margin-inline: auto;
}

.shell { width: 100%; margin-inline: auto; }
.site-header > .shell, .site-footer > .shell, footer > .shell { width: var(--page); }
.narrow { max-width: 58rem; }
.header-row { display: flex; gap: 1.25rem; align-items: center; justify-content: space-between; min-height: 4.25rem; }
.header-row nav { min-height: 0; }
.wordmark { color: var(--paper); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; font-weight: 850; letter-spacing: 0.06em; text-decoration: none; text-transform: uppercase; }

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
}

nav ul { display: flex; flex-wrap: wrap; gap: 0.55rem 1rem; margin: 0; padding: 0; list-style: none; }
nav a { color: var(--paper-muted); font-size: 0.88rem; font-weight: 700; text-decoration: none; }
nav a[aria-current="page"], nav a:hover { color: var(--paper); }

.brand, .eyebrow, .kicker, .overline {
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

main { padding-block: clamp(2.5rem, 7vw, 7rem); }
main > section, main > article, .section { margin-block: clamp(4rem, 9vw, 8rem); }
main > :first-child { margin-top: 0; }

.intro, .page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  padding-block: clamp(2rem, 6vw, 5.5rem);
  border-bottom: 1px solid var(--line);
}

.hero, .page-header { max-width: 76rem; padding-block: clamp(2rem, 6vw, 5.5rem); border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 12ch; }
.hero .lede { max-width: 68ch; }
.boundary { max-width: 70ch; padding: 1rem 1.15rem; border-left: 0.25rem solid var(--signal); color: var(--paper); background: rgba(255, 180, 84, 0.07); }

h1, h2, h3, h4 { margin: 0 0 0.6em; line-height: 1.05; letter-spacing: -0.035em; text-wrap: balance; }
h1 { max-width: 13ch; font-size: clamp(2.65rem, 7vw, 6.8rem); }
h2 { max-width: 21ch; font-size: clamp(2rem, 4vw, 4.3rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.65rem); letter-spacing: -0.02em; }
h4 { font-size: 1rem; letter-spacing: 0; }
p { max-width: var(--measure); margin: 0 0 1rem; color: var(--paper-muted); }
.lede, .standfirst { color: var(--paper); font-size: clamp(1.12rem, 2vw, 1.48rem); line-height: 1.45; }
.meta, .small, small { color: var(--paper-muted); font-size: 0.82rem; }

.hero-card, .panel, .callout, .disclosure, .method-note {
  padding: clamp(1.1rem, 2.5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 32, 39, 0.75);
  box-shadow: var(--shadow);
}

.callout, .disclosure { border-left: 0.28rem solid var(--signal); }
.warning, [data-tone="risk"] { border-color: color-mix(in srgb, var(--risk), transparent 35%); }

.metric-grid, .card-grid, .layer-grid, .control-grid, .source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric, .card, .layer-card, .control-card, .source-card {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-900);
}

.metric strong, .card strong, .status-value { color: var(--paper); font-size: 1.16rem; }
.layer-card { border-top: 3px solid var(--aqua); }
.control-card[data-required="true"], [data-requirement="required"] { border-top: 3px solid var(--signal-strong); }

.mapper, .tool-layout, .workspace {
  display: grid;
  grid-template-columns: minmax(18rem, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}

#mapper {
  display: grid;
  grid-template-columns: minmax(19rem, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
#mapper > .section-heading, #mapper > noscript { grid-column: 1 / -1; }
.section-heading { max-width: 68rem; }
.section-heading > p:last-child { max-width: 62ch; }
.section-tint { padding: clamp(2rem, 5vw, 4.5rem); border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(16, 32, 39, 0.72); }
.preset-row { margin-bottom: 1.35rem; padding-bottom: 1.35rem; border-bottom: 1px solid var(--line); }
.preset-row label { display: block; margin-bottom: 0.5rem; }
.criteria-grid { display: grid; gap: 0; }
.criteria-grid fieldset { margin: 0; padding: 1.05rem 0; border-top: 1px solid var(--line); }
.criteria-grid legend { float: left; width: 100%; }
.criteria-grid legend + * { clear: both; }
.criteria-grid fieldset > p, .field-help { margin-bottom: 0.55rem; color: var(--paper-muted); font-size: 0.84rem; line-height: 1.45; }
.choice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.choice-row label { display: flex; gap: 0.4rem; align-items: center; justify-content: center; min-height: 2.55rem; padding: 0.4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ink-950); cursor: pointer; }
.primary-button { margin-top: 0.5rem; }
.export-row { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.result-panel article, .result-panel .control-card { margin-top: 0.85rem; }
.result-panel ul { padding-left: 1.2rem; }
.notice { padding: 1rem; border: 1px solid var(--signal); border-radius: var(--radius); color: var(--paper); background: rgba(255, 180, 84, 0.07); }
.fact-pack { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem; margin-top: 2rem; }
.fact-pack > div { padding: 0.9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ink-900); }
.fact-pack dt, .fact-pack dd { padding: 0; border: 0; }
.fact-pack dt { color: var(--signal); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; }
.fact-pack dd { margin-top: 0.35rem; color: var(--paper); font-size: 0.9rem; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.25rem, 4vw, 4rem); }
.chain-grid, .gate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.chain-grid article, .gate-grid article { min-width: 0; padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-900); }
.chain-grid ol, .gate-grid ol { padding-left: 1.25rem; color: var(--paper-muted); }
.exposure-list { display: grid; gap: 0.75rem; padding: 0; list-style: none; }
.exposure-list li { padding: 0.85rem 1rem; border-left: 3px solid var(--risk); background: rgba(255, 117, 111, 0.055); }
.wide-figure { margin-inline: 0; }
.changelog { max-width: none; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }

form, .mapper-form {
  min-width: 0;
  padding: clamp(1.15rem, 2.4vw, 2rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--ink-900);
}

fieldset { min-width: 0; margin: 0 0 1.25rem; padding: 0; border: 0; }
legend { margin-bottom: 0.65rem; color: var(--paper); font-weight: 800; }
label { color: var(--paper); font-weight: 650; }
.field, .question, .criterion { padding-block: 1rem; border-top: 1px solid var(--line); }
.field:first-child, .question:first-child, .criterion:first-child { border-top: 0; }

select, input[type="text"], input[type="search"] {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--paper);
  background: var(--ink-950);
  font: inherit;
}

.radio-group, .segmented, [role="radiogroup"] { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.65rem; }
.radio-option, .segmented label {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  min-height: 2.65rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--ink-850);
  cursor: pointer;
}
input[type="radio"], input[type="checkbox"] { inline-size: 1.15rem; block-size: 1.15rem; accent-color: var(--signal); }

button, .button {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.68rem 1rem;
  border: 1px solid var(--signal);
  border-radius: var(--radius-sm);
  color: var(--ink-950);
  background: var(--signal);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { color: var(--ink-950); background: #ffc879; }
button.secondary, .button.secondary, [data-export] { color: var(--paper); background: transparent; border-color: var(--line-strong); }
button:disabled, [aria-disabled="true"] { opacity: 0.44; cursor: not-allowed; }
.actions, .export-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1rem; }

#control-map-result, .mapper-result, output[aria-live] {
  position: sticky;
  top: 5.4rem;
  min-width: 0;
  max-height: calc(100vh - 6.4rem);
  overflow: auto;
  padding: clamp(1.15rem, 2.4vw, 2rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--ink-850);
  box-shadow: var(--shadow);
}

[data-stale="true"], .is-stale { border-color: var(--risk) !important; }
.status, .badge, .pill, code {
  display: inline-flex;
  padding: 0.18rem 0.48rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--aqua);
  background: var(--ink-950);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.status[data-status="INSUFFICIENT_SCOPE_EVIDENCE"] { color: var(--risk); border-color: var(--risk); }
.status[data-status="CONTROL_PLAN_READY"] { color: var(--ok); border-color: var(--ok); }

pre {
  max-width: 100%;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-950);
}
pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  white-space: pre;
}

dl { display: grid; gap: 0; margin: 1.5rem 0; }
dl > div { display: grid; grid-template-columns: minmax(10rem, 0.32fr) minmax(0, 1fr); }
dt, dd { min-width: 0; margin: 0; padding: 0.8rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
dt { padding-right: 1rem; color: var(--paper); font-weight: 750; }
dd { color: var(--paper-muted); }
.result-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 1.25rem; }
.result-facts > div { display: block; min-width: 0; }
.result-facts dt, .result-facts dd { padding: 0.45rem 0; }
.result-facts dd { border-top: 0; color: var(--paper); }
.result-section { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.control-card h5 { margin: 0 0 0.45rem; color: var(--paper); font-size: 1.05rem; line-height: 1.3; }
.control-meta { color: var(--signal); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.76rem; font-weight: 750; text-transform: uppercase; }
.evidence-records details { margin-top: 0.7rem; }
.evidence-records li { overflow-wrap: anywhere; }

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 48rem; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; color: var(--paper); background: var(--ink-800); }
tbody tr:hover { background: rgba(121, 215, 207, 0.045); }

figure {
  margin: 2.25rem 0;
  padding: clamp(0.85rem, 2vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-900);
}
figure img { width: 100%; border-radius: var(--radius-sm); }
figcaption { margin-top: 0.85rem; color: var(--paper-muted); font-size: 0.84rem; }

.attack-chain, .timeline, .flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.attack-chain > *, .timeline > *, .flow > * { position: relative; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); }

details { margin-block: 0.65rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-900); }
summary { color: var(--paper); font-weight: 750; cursor: pointer; }

.site-footer, footer { margin-top: 5rem; padding-block: 2.5rem; border-top: 1px solid var(--line); color: var(--paper-muted); }
.site-footer nav, footer nav { min-height: 0; }

@media (max-width: 900px) {
  .hero, .intro, .page-intro, .mapper, .tool-layout, .workspace { grid-template-columns: 1fr; }
  .metric-grid, .card-grid, .layer-grid, .control-grid, .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #mapper { grid-template-columns: 1fr; }
  #mapper > .section-heading, #mapper > noscript { grid-column: auto; }
  .fact-pack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain-grid, .gate-grid { grid-template-columns: 1fr; }
  #control-map-result, .mapper-result, output[aria-live] { position: static; max-height: none; overflow: visible; }
}

@media (max-width: 600px) {
  :root { --page: min(100% - 1.1rem, 44rem); }
  .site-header, header[role="banner"] { position: static; }
  nav { align-items: flex-start; padding-block: 0.8rem; }
  nav, nav ul { flex-direction: column; }
  .header-row { align-items: flex-start; padding-block: 0.75rem; }
  .header-row nav { gap: 0.4rem; padding: 0; }
  main { padding-top: 1.5rem; }
  h1 { font-size: clamp(2.35rem, 13vw, 4.1rem); }
  .metric-grid, .card-grid, .layer-grid, .control-grid, .source-grid { grid-template-columns: 1fr; }
  .fact-pack, .two-column { grid-template-columns: 1fr; }
  .choice-row { grid-template-columns: 1fr; }
  .radio-group, .segmented, [role="radiogroup"] { display: grid; grid-template-columns: 1fr; }
  .radio-option, .segmented label { width: 100%; }
  dl > div { grid-template-columns: 1fr; }
  dt { padding-bottom: 0.2rem; }
  dd { padding-top: 0.2rem; border-top: 0; }
  .result-facts { grid-template-columns: 1fr; }
  .actions > *, .export-actions > * { width: 100%; }
}

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

@media (forced-colors: active) {
  :root { color-scheme: light dark; }
  body { background: Canvas; }
  body::before { display: none; }
  .hero-card, .panel, .callout, .disclosure, .method-note, form, .mapper-form,
  #control-map-result, .mapper-result, output[aria-live], .card, .layer-card, .control-card,
  .source-card, figure, details { border: 1px solid CanvasText; background: Canvas; box-shadow: none; }
  button, .button { border: 2px solid ButtonText; }
  a { color: LinkText; }
}

@media print {
  :root { color-scheme: light; --paper: #111; --paper-muted: #333; --line: #bbb; --ink-900: #fff; --ink-850: #fff; }
  body { color: #111; background: #fff; font-size: 10.5pt; }
  body::before, .site-header, header[role="banner"], .skip-link, .actions, .export-actions, button { display: none !important; }
  main { width: 100%; padding: 0; }
  main > section, main > article, .section { margin-block: 1.5rem; }
  h1 { font-size: 32pt; }
  h2 { font-size: 23pt; }
  a { color: #111; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; overflow-wrap: anywhere; }
  .hero-card, .panel, .callout, .disclosure, .method-note, form, .mapper-form,
  #control-map-result, .mapper-result, output[aria-live], .card, .layer-card, .control-card,
  .source-card, figure, details { color: #111; background: #fff; box-shadow: none; break-inside: avoid; }
  #control-map-result, .mapper-result, output[aria-live] { position: static; max-height: none; overflow: visible; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8pt; }
}
