/* ============================================================
   THE 2026 INFOSEC PLAYBOOK
   Type:  Archivo (display) / Source Serif 4 (body) / IBM Plex Mono (data)
   Ground: cool paper, blue-biased neutrals, one institutional accent.
   Categorical colour = the real NIST CSF 2.0 function palette.
   Semantic colour = incident severity. Kept separate from the accent.
   ============================================================ */

:root {
  /* --- neutrals: cool, biased toward the accent hue --- */
  --paper:      #EEF1F5;
  --surface:    #FFFFFF;
  --surface-2:  #E4E9F0;
  --surface-3:  #D8DFE9;
  --ink:        #0D1218;
  --ink-2:      #47535F;
  --ink-3:      #75828F;
  --rule:       #CFD7E1;
  --rule-soft:  #E1E7EE;

  /* --- accent: institutional signal blue --- */
  --accent:     #17537F;
  --accent-2:   #0E3C5F;
  --accent-ink: #FFFFFF;
  --accent-wash:#E2EDF5;

  /* --- semantic: incident severity (NOT the accent) --- */
  --sev1: #A5231B;
  --sev2: #B4530C;
  --sev3: #97700A;
  --sev4: #2C6E45;
  --sev1-wash: #FBE7E5;
  --sev2-wash: #FBEDE2;
  --sev3-wash: #FAF3DF;
  --sev4-wash: #E4F1E9;

  /* --- categorical: NIST CSF 2.0 functions --- */
  --csf-govern:   #5D6874;
  --csf-identify: #2A6BAE;
  --csf-protect:  #6A4A9C;
  --csf-detect:   #B4870F;
  --csf-respond:  #A5231B;
  --csf-recover:  #2C6E45;

  /* --- implementation-group tiers --- */
  --ig1: #2C6E45;
  --ig2: #97700A;
  --ig3: #6A4A9C;

  /* --- type --- */
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* --- metrics --- */
  --measure: 40rem;
  --rail: 19rem;
  --gutter: clamp(1.1rem, 3.5vw, 3rem);
  --radius: 3px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0A0E13;
    --surface:    #121922;
    --surface-2:  #1A222D;
    --surface-3:  #232D3A;
    --ink:        #E3EAF3;
    --ink-2:      #A2AFBE;
    --ink-3:      #74828F;
    --rule:       #26313F;
    --rule-soft:  #1C2530;

    --accent:     #7DB4E0;
    --accent-2:   #A5CDEC;
    --accent-ink: #08131D;
    --accent-wash:#152634;

    --sev1: #F0837A;  --sev1-wash: #2C1613;
    --sev2: #EDA063;  --sev2-wash: #2B1D10;
    --sev3: #E0BE55;  --sev3-wash: #29220E;
    --sev4: #74C295;  --sev4-wash: #12251A;

    --csf-govern:   #97A3B0;
    --csf-identify: #74AEE6;
    --csf-protect:  #AE92DE;
    --csf-detect:   #DEBB57;
    --csf-respond:  #F0837A;
    --csf-recover:  #74C295;

    --ig1: #74C295; --ig2: #E0BE55; --ig3: #AE92DE;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:      #0A0E13;
  --surface:    #121922;
  --surface-2:  #1A222D;
  --surface-3:  #232D3A;
  --ink:        #E3EAF3;
  --ink-2:      #A2AFBE;
  --ink-3:      #74828F;
  --rule:       #26313F;
  --rule-soft:  #1C2530;

  --accent:     #7DB4E0;
  --accent-2:   #A5CDEC;
  --accent-ink: #08131D;
  --accent-wash:#152634;

  --sev1: #F0837A;  --sev1-wash: #2C1613;
  --sev2: #EDA063;  --sev2-wash: #2B1D10;
  --sev3: #E0BE55;  --sev3-wash: #29220E;
  --sev4: #74C295;  --sev4-wash: #12251A;

  --csf-govern:   #97A3B0;
  --csf-identify: #74AEE6;
  --csf-protect:  #AE92DE;
  --csf-detect:   #DEBB57;
  --csf-respond:  #F0837A;
  --csf-recover:  #74C295;

  --ig1: #74C295; --ig2: #E0BE55; --ig3: #AE92DE;

  color-scheme: dark;
}

