/* Shared visual system for the public security-review showcase.
   Structure: scale tokens (theme-independent) -> light palette -> dark palette
   (system preference + manual override) -> components -> responsive -> print. */

:root {
  /* Type scale. One modular ramp for every page; headings are ink,
     navy is reserved for labels, links and structural accents. */
  --fs-h1: clamp(32px, 4.5vw, 44px);
  --fs-h1-compact: clamp(24px, 3vw, 30px);
  --fs-h2: clamp(22px, 2.6vw, 28px);
  --fs-h3: 20px;
  --fs-h4: 17px;
  --fs-lg: 18px;
  --fs-body: 16px;
  --fs-table: 14px;
  --fs-sm: 13px;
  --fs-meta: 12px;
  --fs-label: 11px;
  --fs-fieldlabel: 10.5px;
  --track-heading: -0.02em;
  --track-label: 0.08em;
  --track-field: 0.06em;

  /* Layout */
  --measure: 72ch;
  --wide: 1100px;
  --gutter: clamp(1.2rem, 4.5vw, 4.8rem);

  --mono: "Cascadia Code", "Cascadia Mono", Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

:root {
  color-scheme: light;
  --paper: #ffffff;
  --ground: #f4f2ed;
  --ink: #17212b;
  --muted: #5e6872;
  --line: #d9d7d1;
  --line-strong: #bdb9b0;
  --navy: #173b57;
  --navy-soft: #eaf0f4;
  --amber: #a85d17;
  --amber-text: #9f5615;
  --amber-soft: #fbf0e3;
  --red: #9a342d;
  --red-soft: #f8e9e7;
  --green: #36694f;
  --green-soft: #e9f1ec;
  --gold: #6d5806;
  --gold-soft: #f7f1d2;
  --link: #1b5d8c;
  --link-hover: #0f3d5f;
  --code-bg: #eef0f1;
  --code-ink: #17212b;
  --pre-bg: #101923;
  --pre-ink: #e9eef2;
  --surface: #ffffff;
  --surface-subtle: #f7f9fa;
  --surface-muted: #f2f3f3;
  --footer-bg: #f5f5f3;
  --hero-start: rgb(234 240 244 / 88%);
  --hero-end: rgb(255 255 255 / 96%);
  --action-border: #b9cbd7;
  --shadow: 0 2px 4px rgb(23 33 43 / 6%), 0 14px 34px rgb(23 33 43 / 7%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #141c24;
    --ground: #0d1319;
    --ink: #e8eef4;
    --muted: #a8b5c1;
    --line: #2b3742;
    --line-strong: #42505d;
    --navy: #77b8e5;
    --navy-soft: #16293a;
    --amber: #e09a3f;
    --amber-text: #eab06a;
    --amber-soft: #322717;
    --red: #ef8d84;
    --red-soft: #381f1e;
    --green: #7bc09b;
    --green-soft: #17291f;
    --gold: #e4d34f;
    --gold-soft: #2e2a10;
    --link: #82c4ef;
    --link-hover: #b6dcf4;
    --code-bg: #222d37;
    --code-ink: #e8eef4;
    --pre-bg: #090e13;
    --pre-ink: #e8eef4;
    --surface: #1b2530;
    --surface-subtle: #18212a;
    --surface-muted: #202b35;
    --footer-bg: #111820;
    --hero-start: rgb(22 41 58 / 92%);
    --hero-end: rgb(20 28 36 / 97%);
    --action-border: #31526a;
    --shadow: 0 2px 5px rgb(0 0 0 / 32%), 0 16px 38px rgb(0 0 0 / 28%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141c24;
  --ground: #0d1319;
  --ink: #e8eef4;
  --muted: #a8b5c1;
  --line: #2b3742;
  --line-strong: #42505d;
  --navy: #77b8e5;
  --navy-soft: #16293a;
  --amber: #e09a3f;
  --amber-text: #eab06a;
  --amber-soft: #322717;
  --red: #ef8d84;
  --red-soft: #381f1e;
  --green: #7bc09b;
  --green-soft: #17291f;
  --gold: #e4d34f;
  --gold-soft: #2e2a10;
  --link: #82c4ef;
  --link-hover: #b6dcf4;
  --code-bg: #222d37;
  --code-ink: #e8eef4;
  --pre-bg: #090e13;
  --pre-ink: #e8eef4;
  --surface: #1b2530;
  --surface-subtle: #18212a;
  --surface-muted: #202b35;
  --footer-bg: #111820;
  --hero-start: rgb(22 41 58 / 92%);
  --hero-end: rgb(20 28 36 / 97%);
  --action-border: #31526a;
  --shadow: 0 2px 5px rgb(0 0 0 / 32%), 0 16px 38px rgb(0 0 0 / 28%);
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* Per-report identity: the accent promised by the landing cards is
   carried onto the destination pages via a masthead top rule. */
body.report-application {
  --report-accent: var(--amber);
}

body.report-azure {
  --report-accent: var(--navy);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--link-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

code {
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 0.91em;
}

pre {
  max-width: 900px;
  margin: 0.9rem 0 1.1rem;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--pre-bg);
  color: var(--pre-ink);
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 0.55rem 0.8rem;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead {
  margin-left: 280px;
  padding: 44px var(--gutter) 34px;
  border-top: 3px solid var(--report-accent, var(--navy));
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(115deg, var(--hero-start), var(--hero-end) 58%),
    var(--paper);
  color: var(--ink);
}

.eyebrow,
.section-label,
.toc-category {
  color: var(--navy);
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 10px;
}

.masthead.compact {
  padding: 26px var(--gutter) 24px;
}

.masthead.compact h1 {
  font-size: var(--fs-h1-compact);
}

.breadcrumb {
  margin: 0 0 14px;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  max-width: none;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.breadcrumb li + li::before {
  margin-right: 0.55rem;
  color: var(--line-strong);
  content: "/";
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--link-hover);
}

.breadcrumb [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

h1 {
  max-width: var(--wide);
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: var(--track-heading);
  line-height: 1.08;
}

.dek {
  max-width: var(--measure);
  margin: 18px 0 0;
  color: var(--muted);
  font-size: var(--fs-lg);
  line-height: 1.55;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  max-width: var(--wide);
  margin-top: 22px;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.meta-row strong {
  color: var(--ink);
}

.standards-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: var(--wide);
  margin: 18px 0 0;
}

.standards-strip .standards-lede {
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.standards-strip .chip {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: var(--fs-meta);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.standards-strip a.chip:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
  color: var(--ink);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: var(--wide);
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.stat-row li {
  margin: 0;
}

.stat-tile {
  min-width: 150px;
  flex: 1 1 150px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  color: var(--navy);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
}

.stat-label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.chart-card {
  max-width: var(--wide);
  margin: 1.4rem 0 1.7rem;
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chart-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-card figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--fs-meta);
  line-height: 1.5;
}

/* Rendered architecture diagrams sit on an always-dark panel in both themes,
   matching the evidence code blocks; the PNG itself is dark-styled. */
.chart-card.diagram-render {
  overflow-x: auto;
  padding: 14px 14px 12px;
  background: #141c24;
  border-color: #2b3742;
}

.chart-card.diagram-render .diagram-frame {
  position: relative;
  display: block;
  min-width: 720px;
}

.chart-card.diagram-render img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Invisible link targets over diagram regions; the card's trace links point
   here. Positions come from data attributes applied by site.js; the :target
   rule paints the highlight when a trace link lands. */
.diagram-hotspot {
  position: absolute;
  border-radius: 10px;
  pointer-events: none;
  scroll-margin: 120px;
}

.diagram-hotspot:target {
  outline: 3px solid #dca85a;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgb(220 168 90 / 22%), 0 0 26px rgb(220 168 90 / 35%);
  animation: hotspot-pulse 1.6s ease-in-out 2;
}

@keyframes hotspot-pulse {
  0%, 100% {
    box-shadow: 0 0 0 6px rgb(220 168 90 / 22%), 0 0 26px rgb(220 168 90 / 35%);
  }
  50% {
    box-shadow: 0 0 0 10px rgb(220 168 90 / 32%), 0 0 40px rgb(220 168 90 / 50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .diagram-hotspot:target {
    animation: none;
  }
}

.chart-card.diagram-render figcaption {
  min-width: 720px;
  color: #a8b5c1;
}

.chart-card.diagram-render figcaption a {
  color: #82c4ef;
}

.chart-card.diagram-render figcaption a:hover {
  color: #b6dcf4;
}

.diagram-box {
  fill: var(--surface-subtle);
  stroke: var(--navy);
  stroke-width: 1.5;
}

.diagram-box.accent {
  fill: var(--amber-soft);
  stroke: var(--amber);
}

.diagram-box.good {
  fill: var(--green-soft);
  stroke: var(--green);
}

.diagram-container {
  fill: none;
  stroke: var(--line-strong);
  stroke-dasharray: 5 4;
  stroke-width: 1.2;
}

.diagram-arrow {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.diagram-arrow.return {
  stroke-dasharray: 5 4;
}

.diagram-arrowhead {
  fill: var(--muted);
}

.diagram-title {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
}

.diagram-sub {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 10.5px;
}

.diagram-label {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sev-cell-low {
  fill: var(--green-soft);
  stroke: var(--line);
}

.sev-cell-medium {
  fill: var(--gold-soft);
  stroke: var(--line);
}

.sev-cell-high {
  fill: var(--amber-soft);
  stroke: var(--line);
}

.sev-cell-critical {
  fill: var(--red-soft);
  stroke: var(--line);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  max-width: var(--wide);
  margin: 1.4rem 0 0.6rem;
  padding: 0;
  list-style: none;
  counter-reset: phases;
}

.timeline li {
  position: relative;
  margin: 0;
  padding-top: 46px;
  counter-increment: phases;
}

.timeline li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--action-border);
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy);
  content: counter(phases);
  font-family: var(--mono);
  font-size: var(--fs-meta);
  font-weight: 700;
}

.timeline li:not(:last-child)::after {
  position: absolute;
  top: 16px;
  right: -18px;
  left: 40px;
  border-top: 1px solid var(--line-strong);
  content: "";
}

.timeline .timeline-phase {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: var(--fs-body);
  font-weight: 700;
}

.timeline li p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.timeline-caption {
  color: var(--muted);
  font-size: var(--fs-meta);
}

.card-points {
  margin: 0.6rem 0 0.9rem;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: var(--fs-table);
}

.card-points li + li {
  margin-top: 0.3rem;
}

.audience-hint {
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.cta-link {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--navy);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.cta-link:hover {
  background: var(--link-hover);
  color: var(--paper);
}

.layout {
  min-height: 70vh;
  margin-left: 280px;
  padding: 2.6rem var(--gutter) 5rem;
  background: var(--paper);
}

main {
  width: min(100%, var(--wide));
}

/* Single-page print editions carry no sidebar at any width. */
body.full-edition .masthead,
body.full-edition .layout,
body.full-edition .footnotes {
  margin-left: 0;
}

body.full-edition .layout {
  padding-top: 2rem;
}

.full-edition-note {
  max-width: calc(var(--measure) + 36px);
}

.mobile-bar {
  display: none;
}

.theme-btn,
.contents-btn {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  font-size: var(--fs-meta);
  font-weight: 600;
}

.theme-btn:hover,
.contents-btn:hover {
  background: var(--navy-soft);
}

.toc {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  display: flex;
  width: 280px;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.toc-head {
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.toc-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-table);
  font-weight: 600;
  line-height: 1.25;
}

.toc-title a {
  color: inherit;
  text-decoration: none;
}

.toc-title a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.report-switcher {
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.switch-item {
  display: block;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}

.switch-item:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.switch-item.switch-azure {
  border-left-color: var(--navy);
}

.switch-item.switch-application {
  border-left-color: var(--amber);
}

.switch-item.is-current {
  background: var(--navy-soft);
  color: var(--ink);
}

.switch-item.switch-application.is-current {
  background: var(--amber-soft);
}

.toc-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-label);
}

.toc-nav {
  padding: 12px 0 20px;
}

.toc-category {
  margin: 0;
  padding: 8px 16px 5px;
}

.toc-item {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  border-left: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
  transition: background-color 0.1s, color 0.1s, border-color 0.1s;
}

.toc-item::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.toc-item:hover,
.toc-item.is-active {
  border-left-color: var(--navy);
  background: var(--navy-soft);
  color: var(--ink);
}

.toc-item.is-active::before {
  background: var(--navy);
}

.toc-foot {
  display: flex;
  margin-top: auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-label);
}

section {
  scroll-margin-top: 1.75rem;
  margin-bottom: 3.6rem;
}

.section-label {
  margin: 0 0 9px;
}

.main-title {
  margin: 0 0 1rem;
  color: var(--ink);
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: var(--track-heading);
  line-height: 1.2;
}

h3 {
  margin: 1.8rem 0 0.7rem;
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: var(--track-heading);
  line-height: 1.3;
}

p,
ul,
ol {
  max-width: var(--measure);
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.42rem;
}

.lead {
  color: var(--ink);
  font-size: var(--fs-lg);
  line-height: 1.55;
}

.callout {
  max-width: calc(var(--measure) + 36px);
  margin: 1rem 0 1.4rem;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout.method {
  border-left-color: var(--navy);
  background: var(--navy-soft);
}

.callout.caution {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout.assurance {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.callout.limit {
  border-left-color: var(--gold);
  background: var(--gold-soft);
}

.illustrative-boundary h3 {
  margin: 0 0 0.55rem;
}

.illustrative-group {
  margin: 2rem 0 2.6rem;
}

.illustrative-group-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line-strong);
}

.illustrative-kicker,
.fictional-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.illustrative-kicker {
  margin: 0 0 0.25rem;
}

.fictional-label {
  margin: 0 0 0.45rem;
}

.illustrative-group h3 {
  margin: 0;
}

.illustrative-note {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-meta);
  font-weight: 700;
  text-align: right;
}

.illustrative-finding {
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.illustrative-finding.severity-critical {
  border-top-color: var(--red);
}

.illustrative-finding.severity-high {
  border-top-color: var(--amber);
}

.illustrative-finding.severity-medium {
  border-top-color: var(--gold);
}

.illustrative-finding.severity-low {
  border-top-color: var(--green);
}

.illustrative-finding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.4rem;
  padding: 18px 20px 16px;
}

/* Collapsible card bodies: the header row is the always-visible summary.
   The title takes the remaining width so the severity badge and the
   Expand/Collapse control sit right-aligned; the diagram-trace strip is a
   full-width second row inside the summary, so it stays visible collapsed. */
summary.illustrative-finding-head {
  cursor: pointer;
  flex-wrap: wrap;
  justify-content: flex-start;
  list-style: none;
}

summary.illustrative-finding-head > div:first-child {
  flex: 1 1 auto;
  order: 1;
}

summary.illustrative-finding-head > .severity-badge {
  order: 2;
}

summary.illustrative-finding-head::after {
  order: 3;
}

summary.illustrative-finding-head > .diagram-trace {
  order: 4;
  flex: 1 1 100%;
  margin: 14px -20px -16px;
  padding: 9px 20px 10px;
}

summary.illustrative-finding-head::-webkit-details-marker {
  display: none;
}

summary.illustrative-finding-head::after {
  flex: 0 0 auto;
  align-self: center;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--ink);
  content: "Expand \25BE";
  font-size: var(--fs-meta);
  font-weight: 600;
  white-space: nowrap;
}

.finding-body[open] > summary.illustrative-finding-head::after {
  content: "Collapse \25B4";
}

summary.illustrative-finding-head:hover {
  background: var(--surface-subtle);
}

summary.illustrative-finding-head:hover::after {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.illustrative-finding h4 {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: 1.25;
}

.severity-badge {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.severity-badge.critical {
  background: var(--red-soft);
  color: var(--red);
}

.severity-badge.high {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.severity-badge.medium {
  background: var(--gold-soft);
  color: var(--gold);
}

.severity-badge.low {
  background: var(--green-soft);
  color: var(--green);
}

.illustrative-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.illustrative-meta > div {
  min-width: 0;
  padding: 11px 14px 13px;
}

.illustrative-meta > div + div {
  border-left: 1px solid var(--line);
}

.illustrative-meta dt {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.illustrative-meta dd {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.diagram-trace {
  display: block;
  max-width: none;
  margin: 0;
  padding: 9px 18px 10px;
  border-top: 1px solid var(--line);
  background: var(--navy-soft);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 400;
  line-height: 1.5;
}

.diagram-trace strong {
  color: var(--navy);
  font-weight: 700;
}

.illustrative-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.illustrative-details > div {
  padding: 14px 18px 16px;
}

.illustrative-details > div:not(:first-child) {
  border-top: 1px solid var(--line);
}

.illustrative-details > div:nth-child(3),
.illustrative-details > div:nth-child(5) {
  border-left: 1px solid var(--line);
}

.illustrative-summary,
.illustrative-verification {
  grid-column: 1 / -1;
}

.illustrative-details dt {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.illustrative-details dd {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.illustrative-related {
  max-width: none;
  margin: 0;
  padding: 12px 18px 13px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.illustrative-cross-reference {
  padding: 14px 18px 15px;
  border-top: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  background: var(--navy-soft);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.illustrative-cross-reference p {
  margin: 0;
}

.illustrative-cross-reference ul {
  margin: 0.55rem 0 0;
  padding-left: 1.25rem;
}

.illustrative-cross-reference li + li {
  margin-top: 0.3rem;
}

/* Evidence demonstrations unfold in place instead of jumping to the
   evidence section. */
.evidence-inline > summary {
  cursor: pointer;
  color: var(--link);
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.evidence-inline > summary::-webkit-details-marker {
  display: none;
}

.evidence-inline > summary::after {
  margin-left: 6px;
  color: var(--muted);
  content: "\25BE";
}

.evidence-inline[open] > summary::after {
  content: "\25B4";
}

.evidence-inline > summary:hover {
  color: var(--link-hover);
}

.evidence-inline-body {
  padding: 6px 0 4px;
}

.evidence-inline-body p {
  margin: 0.4rem 0 0.6rem;
}

.evidence-inline-body pre {
  margin: 0 0 0.4rem;
}

.evidence-demo-list {
  margin: 1.2rem 0 1.7rem;
  border-top: 1px solid var(--line);
}

.evidence-demo {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
}

.evidence-demo h3 {
  margin: 0 0 0.55rem;
}

.evidence-demo pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 1.35rem 0 1.7rem;
}

.report-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-card.application {
  border-top-color: var(--amber);
}

.report-card .tag {
  align-self: flex-start;
}

.report-card h3 {
  margin-top: 1rem;
}

.report-card p {
  color: var(--muted);
}

.report-card .card-link {
  margin-top: auto;
  font-weight: 700;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
  white-space: nowrap;
}

.tag.amber {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.tag.green {
  background: var(--green-soft);
  color: var(--green);
}

.domain-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 24px;
  padding-left: 1.15rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--fs-table);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.step-list {
  margin: 1.2rem 0 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.step-list li {
  position: relative;
  min-height: 44px;
  margin: 0;
  padding: 0 0 1.1rem 48px;
  counter-increment: steps;
}

.step-list li::before {
  position: absolute;
  top: -1px;
  left: 0;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--action-border);
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy);
  content: counter(steps);
  font-family: var(--mono);
  font-size: var(--fs-meta);
  font-weight: 700;
}

.reference-list {
  padding-left: 1.1rem;
  font-size: var(--fs-table);
}

.toc-item.sub {
  min-height: 30px;
  padding-left: 2.1rem;
  font-size: var(--fs-sm);
}

.toc-item.sub::before {
  width: 5px;
  height: 5px;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 1.35rem 0 1.7rem;
}

.chapter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--report-accent, var(--navy));
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Stretched link: the title anchor covers the whole card, so clicking
   anywhere opens the chapter. */
.chapter-card h3 a::after {
  position: absolute;
  inset: 0;
  content: "";
}

.chapter-card:hover {
  border-color: var(--report-accent, var(--navy));
  background: var(--surface-subtle);
}

.chapter-card:hover h3 a {
  color: var(--link-hover);
  text-decoration: underline;
}

.chapter-card .chapter-kicker {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.chapter-card h3 {
  margin: 0 0 0.45rem;
}

.chapter-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.chapter-card h3 a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.chapter-card p {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: var(--fs-table);
}

.chapter-card .chapter-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.glance-table td:first-child {
  white-space: nowrap;
}

.pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 3rem 0 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.pagination a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.pagination a:hover {
  background: var(--surface-subtle);
  color: var(--link-hover);
}

.pagination .pagination-label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: var(--fs-fieldlabel);
  font-weight: 700;
  letter-spacing: var(--track-field);
  text-transform: uppercase;
}

.pagination .pagination-next {
  text-align: right;
}

.pagination .pagination-title {
  font-size: var(--fs-table);
  font-weight: 600;
}

.footnotes {
  margin-left: 280px;
  padding: 24px var(--gutter) 29px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
  color: var(--muted);
  font-size: var(--fs-meta);
}

.footnotes-inner {
  display: flex;
  width: min(100%, var(--wide));
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.footnotes p {
  margin: 0;
}

.print-only {
  display: none;
}

@media (max-width: 1050px) {
  .masthead,
  .layout,
  .footnotes {
    margin-left: 0;
  }

  .mobile-bar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0 1.2rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-bar-title {
    overflow: hidden;
    color: var(--ink);
    font-size: var(--fs-table);
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bar-title:hover {
    color: var(--link-hover);
  }

  .mobile-bar-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
  }

  .toc {
    position: fixed;
    z-index: 35;
    inset: 48px 0 auto 0;
    display: none;
    width: 100%;
    max-height: calc(100vh - 48px);
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
  }

  body.nav-open .toc {
    display: flex;
  }

  body.nav-open {
    overflow: hidden;
  }

  section {
    scroll-margin-top: 72px;
  }

  .masthead {
    padding: 2.5rem 1.2rem 2.2rem;
  }

  .layout {
    padding: 1.4rem 1.2rem 3rem;
  }

  .footnotes {
    padding-inline: 1.2rem;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.1;
  }

  .dek {
    font-size: 17px;
  }

  .meta-row {
    display: grid;
    gap: 0.35rem;
  }

  .report-grid,
  .domain-list,
  .chapter-grid,
  .pagination,
  .timeline {
    grid-template-columns: 1fr;
  }

  .timeline li {
    padding-top: 0;
    padding-left: 46px;
    min-height: 36px;
  }

  .timeline li:not(:last-child)::after {
    display: none;
  }

  .pagination .pagination-next {
    text-align: left;
  }

  .report-card {
    min-height: 0;
  }

  .illustrative-group-head,
  .illustrative-finding-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }

  .illustrative-note {
    max-width: none;
    text-align: left;
  }

  .illustrative-details {
    grid-template-columns: 1fr;
  }

  .illustrative-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .illustrative-meta > div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .illustrative-meta > div:nth-child(-n + 2) {
    border-top: 0;
  }

  .illustrative-meta > div:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .illustrative-details > div {
    border-left: 0;
  }

  .footnotes-inner {
    display: block;
  }

  .footnotes-inner p + p {
    margin-top: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  :root,
  :root[data-theme="dark"],
  :root:not([data-theme="light"]) {
    color-scheme: light !important;
    --paper: #fff !important;
    --ground: #fff !important;
    --ink: #000 !important;
    --muted: #4f5962 !important;
    --line: #cfd3d6 !important;
    --line-strong: #aab0b5 !important;
    --navy: #173b57 !important;
    --navy-soft: #eaf0f4 !important;
    --amber: #8a4b12 !important;
    --amber-text: #8a4b12 !important;
    --amber-soft: #fbf0e3 !important;
    --red: #842a24 !important;
    --red-soft: #f8e9e7 !important;
    --green: #2d5a43 !important;
    --green-soft: #e9f1ec !important;
    --gold: #5d4b05 !important;
    --gold-soft: #f7f1d2 !important;
    --link: #000 !important;
    --link-hover: #000 !important;
    --code-bg: #eef0f1 !important;
    --code-ink: #000 !important;
    --pre-bg: #f2f3f4 !important;
    --pre-ink: #000 !important;
    --surface: #fff !important;
    --surface-subtle: #f7f9fa !important;
    --surface-muted: #f2f3f3 !important;
    --footer-bg: #f5f5f3 !important;
    --hero-start: #fff !important;
    --hero-end: #fff !important;
    --action-border: #b9cbd7 !important;
    --report-accent: #173b57 !important;
    --shadow: none !important;
  }

  @page {
    size: A4;
    margin: 16mm 14mm 18mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 9.5pt;
  }

  .toc,
  .skip-link,
  .mobile-bar,
  .pagination,
  .screen-only {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .masthead,
  .layout,
  .footnotes {
    width: auto;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .masthead {
    padding-top: 0;
    padding-bottom: 18px;
    border-top: 0;
  }

  .layout {
    padding-top: 22px;
    padding-bottom: 0;
  }

  h1 {
    font-size: 24pt;
  }

  .main-title {
    font-size: 16pt;
  }

  pre {
    border: 1px solid var(--line);
  }

  section {
    margin-bottom: 2rem;
  }

  .report-card,
  .callout,
  .table-wrap,
  .illustrative-group-head,
  .illustrative-finding,
  .evidence-demo,
  .chart-card,
  .stat-row,
  .timeline {
    break-inside: avoid;
    box-shadow: none;
  }

  .illustrative-finding h4 {
    break-after: avoid;
  }

  .illustrative-group-head {
    break-after: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .footnotes {
    margin-top: 24px;
  }
}

/* ===== Portal landing additions (index.html only; body.portal) ===== */

body.portal .masthead,
body.portal .layout,
body.portal .footnotes {
  margin-left: 0;
}

body.portal .masthead {
  padding: 22px var(--gutter) 26px;
}

body.portal h1 {
  font-size: var(--fs-h1-compact);
}

body.portal .dek {
  margin-top: 12px;
}

body.portal .meta-row {
  margin-top: 18px;
}

body.portal .layout {
  padding-top: 2rem;
}

.portal-topbar {
  display: flex;
  max-width: var(--wide);
  align-items: center;
  justify-content: space-between;
  margin: 0 0 20px;
}

.portal-brand {
  color: var(--navy);
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.hero-links {
  margin: 16px 0 0;
  font-size: var(--fs-sm);
}

.hero-links a {
  color: var(--muted);
}

.hero-links a:hover {
  color: var(--link-hover);
}

/* Report doors */

body.portal .report-grid {
  margin-top: 0;
}

.report-card {
  position: relative;
}

.report-card:hover {
  border-color: var(--line-strong);
}

.report-card h2 {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.3;
}

.card-glyph {
  margin-top: 16px;
}

.card-glyph svg {
  display: block;
  width: 42px;
  height: 42px;
  color: var(--navy);
}

.report-card.application .card-glyph svg {
  color: var(--amber);
}

.card-scope {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: var(--fs-meta);
}

.card-meta span + span::before {
  margin: 0 0.5rem;
  color: var(--line-strong);
  content: "\00b7";
}

.card-chapters {
  margin: 12px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.card-chapters li {
  border-bottom: 1px solid var(--line);
}

.card-chapters a {
  position: relative;
  z-index: 1;
  display: block;
  padding: 7px 2px;
  color: var(--link);
  font-size: var(--fs-sm);
  text-decoration: none;
}

.card-chapters a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* The CTA stretches over the whole card; chapter links sit above it. */
.report-card .card-link a::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
}

/* Methodology digest */

.portal-method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 1.4rem 0 0;
}

.portal-method-block h3 {
  margin: 0 0 8px;
}

.portal-method-block .callout {
  margin: 12px 0;
}

.block-link {
  font-size: var(--fs-sm);
  font-weight: 600;
}

/* Bottom door strip */

.door-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

.door {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
}

.door:hover {
  border-color: var(--line-strong);
  color: var(--link-hover);
}

.door-application {
  border-left-color: var(--amber);
}

@media (max-width: 1050px) {
  .portal-topbar {
    display: none;
  }
}

@media (max-width: 720px) {
  .portal-method-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Control-catalogue card (chapter design-position sections) ===== */

.control-card {
  margin: 0 0 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 5px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: 1.25;
}

.severity-badge.control {
  background: var(--navy-soft);
  color: var(--navy);
}

.control-card-body {
  padding: 4px 20px 18px;
}

.control-card-body p {
  max-width: var(--measure);
}

/* ===== Current-chapter sub-list toggle (sidebar) ===== */

.toc-item.sub.is-collapsed {
  display: none;
}

.toc-item[aria-expanded] {
  cursor: pointer;
}

.toc-item[aria-expanded]::after {
  content: " \25BE";
  color: var(--muted);
}

.toc-item[aria-expanded="false"]::after {
  content: " \25B8";
}

/* ===== Interactive diagram hotspots (hover + click-through) ===== */

.diagram-hotspot.hotspot-linked {
  cursor: pointer;
  pointer-events: auto;
}

.diagram-hotspot.hotspot-linked:hover,
.diagram-hotspot.hotspot-linked:focus-visible {
  outline: 3px solid #dca85a;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgb(220 168 90 / 22%), 0 0 26px rgb(220 168 90 / 35%);
}

/* The popover lives inside the always-dark diagram frame, so it uses the
   frame's fixed dark palette in both themes. */
.hotspot-popover {
  position: absolute;
  z-index: 6;
  width: 340px;
  padding: 12px 14px;
  border: 1px solid #3d4c5c;
  border-radius: 8px;
  background: #18212a;
  box-shadow: 0 10px 28px rgb(0 0 0 / 55%);
}

.hotspot-popover-title {
  margin: 0 0 8px;
  color: #e8edf2;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.hotspot-popover ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hotspot-popover li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 6px 0;
}

.hotspot-popover a {
  color: #8fc1e9;
  font-size: var(--fs-sm);
}

.hotspot-popover a:hover {
  color: #b7d8f2;
}

/* ===== Hotspot discoverability ===== */

/* Plain-text invitation above each interactive diagram; the regions
   themselves stay unmarked until hover/focus (operator call: outlines
   made the diagrams look messy). */
.diagram-hint {
  margin: 0 0 10px;
  color: #a8b5c1;
  font-size: var(--fs-sm);
}