/* ============================================================ base */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.68;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: .18em; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ============================================================ shell */

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  grid-column: 1;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.rail__head { padding: 1.15rem 1.15rem .8rem; border-bottom: 1px solid var(--rule-soft); }

.rail__mark {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); display: block; margin-bottom: .45rem;
}
.rail__title {
  font-family: var(--display); font-weight: 700; font-size: 1.02rem; line-height: 1.2;
  letter-spacing: -.017em; margin: 0; color: var(--ink);
}
.rail__title span { display: block; color: var(--accent); }
.rail__byline {
  font-family: var(--mono); font-size: .625rem; color: var(--ink-3);
  margin: .5rem 0 0; letter-spacing: .04em;
}

.rail__search { padding: .7rem 1.15rem; border-bottom: 1px solid var(--rule-soft); }
.rail__search input {
  width: 100%; padding: .45rem .6rem; font-family: var(--mono); font-size: .74rem;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.rail__search input::placeholder { color: var(--ink-3); }

.rail__nav { overflow-y: auto; overscroll-behavior: contain; padding: .5rem 0 2rem; flex: 1; }

.nav-part {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-3); padding: 1.1rem 1.15rem .35rem; display: block;
}
.nav-part:first-child { padding-top: .5rem; }

.nav-link {
  display: grid; grid-template-columns: 1.9rem 1fr; align-items: baseline;
  gap: .1rem; padding: .3rem 1.15rem; text-decoration: none; color: var(--ink-2);
  font-family: var(--display); font-size: .805rem; line-height: 1.32; font-weight: 500;
  border-left: 2px solid transparent;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-wash); font-weight: 600; }
.nav-link__n { font-family: var(--mono); font-size: .66rem; color: var(--ink-3); font-weight: 400; }
.nav-link.is-active .nav-link__n { color: var(--accent); }

.rail__foot {
  border-top: 1px solid var(--rule-soft); padding: .6rem 1.15rem;
  display: flex; gap: .4rem; align-items: center;
}
.chip {
  font-family: var(--mono); font-size: .625rem; letter-spacing: .05em;
  padding: .3rem .5rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink-2); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================ main */

.main { grid-column: 2; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .8rem;
  padding: .55rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar__crumb {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .06em;
  color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__crumb b { color: var(--ink-2); font-weight: 500; }
.topbar__spacer { flex: 1; }
.menu-btn { display: none; }

.progress { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); width: 0; }

.doc { padding: 0 var(--gutter) 8rem; }

/* ============================================================ hero */

.hero { padding: clamp(3rem, 9vw, 7rem) 0 3rem; border-bottom: 1px solid var(--rule); margin-bottom: 3rem; }
.hero__inner { max-width: 54rem; }
.hero__eyebrow {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .19em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1.4rem;
}
.hero h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.7rem, 7.6vw, 5.4rem); line-height: .96; letter-spacing: -.035em;
  margin: 0 0 1.1rem; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__sub {
  font-size: clamp(1.05rem, 2vw, 1.32rem); line-height: 1.5; color: var(--ink-2);
  max-width: 34rem; margin: 0 0 2.2rem;
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 0 2.2rem;
  border-top: 1px solid var(--rule); padding-top: 1.1rem;
}
.hero__meta div { padding: .4rem 0; }
.hero__meta dt {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .18rem;
}
.hero__meta dd { font-family: var(--display); font-weight: 600; font-size: .92rem; margin: 0; color: var(--ink); }

/* ============================================================ reading column */

.anchor-alias { display: block; height: 0; overflow: hidden; scroll-margin-top: 4.5rem; }
.chapter { max-width: var(--measure); margin: 0 auto; padding: 4.5rem 0 2rem; scroll-margin-top: 4.5rem; }
.chapter + .chapter { border-top: 1px solid var(--rule); }

.chapter > .code,
.chapter > .tbl-wrap,
.chapter > .callout,
.chapter > figure,
.chapter > .breakout { max-width: none; }

/* Wide elements break the measure on large screens */
@media (min-width: 68rem) {
  .chapter > .tbl-wrap, .chapter > .code, .chapter > figure { width: min(58rem, 92vw); margin-left: 50%; transform: translateX(-50%); }
}

h1, h2, h3, h4, h5, h6 { font-family: var(--display); letter-spacing: -.02em; text-wrap: balance; color: var(--ink); }

.h1 {
  font-size: clamp(1.9rem, 4.1vw, 2.85rem); font-weight: 800; line-height: 1.05;
  margin: 0 0 1.1rem; letter-spacing: -.035em;
}
.h2 {
  font-size: 1.44rem; font-weight: 700; line-height: 1.22;
  margin: 3.1rem 0 .9rem; padding-top: 1.1rem; border-top: 1px solid var(--rule-soft);
}
.h3 { font-size: 1.11rem; font-weight: 700; margin: 2.1rem 0 .6rem; }
.h4 { font-size: .93rem; font-weight: 700; margin: 1.6rem 0 .5rem; color: var(--ink-2);
      font-family: var(--mono); letter-spacing: .02em; }
.h5, .h6 { font-size: .86rem; font-weight: 600; margin: 1.3rem 0 .45rem; color: var(--ink-2); }

.anchor {
  float: left; margin-left: -1.15rem; width: 1.15rem;
  color: var(--ink-3); text-decoration: none; opacity: 0;
  font-family: var(--mono); font-weight: 400; font-size: .8em;
}
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; }
@media (max-width: 60rem) { .anchor { display: none; } }

p { margin: 0 0 1.05rem; }

.dek {
  font-family: var(--display); font-weight: 500;
  font-size: 1.16rem; line-height: 1.42; color: var(--ink-2);
  border-left: 3px solid var(--accent); padding: .1rem 0 .1rem 1rem;
  margin: 0 0 1.6rem;
}

.chapter-meta {
  font-family: var(--mono); font-size: .68rem; line-height: 1.7; color: var(--ink-3);
  border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  padding: .6rem 0; margin: 0 0 2rem;
}
.chapter-meta strong { color: var(--ink-2); font-weight: 500; }

ul, ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
li { margin-bottom: .38rem; }
li > ul, li > ol { margin-top: .38rem; margin-bottom: .2rem; }
ul { list-style: none; padding-left: 1.1rem; }
ul > li { position: relative; }
ul > li::before {
  content: ""; position: absolute; left: -.95rem; top: .66em;
  width: 4px; height: 4px; background: var(--ink-3); border-radius: 50%;
}
ol { list-style: none; counter-reset: ol; padding-left: 1.6rem; }
ol > li { counter-increment: ol; position: relative; }
ol > li::before {
  content: counter(ol) "."; position: absolute; left: -1.6rem; top: .04em;
  font-family: var(--mono); font-size: .78em; color: var(--accent); font-weight: 500;
}

strong { font-weight: 700; color: var(--ink); }
em { font-style: italic; }

code {
  font-family: var(--mono); font-size: .845em;
  background: var(--surface-2); color: var(--ink);
  padding: .1em .32em; border-radius: 2px;
  border: 1px solid var(--rule-soft);
  word-break: break-word;
}

hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

blockquote.pull {
  margin: 1.6rem 0; padding: .2rem 0 .2rem 1.15rem;
  border-left: 2px solid var(--rule); color: var(--ink-2); font-style: italic;
}
blockquote.pull p:last-child { margin-bottom: 0; }

/* ============================================================ code blocks */

.code {
  position: relative; margin: 1.5rem 0;
  background: var(--surface-2); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.code-lang {
  display: block; font-family: var(--mono); font-size: .6rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  padding: .45rem .8rem .1rem;
}
.code pre { margin: 0; padding: .5rem .8rem .9rem; overflow-x: auto; }
.code:not(:has(.code-lang)) pre { padding-top: .9rem; }
.code code {
  background: none; border: 0; padding: 0;
  font-size: .795rem; line-height: 1.62; color: var(--ink);
  white-space: pre; word-break: normal;
}
.copy {
  position: absolute; top: .32rem; right: .32rem;
  font-family: var(--mono); font-size: .6rem; letter-spacing: .06em;
  padding: .22rem .45rem; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink-3);
  border-radius: 2px; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy.is-done { color: var(--ig1); border-color: var(--ig1); opacity: 1; }

/* ============================================================ tables */

.tbl-wrap { margin: 1.6rem 0; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-family: var(--display); font-size: .81rem; line-height: 1.48; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: .6rem .75rem; border-bottom: 1px solid var(--rule);
  background: var(--surface-2); white-space: nowrap; font-family: var(--mono);
}
table.tbl td { padding: .58rem .75rem; border-bottom: 1px solid var(--rule-soft); vertical-align: top; color: var(--ink-2); }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td strong { color: var(--ink); }
table.tbl code { font-size: .8em; }

table.tbl--steps td:first-child {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  color: var(--accent); font-weight: 500; width: 2.4rem; text-align: right;
}

/* ============================================================ callouts */

.callout {
  margin: 1.7rem 0; padding: .95rem 1.1rem;
  border: 1px solid var(--rule); border-left: 3px solid var(--ink-3);
  border-radius: var(--radius); background: var(--surface);
}
.callout__label {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .3rem;
}
.callout__title {
  font-family: var(--display); font-weight: 700; font-size: .97rem; line-height: 1.32;
  margin: 0 0 .5rem; color: var(--ink);
}
.callout__body { font-size: .95rem; }
.callout__body > :last-child { margin-bottom: 0; }
.callout__body p { margin-bottom: .6rem; }

.callout--decision  { border-left-color: var(--accent);  background: var(--accent-wash); }
.callout--decision  .callout__label { color: var(--accent); }
.callout--warning   { border-left-color: var(--sev2); background: var(--sev2-wash); }
.callout--warning   .callout__label { color: var(--sev2); }
.callout--anti      { border-left-color: var(--sev1); background: var(--sev1-wash); }
.callout--anti      .callout__label { color: var(--sev1); }
.callout--clock     { border-left-color: var(--sev3); background: var(--sev3-wash); }
.callout--clock     .callout__label { color: var(--sev3); }
.callout--authority { border-left-color: var(--csf-protect); background: var(--surface-2); }
.callout--msa { border-left-color: var(--csf-govern); background: var(--surface-2); }

.callout--creed { border-left-color: var(--accent); background: var(--accent-wash); }

.callout--authority .callout__label { color: var(--csf-protect); }
.callout--board     { border-left-color: var(--csf-govern); background: var(--surface-2); }
.callout--board     .callout__label { color: var(--csf-govern); }
.callout--verify    { border-left-color: var(--ink-3); background: var(--surface-2); border-style: dashed; }
.callout--note      { border-left-color: var(--csf-identify); background: var(--surface-2); }
.callout--note      .callout__label { color: var(--csf-identify); }

/* ============================================================ checklist */

ul.tasklist { padding-left: 0; margin: 1.4rem 0; display: flex; flex-direction: column; gap: 0; }
ul.tasklist > li::before { display: none; }

li.ck {
  display: grid; grid-template-columns: 1.5rem 1fr; gap: .1rem;
  padding: .62rem .7rem .62rem .55rem; margin: 0;
  border: 1px solid var(--rule-soft); border-bottom: 0; background: var(--surface);
  align-items: start;
}
li.ck:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
li.ck:last-child { border-bottom: 1px solid var(--rule-soft); border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
li.ck:hover { background: var(--surface-2); }

.ck-box {
  width: .92rem; height: .92rem; margin-top: .22rem;
  border: 1.5px solid var(--ink-3); border-radius: 2px; display: block;
}
li.ck[data-state="done"] .ck-box { background: var(--ig1); border-color: var(--ig1); }
li.ck[data-state="progress"] .ck-box { background: linear-gradient(135deg, var(--ig2) 50%, transparent 50%); border-color: var(--ig2); }
li.ck[data-state="na"] .ck-box { border-color: var(--rule); background: var(--surface-3); }
li.ck[data-state="done"] .ck-text { color: var(--ink-3); }

.ck-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem; }
.ck-code {
  font-family: var(--mono); font-size: .64rem; font-weight: 500; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-wash);
  padding: .12rem .34rem; border-radius: 2px; white-space: nowrap;
}
.ck-text { font-size: .93rem; line-height: 1.5; flex: 1 1 16rem; min-width: 0; }
.ck-meta { display: flex; gap: .3rem; flex-wrap: wrap; }
.ck-tier, .ck-tag {
  font-family: var(--mono); font-size: .575rem; letter-spacing: .07em;
  padding: .1rem .3rem; border-radius: 2px; border: 1px solid var(--rule); color: var(--ink-3);
  white-space: nowrap;
}
.ck-tier--ig1 { color: var(--ig1); border-color: color-mix(in srgb, var(--ig1) 40%, transparent); }
.ck-tier--ig2 { color: var(--ig2); border-color: color-mix(in srgb, var(--ig2) 40%, transparent); }
.ck-tier--ig3 { color: var(--ig3); border-color: color-mix(in srgb, var(--ig3) 40%, transparent); }

/* ============================================================ figures */

figure { margin: 2rem 0; }
figure svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
figcaption {
  font-family: var(--mono); font-size: .68rem; line-height: 1.55; color: var(--ink-3);
  margin-top: .7rem; text-align: center; max-width: 34rem; margin-inline: auto;
}

/* ============================================================ mindmap */

.mm { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.mm__bar {
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
  padding: .6rem .8rem; border-bottom: 1px solid var(--rule); background: var(--surface-2);
}
.mm__bar input[type="search"] {
  flex: 1 1 12rem; min-width: 0; padding: .35rem .55rem;
  font-family: var(--mono); font-size: .72rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.mm__count { font-family: var(--mono); font-size: .64rem; color: var(--ink-3); }

.mm__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1px; background: var(--rule-soft);
}
.mm-branch { background: var(--surface); padding: .85rem .9rem 1rem; }
.mm-branch.is-hidden { display: none; }
.mm-branch__h {
  display: flex; align-items: center; gap: .45rem; width: 100%;
  background: none; border: 0; padding: 0 0 .5rem; cursor: pointer; text-align: left;
  font-family: var(--display); font-weight: 700; font-size: .93rem; color: var(--ink);
  border-bottom: 2px solid var(--bc, var(--rule)); margin-bottom: .55rem;
}
.mm-branch__dot { width: 8px; height: 8px; border-radius: 2px; background: var(--bc, var(--ink-3)); flex: none; }
.mm-branch__n { margin-left: auto; font-family: var(--mono); font-size: .6rem; color: var(--ink-3); font-weight: 400; }

.mm-tree { list-style: none; padding: 0; margin: 0; font-family: var(--display); font-size: .78rem; line-height: 1.42; }
.mm-tree ul { list-style: none; padding: 0 0 0 .78rem; margin: .18rem 0 .28rem; border-left: 1px solid var(--rule-soft); }
.mm-tree li { margin: 0; padding: .1rem 0; }
.mm-tree li::before { display: none; }
.mm-node { display: inline-flex; align-items: baseline; gap: .3rem; color: var(--ink-2); }
.mm-node--parent { cursor: pointer; color: var(--ink); font-weight: 600; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; text-align: left; }
.mm-node--parent::before { content: "▾"; font-size: .58rem; color: var(--bc, var(--ink-3)); width: .6rem; flex: none; }
.mm-tree li.is-collapsed > .mm-node--parent::before { content: "▸"; }
.mm-tree li.is-collapsed > ul { display: none; }
.mm-hit { background: color-mix(in srgb, var(--csf-detect) 30%, transparent); border-radius: 2px; padding: 0 .12rem; }
.mm-tree li.is-filtered { display: none; }

.mm__focus { padding: 1rem; border-top: 1px solid var(--rule); background: var(--surface-2); }
.mm__focus h4 { margin: 0 0 .5rem; font-family: var(--mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.mm__focus ol { margin: 0; padding-left: 1.4rem; font-size: .86rem; }
.mm__focus li { color: var(--ink-2); }

.csf-legend { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0 0; }
.csf-legend span {
  font-family: var(--mono); font-size: .58rem; letter-spacing: .09em;
  padding: .16rem .38rem; border-radius: 2px; border: 1px solid currentColor;
}

/* ============================================================ readiness tracker */

.trk { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); overflow: hidden; margin: 2rem 0; }
.trk__head { padding: .9rem 1rem; border-bottom: 1px solid var(--rule); background: var(--surface-2); display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.trk__head h3 { margin: 0; font-size: .98rem; }
.trk__status { font-family: var(--mono); font-size: .62rem; color: var(--ink-3); margin-left: auto; }
.trk__score { display: flex; gap: 1.4rem; flex-wrap: wrap; padding: .9rem 1rem; border-bottom: 1px solid var(--rule-soft); }
.trk__score div { }
.trk__score dt { font-family: var(--mono); font-size: .58rem; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); }
.trk__score dd { margin: .1rem 0 0; font-family: var(--display); font-weight: 800; font-size: 1.5rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.trk__bars { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.trk-bar { display: grid; grid-template-columns: 5.5rem 1fr 2.6rem; gap: .6rem; align-items: center; font-family: var(--mono); font-size: .64rem; color: var(--ink-2); }
.trk-bar__track { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; display: flex; }
.trk-bar__fill { height: 100%; }
.trk-bar__fill--done { background: var(--ig1); }
.trk-bar__fill--prog { background: var(--ig2); }
.trk-bar__pct { text-align: right; font-variant-numeric: tabular-nums; }

.ck-controls { display: flex; gap: .2rem; margin-left: auto; flex: none; }
.ck-btn {
  font-family: var(--mono); font-size: .56rem; letter-spacing: .05em;
  padding: .16rem .34rem; border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-3); border-radius: 2px; cursor: pointer;
}
.ck-btn:hover { border-color: var(--accent); color: var(--accent); }
.ck-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ============================================================ misc */

.backtop {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 40;
  font-family: var(--mono); font-size: .62rem; letter-spacing: .06em;
  padding: .45rem .6rem; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.backtop.is-on { opacity: 1; pointer-events: auto; }
.backtop:hover { border-color: var(--accent); color: var(--accent); }

.search-results { max-width: var(--measure); margin: 0 auto; padding: 2rem 0; }
.search-results ol { padding-left: 0; }
.search-results li { counter-increment: none; }
.search-results li::before { display: none; }
.sr-item { display: block; padding: .7rem .8rem; border: 1px solid var(--rule-soft); border-radius: var(--radius); margin-bottom: .4rem; text-decoration: none; background: var(--surface); }
.sr-item:hover { border-color: var(--accent); }
.sr-item b { display: block; font-family: var(--display); font-size: .9rem; color: var(--ink); margin-bottom: .2rem; }
.sr-item span { font-size: .8rem; color: var(--ink-3); font-family: var(--mono); }

/* ============================================================ responsive */

@media (max-width: 62rem) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: min(20rem, 86vw); z-index: 60;
    transform: translateX(-101%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.22);
  }
  .rail.is-open { transform: none; }
  .main { grid-column: 1; }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.is-on { opacity: 1; pointer-events: auto; }
  @media (min-width: 68rem) { .chapter > .tbl-wrap { width: auto; margin-left: 0; transform: none; } }
}

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  li.ck { grid-template-columns: 1.3rem 1fr; }
  .trk__score { gap: 1rem; }
  table.tbl { font-size: .76rem; }
}

/* ============================================================ print */

@media print {
  :root { --paper: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --rule: #bbb; --rule-soft: #ddd; }
  .rail, .topbar, .backtop, .copy, .mm__bar, .ck-controls, .scrim { display: none !important; }
  .shell { display: block; }
  .doc { padding: 0; }
  .chapter { max-width: none; padding: 0 0 1.5rem; page-break-after: always; }
  .h2, .h3 { page-break-after: avoid; }
  .tbl-wrap, .callout, .code, figure, li.ck { page-break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .code { background: #f6f6f6; }
}

/* step markings — normalised from the playbook authors' variants */
td code, th code { white-space: nowrap; }
.mark-e, .mark-t {
  display: inline-block; font-family: var(--mono); font-size: .58rem;
  letter-spacing: .07em; padding: .08rem .3rem; border-radius: 2px;
  white-space: nowrap; border: 1px solid currentColor; background: none;
}
.mark-e { color: var(--sev1); }
.mark-t { color: var(--csf-detect); }

/* ============================================================ pagination
   280,000 words in one DOM makes a 1.4-million-pixel document that browsers
   stop painting at depth. One chapter is shown at a time; print shows all. */
.chapter { display: none; }
.chapter.is-current { display: block; }
.chapter + .chapter { border-top: 0; }
.hero { display: none; }
.hero.is-current { display: block; }

.chapnav {
  display: grid; grid-template-columns: 1fr 1fr; gap: .6rem;
  max-width: var(--measure); margin: 3.5rem auto 0;
  padding-top: 1.4rem; border-top: 1px solid var(--rule);
}
.chapnav a {
  display: block; padding: .7rem .85rem; text-decoration: none;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
}
.chapnav a:hover { border-color: var(--accent); }
.chapnav a:last-child { text-align: right; }
.chapnav a:only-child { grid-column: 2; }
.chapnav span {
  display: block; font-family: var(--mono); font-size: .58rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .2rem;
}
.chapnav b {
  font-family: var(--display); font-weight: 600; font-size: .88rem;
  color: var(--ink); line-height: 1.3;
}
@media (max-width: 40rem) { .chapnav { grid-template-columns: 1fr; } .chapnav a:last-child { text-align: left; } }

@media print {
  .chapter, .hero { display: block !important; }
  .chapnav { display: none !important; }
  .chapter + .chapter { border-top: 0; }
}

/* ============================================================ coverage model
   The book's own scope-and-accountability model. Six CSF 2.0 Functions as the
   spine; every domain wired to real control codes and filled from live status. */
.cm {
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; margin: 2rem 0;
}
.cm__head {
  display: flex; align-items: flex-start; gap: 1.2rem; flex-wrap: wrap;
  padding: 1.1rem 1.1rem .95rem; border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.cm__eyebrow {
  font-family: var(--mono); font-size: .58rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 .4rem;
}
.cm__title {
  font-family: var(--display); font-weight: 800; font-size: 1.5rem;
  letter-spacing: -.026em; margin: 0; line-height: 1.1; color: var(--ink);
}
.cm__sub { font-size: .93rem; color: var(--ink-2); margin: .25rem 0 0; }
.cm__counts {
  margin: 0 0 0 auto; font-family: var(--mono); font-size: .62rem;
  line-height: 1.7; color: var(--ink-3); text-align: right; white-space: nowrap;
}
.cm__note {
  margin: 0; padding: .95rem 1.1rem; border-top: 1px solid var(--rule);
  background: var(--surface-2); font-size: .84rem; color: var(--ink-2);
}

.cm-wheel { margin: 0; padding: 1.1rem 1.1rem .3rem; border-bottom: 1px solid var(--rule-soft); }
.cm-wheel svg { width: 100%; max-width: 40rem; height: auto; display: block; margin: 0 auto; }
.cm-gauge__fill { transition: stroke-dasharray .5s ease; }
@media (prefers-reduced-motion: reduce) { .cm-gauge__fill { transition: none; } }
.cm-wheel figcaption { margin-top: .5rem; }

.cm-fn { border-top: 1px solid var(--rule); }
.cm-fn__h {
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
  padding: .75rem 1.1rem; border-left: 3px solid var(--fc);
  background: var(--surface-2);
}
.cm-fn__id {
  font-family: var(--mono); font-size: .74rem; font-weight: 500;
  letter-spacing: .17em; color: var(--fc); margin: 0;
}
.cm-fn__tag { margin: 0; font-size: .84rem; color: var(--ink-2); flex: 1 1 12rem; }
.cm-fn__pct {
  font-family: var(--display); font-weight: 800; font-size: 1.02rem;
  font-variant-numeric: tabular-nums; color: var(--ink); margin-left: auto;
}

.cm-doms {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1px; background: var(--rule-soft);
}
.cm-dom { background: var(--surface); padding: .8rem .9rem .95rem; }
.cm-dom__h {
  display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap;
  font-family: var(--display); font-weight: 700; font-size: .88rem;
  margin: 0 0 .45rem; color: var(--ink); letter-spacing: -.006em;
}
.cm-dom__ch {
  font-family: var(--mono); font-size: .57rem; letter-spacing: .06em;
  color: var(--ink-3); text-decoration: none; margin-left: auto;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.cm-dom__ch:hover { color: var(--accent); border-color: var(--accent); }
.cm-dom__bar { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.cm-dom__fill { display: block; height: 100%; width: 0; background: var(--fc); transition: width .5s ease; }
@media (prefers-reduced-motion: reduce) { .cm-dom__fill { transition: none; } }
.cm-dom__stat {
  display: flex; justify-content: space-between; gap: .5rem;
  font-family: var(--mono); font-size: .58rem; color: var(--ink-3);
  margin: .3rem 0 .55rem; font-variant-numeric: tabular-nums;
}
.cm-dom__pct { color: var(--ink-2); font-weight: 500; }
.cm-caps { list-style: none; padding: 0; margin: 0; }
.cm-caps li {
  position: relative; padding-left: .78rem; margin-bottom: .22rem;
  font-family: var(--display); font-size: .765rem; line-height: 1.4; color: var(--ink-2);
}
.cm-caps li::before {
  content: ""; position: absolute; left: 0; top: .52em;
  width: 3px; height: 3px; border-radius: 50%; background: var(--fc); opacity: .75;
}

@media print {
  .cm-wheel { break-inside: avoid; }
  .cm-fn { break-inside: avoid; }
}


/* ------------------------------------------------------------------ *
 * Standalone chapter-page overrides.
 * The reader paginates by hiding every .chapter and letting JS reveal one.
 * These pages carry no JS, so that rule must be neutralised or the page is
 * blank. Belt and braces: the section is also emitted with .is-current.
 * ------------------------------------------------------------------ */
.chapter { display: block !important; padding-top: 2.25rem; }
.chapter + .chapter { border-top: 0; }
body { display: block; }
.cp-wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.5rem 4rem; }
.cp-top { position: sticky; top: 0; z-index: 20; display: flex; gap: 1rem;
  align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: .7rem 0; margin-bottom: .5rem;
  border-bottom: 1px solid var(--rule); background: var(--bg);
  backdrop-filter: blur(10px); }
.cp-brand { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none; }
.cp-brand b { color: var(--accent); font-weight: 500; }
.cp-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.cp-chip { font-family: var(--mono); font-size: .66rem; letter-spacing: .08em;
  text-transform: uppercase; text-decoration: none; color: var(--ink-2);
  border: 1px solid var(--rule); border-radius: 6px; padding: .4rem .7rem; }
.cp-chip:hover { border-color: var(--accent); color: var(--ink); }
.cp-nav { display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap;
  border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 1.5rem; }
.cp-nav a { text-decoration: none; max-width: 22rem; }
.cp-nav span { display: block; font-family: var(--mono); font-size: .62rem;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: .25rem; }
.cp-nav b { font-weight: 600; color: var(--ink); }
.cp-nav a:hover b { color: var(--accent); }
.cp-note { margin-top: 2rem; padding: 1rem 1.15rem; border-left: 2px solid var(--accent);
  background: var(--surface-2); font-size: .9rem; color: var(--ink-2); }
.cp-note a { color: var(--accent); }
@media print { .cp-top, .cp-nav, .cp-note { display: none; } }


/* playbook index on the chapter-14 hub */
.pb-index { display: grid; gap: .55rem; margin-top: 1.25rem; }
.pb-card { display: block; text-decoration: none; border: 1px solid var(--rule);
  border-radius: 10px; padding: .95rem 1.15rem; transition: border-color .18s, background .18s; }
.pb-card:hover { border-color: var(--accent); background: var(--surface-2); }
.pb-card .pb-n { font-family: var(--mono); font-size: .68rem; color: var(--accent);
  letter-spacing: .08em; }
.pb-card .pb-t { display: block; font-weight: 600; color: var(--ink); margin: .2rem 0 .3rem; }
.pb-card .pb-d { display: block; font-size: .86rem; color: var(--ink-3); line-height: 1.5; }
