/* site.css - the Marvin docs site, Emprove dark theme (AOS-302). Dark only: there is no light theme and no toggle.
   Emprove's colours are the only colours outside the diagram palette below: laser green, abyss black, white and
   their alpha mixes, plus the surfaces, the two text tones and the alert red (errors only). Green is the signal: the
   active nav item, the primary CTA, one key word per view block, focus rings and the laser divider. It is never a
   surface. Flat at rest; on hover and focus a border brightens and a card lifts on a neutral shadow, never a coloured glow. Every font is self-hosted (fonts/README.md). */

/* ---------------------------------------------------------------- fonts (self-hosted, Latin subsets, SIL OFL 1.1) */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/montserrat-latin-variable.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-latin-400.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-latin-500.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: dark;
  --em-black: #00090C;
  --em-surface-1: #0B0D14;
  --em-surface-2: #10131C;
  --em-surface-3: #161A26;
  --em-green: #00FF57;
  --em-text: #F4F6FF;
  --em-text-2: #A7ACBF;
  --em-red: #FF3355;
  /* white alpha ramp; .48 is the floor for text (nothing dimmer may carry words) */
  --em-white-88: rgba(255, 255, 255, .88);
  --em-white-72: rgba(255, 255, 255, .72);
  --em-white-48: rgba(255, 255, 255, .48);
  --em-white-24: rgba(255, 255, 255, .24);
  --em-white-12: rgba(255, 255, 255, .12);
  --em-white-06: rgba(255, 255, 255, .06);
  /* green alpha mixes: hairlines at .10 rising to .40 on hover; never a filled surface */
  --em-green-06: rgba(0, 255, 87, .06);
  --em-green-10: rgba(0, 255, 87, .10);
  --em-green-20: rgba(0, 255, 87, .20);
  --em-green-40: rgba(0, 255, 87, .40);
  --em-line: var(--em-green-10);
  --em-line-hover: var(--em-green-40);
  /* neutral elevation for a lifted card or shot: an offset, soft, colourless shadow (no coloured glow) */
  --em-lift: 0 12px 28px -14px rgba(0, 0, 0, .8);
  --em-ring: 0 0 0 2px var(--em-black), 0 0 0 4px var(--em-green);
  --em-radius: 8px;
  --em-radius-card: 12px;
  --em-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --em-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --em-ease: cubic-bezier(.2, .7, .2, 1);
  --em-dur: .18s;
  /* layout: a 1200px spine with 8vw gutters and a 20px floor; the pad centres the spine inside full-bleed bands */
  --spine: 1200px;
  --gutter: max(20px, 8vw);
  --pad: max(var(--gutter), calc((100% - var(--spine)) / 2));
  --nav-h: 60px;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--em-black); color: var(--em-text-2);
  font-family: var(--em-sans); font-size: 15px; line-height: 1.6; font-weight: 400;
  overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; }
::selection { background: var(--em-green-40); color: var(--em-text); }

h1, h2, h3, h4 {
  font-family: var(--em-sans); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--em-text); line-height: 1.2; margin: 2em 0 .6em; text-wrap: balance;
}
h1 { font-size: clamp(28px, 4.2vw, 44px); margin-top: 0; line-height: 1.08; }
h2 { font-size: clamp(20px, 2.4vw, 26px); }
h3 { font-size: 17px; }
h4 { font-size: 14px; }
h5, h6 { font-family: var(--em-mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-text); margin: 1.6em 0 .4em; }
h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }
p { margin: 0 0 1em; }
strong { color: var(--em-text); font-weight: 600; }

a { color: var(--em-text); text-decoration: underline; text-decoration-color: var(--em-green-40); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--em-green); }

/* focus: a visible green ring on every interactive element */
:focus-visible { outline: 2px solid var(--em-green); outline-offset: 2px; border-radius: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--em-green); outline-offset: 2px;
}
button { font: inherit; color: inherit; }

/* lists */
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin: .25em 0; }
li > ul, li > ol { margin: .25em 0 0; }
li > p { margin: 0 0 .5em; }
li::marker { color: var(--em-white-48); }

/* code: inline and fenced; mono, never uppercased */
code, kbd, samp, pre { font-family: var(--em-mono); text-transform: none; letter-spacing: 0; }
code { font-size: .88em; color: var(--em-text); background: var(--em-surface-3); border: 1px solid var(--em-white-06); border-radius: 4px; padding: .1em .35em; overflow-wrap: anywhere; }
pre {
  margin: 0 0 1.2em; padding: 16px 18px; overflow-x: auto; max-width: 100%;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius);
  font-size: 13px; line-height: 1.55; color: var(--em-text);
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }

blockquote {
  margin: 0 0 1.2em; padding: 12px 18px; border: 1px solid var(--em-line);
  background: var(--em-surface-1); border-radius: var(--em-radius); color: var(--em-text-2);
}
blockquote > :last-child { margin-bottom: 0; }

hr { border: 0; height: 1px; background: var(--em-line); margin: 2.4em 0; }

/* tables (renderer output: th/td carry .align-left|center|right from the alignment row) */
table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--em-line); vertical-align: top; text-align: left; overflow-wrap: anywhere; }
th { font-family: var(--em-mono); font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-text); border-bottom-color: var(--em-green-20); white-space: nowrap; }
td { color: var(--em-text-2); }
tbody tr:hover td { background: var(--em-white-06); }
/* a hand-written table too wide for a phone scrolls inside its own box, never the page */
.table-scroll { max-width: 100%; overflow-x: auto; margin: 0 0 1.4em; }
.table-scroll > table { margin: 0; min-width: 560px; }
.table-scroll td, .table-scroll th { overflow-wrap: normal; }
.table-scroll td:first-child { white-space: nowrap; }
.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }

/* ---------------------------------------------------------------- shell: skip link, header, layout, contents tree, footer */
.skip-link {
  position: absolute; left: 12px; top: -200px; z-index: 100; padding: 10px 14px;
  background: var(--em-surface-3); color: var(--em-green); border: 1px solid var(--em-green-40); border-radius: var(--em-radius);
  font-family: var(--em-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; text-decoration: none;
}
.skip-link:focus, .skip-link:focus-visible { top: 12px; }

.site-header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 28px;
  min-height: var(--nav-h); padding-inline: var(--pad);
  background: rgba(0, 9, 12, .92); border-bottom: 1px solid var(--em-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.brand {
  flex: none; font-family: var(--em-sans); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--em-text); text-decoration: none;
}
.gh-link {
  flex: none; margin-inline-start: auto; margin-inline-end: -10px; padding: 8px 10px; border-radius: var(--em-radius);
  font-family: var(--em-mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
  color: var(--em-text-2); text-decoration: none;
  transition: color var(--em-dur) var(--em-ease), background-color var(--em-dur) var(--em-ease);
}
.gh-link:hover { color: var(--em-text); background: var(--em-white-06); }
.gh-link:focus-visible { outline-offset: -2px; }

.layout {
  flex: 1 0 auto; width: 100%; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 56px;
  padding-inline: var(--pad); overflow-x: clip;
}
main { min-width: 0; padding-block: 48px 96px; }
main > p, main > ul, main > ol, main > blockquote, .measure { max-width: 70ch; }

/* ---------------------------------------------------------------- the contents tree (AOS-335)
   Every page: <aside class="sidebar"><details class="toc"><summary>Contents</summary><nav aria-label="Contents">
   <ul class="tree"> then per group <li class="tree__section[ is-current]"><span class="tree__label">Concepts</span>
   <ul class="tree__pages"><li><a href="..." [aria-current="page"]>Page</a>[<ul class="tree__headings"><li><a
   href="#h2-id">Heading</a></li>...</ul>]</li>...</ul></li>. From 900px the tree is a sticky column that scrolls
   inside itself and the toggle is hidden (the details is forced open); below 900px it is a closed "Contents" toggle
   above the content, which works with no script. Hairline guides and ticks draw the directory-tree shape; the current
   page sits on a faint green tint with a green tick; the scroll-spy (site.js) marks the heading in view with .is-active
   (green text and tick). Each link starts just past its tick, so the tint and hover never cover the guide. */
.sidebar { min-width: 0; padding-block: 40px; }
.toc { position: sticky; top: calc(var(--nav-h) + 24px); }
.toc nav {
  position: relative; max-height: calc(100vh - var(--nav-h) - 56px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--em-white-12) transparent; padding: 0 4px 8px 0;
}
.toc > summary { list-style: none; }
.toc > summary::-webkit-details-marker { display: none; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; }
.tree__section + .tree__section { margin-top: 18px; }
.tree__label {
  display: block; padding: 0 0 6px; font-family: var(--em-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em; color: var(--em-white-72);
}
.tree__section.is-current > .tree__label { color: var(--em-text); }
.tree__pages, .tree__headings { border-left: 1px solid var(--em-white-12); }
.tree__pages { margin-left: 4px; }
.tree__headings { margin: 2px 0 6px 16px; }
.tree__pages > li, .tree__headings > li { position: relative; }
.tree__pages > li::before, .tree__headings > li::before {
  content: ""; position: absolute; left: 0; top: 14px; width: 8px; border-top: 1px solid var(--em-white-12); pointer-events: none;
}
.tree__headings > li::before { top: 12px; width: 6px; }
.tree a {
  display: block; margin-left: 10px; padding: 5px 8px 5px 6px; border-radius: 6px;
  font-size: 13.5px; line-height: 1.4; color: var(--em-text-2); text-decoration: none;
  transition: color var(--em-dur) var(--em-ease), background-color var(--em-dur) var(--em-ease);
}
.tree__headings a { margin-left: 8px; padding: 3px 8px 3px 6px; font-size: 12.5px; line-height: 1.35; color: var(--em-white-72); }
.tree a:hover { color: var(--em-text); background: var(--em-white-06); }
.tree a:focus-visible { outline-offset: -2px; }
.tree a[aria-current="page"] { color: var(--em-text); font-weight: 600; background: var(--em-green-06); }
.tree a.is-active { color: var(--em-green); }
.tree__pages > li:has(> a[aria-current="page"])::before, .tree__headings > li:has(> a.is-active)::before { border-top-color: var(--em-green); }

.site-footer {
  padding: 28px var(--pad) 36px; border-top: 1px solid var(--em-line);
  font-size: 13px; color: var(--em-white-72);
}
.site-footer p { margin: 0; }

@media (min-width: 900px) {
  .toc[open] > summary { display: none; }
  @supports selector(::details-content) {
    .toc > summary { display: none; }
    .toc::details-content { content-visibility: visible; }
  }
}
@media (max-width: 899.98px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { padding-block: 16px 0; }
  .toc { position: static; background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card); }
  .toc > summary {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; border-radius: var(--em-radius-card);
    font-family: var(--em-mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-text);
  }
  .toc > summary::after { content: "+"; margin-left: auto; font-size: 16px; line-height: 1; color: var(--em-green); }
  .toc[open] > summary::after { content: "\2212"; }
  .toc > summary:hover { background: var(--em-white-06); }
  .toc > summary:focus-visible { outline-offset: -2px; }
  .toc nav { max-height: 60vh; padding: 4px 12px 14px 14px; }
  main { padding-block: 24px 72px; }
  .site-header { gap: 16px; }
  .settings-table td:first-child, .settings-table th:first-child { width: auto; }
}

/* ---------------------------------------------------------------- type helpers */
.lede { max-width: 64ch; font-size: 17px; line-height: 1.6; color: var(--em-text-2); }
.signal { color: var(--em-green); }
.hint { font-size: 13px; color: var(--em-white-72); }
.mono { font-family: var(--em-mono); }

/* the laser line: the one bright divider of a view block */
.laser {
  border: 0; height: 1px; margin: 3em 0;
  background: linear-gradient(90deg, transparent, var(--em-green) 20%, var(--em-green) 80%, transparent);
}

/* ---------------------------------------------------------------- cards, CTA, badges */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 0 0 1.6em; }
.card {
  display: block; min-width: 0; padding: 22px 24px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
  color: var(--em-text-2); text-decoration: none;
  transition: transform var(--em-dur) var(--em-ease), border-color var(--em-dur) var(--em-ease), box-shadow var(--em-dur) var(--em-ease);
}
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-top: 0; }
.card:hover { border-color: var(--em-line-hover); }
a.card:hover, a.card:focus-visible { transform: translateY(-2px); box-shadow: var(--em-lift); }
a.card:focus-visible { outline: 2px solid var(--em-green); outline-offset: 2px; }

.cta {
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: var(--em-radius);
  font-family: var(--em-mono); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; text-decoration: none;
  color: var(--em-green); background: transparent; border: 1px solid var(--em-green-40);
  transition: border-color var(--em-dur) var(--em-ease), background-color var(--em-dur) var(--em-ease);
}
.cta:hover, .cta:focus-visible { border-color: var(--em-green); background: var(--em-green-06); }
.cta--ghost { color: var(--em-text); border-color: var(--em-white-24); }
.cta--ghost:hover, .cta--ghost:focus-visible { border-color: var(--em-white-72); background: var(--em-white-06); }

.badge {
  display: inline-block; vertical-align: middle; padding: 2px 8px; border-radius: var(--em-radius);
  font-family: var(--em-mono); font-size: 11px; font-weight: 500; line-height: 1.5; text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--em-white-24); color: var(--em-text-2); white-space: nowrap;
}
.badge--action { color: var(--em-green); border-color: var(--em-green-40); background: var(--em-green-06); }
.badge--optional { color: var(--em-text-2); border-color: var(--em-white-24); border-style: dashed; background: transparent; }

/* ---------------------------------------------------------------- generated reference: settings, releases */
.settings-table td:first-child, .settings-table th:first-child { width: 28%; }
.settings-table td:first-child { font-family: var(--em-mono); font-size: 13px; color: var(--em-text); }
.settings-table td:first-child code { background: none; border: 0; padding: 0; }
.settings-table td .badge { margin: 0 4px 2px 0; }
.settings-table td:nth-child(2) { white-space: nowrap; }
/* the one-line tables (Skills, Reference): the name column, then one sentence */
.oneline-table td:first-child, .oneline-table th:first-child { width: 34%; }
.oneline-table td:first-child { overflow-wrap: anywhere; }
.oneline-table td:first-child a { color: var(--em-text); }
.oneline-table td:first-child code { background: none; border: 0; padding: 0; color: inherit; }
.release-index td:first-child, .release-index td:nth-child(2) { font-family: var(--em-mono); font-size: 13px; white-space: nowrap; }
.release-index td .badge { margin-left: 6px; }
/* on a phone a generated row stacks: the name (and, for a setting, its default) on top, the sentence beneath */
@media (max-width: 599.98px) {
  .settings-table thead, .oneline-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .settings-table tr, .oneline-table tr { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--em-line); }
  .oneline-table tr { grid-template-columns: minmax(0, 1fr); }
  .settings-table td, .oneline-table td { display: block; width: auto !important; padding: 0; border: 0; }
  .settings-table td:nth-child(3) { grid-column: 1 / -1; }
  .settings-table td:first-child { overflow-wrap: normal; }
  .release-index thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .release-index tr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--em-line); }
  .release-index td { display: block; padding: 0; border: 0; }
  .release-index td:nth-child(3) { grid-column: 1 / -1; }
}

.release-block {
  margin: 0 0 20px; padding: 20px 24px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.release-block > :last-child { margin-bottom: 0; }
.release-block h2, .release-block h3 { margin-top: 0; }
/* the Upgrade block (consumer action) carries a brighter full hairline; Changes keeps the plain one */
.release-block--upgrade { border-color: var(--em-green-40); }

/* ---------------------------------------------------------------- galleries and the CSS-only lightbox
   Markup (Task 6): <div class="gallery" id="g-<feature>"> then per screenshot <stem>.png
   <figure class="shot" id="<feature>-<stem>"><a class="shot__open" href="#<feature>-<stem>"><img ...></a>
   <figcaption>...</figcaption><a class="shot__close" href="#g-<feature>">Close</a></figure>. Targeting a .shot
   opens it full-screen; the close link targets the gallery again. An inline copy in the prose (<!-- shot: -->) is
   <figure class="shot" id="<feature>-<stem>-inline">, and its open link targets the gallery copy's id. */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; margin: 0 0 2em; }
.shot { margin: 0; min-width: 0; }
.shot__open {
  display: block; overflow: hidden; border: 1px solid var(--em-line); border-radius: var(--em-radius-card); background: var(--em-surface-1);
  transition: border-color var(--em-dur) var(--em-ease), box-shadow var(--em-dur) var(--em-ease);
}
.shot__open:hover, .shot__open:focus-visible { border-color: var(--em-line-hover); box-shadow: var(--em-lift); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--em-text-2); }
.shot__close { display: none; }
.shot:target {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 56px max(20px, 4vw) 24px; background: rgba(0, 9, 12, .96);
}
.shot:target .shot__open { max-width: min(100%, 1400px); max-height: calc(100vh - 140px); border-color: var(--em-green-20); box-shadow: none; cursor: default; }
.shot:target img { width: auto; max-width: 100%; max-height: calc(100vh - 142px); margin: 0 auto; object-fit: contain; }
.shot:target figcaption { max-width: 72ch; text-align: center; color: var(--em-text); }
.shot:target .shot__close {
  display: inline-flex; position: absolute; top: 14px; right: max(20px, 4vw); padding: 8px 14px; border-radius: var(--em-radius);
  font-family: var(--em-mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
  color: var(--em-text); border: 1px solid var(--em-white-24); text-decoration: none; background: var(--em-surface-2);
}
.shot:target .shot__close:hover, .shot:target .shot__close:focus-visible { border-color: var(--em-green); color: var(--em-green); }

/* ---------------------------------------------------------------- Home: the wireframe grid (Task 8)
   .wire-grid on a hero band paints a faint green grid behind its content; it is removed under reduced motion. */
.wire-grid { position: relative; isolation: isolate; }
.wire-grid::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--em-green-06) 1px, transparent 1px), linear-gradient(90deg, var(--em-green-06) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 0%, transparent 72%);
  animation: wire-drift 40s linear infinite;
}
@keyframes wire-drift { from { background-position: 0 0, 0 0; } to { background-position: 0 48px, 48px 0; } }
.hero { padding: 40px 0 32px; margin: 0 0 8px; }
.hero h1 { max-width: 20ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; }

/* Home: the 30-second map, a compact lifecycle. Its chips are labels, not controls (Home has no inspector). */
.home-map .flow { align-items: flex-start; }
.home-map .st { flex: 1 1 140px; }
.home-map .chip { cursor: default; }
.home-map .chip:hover { box-shadow: none; }
.home-map .map-note { margin: 14px 0 0; font-size: 13.5px; color: var(--em-text-2); }
@media (max-width: 760px) {
  .home-map .flow { flex-direction: column; }
  .home-map .st { flex: 0 0 auto; }
  .home-map .ar { align-self: flex-start; padding: 0 0 0 12px; transform: rotate(90deg); }
}

/* ---------------------------------------------------------------- the diagram palette exception
   Emprove's Three Colours Rule allows laser green, abyss black and white (and their alpha mixes) and nothing else.
   This block is the one departure, approved by the architect as decision 4 of the docs-site spec: five
   desaturated tier hues tuned for the dark surfaces, so the lifecycle, sizing and escalation diagrams can say which
   model tier does what. The hues are declared ONLY on .diagram and .tier-legend and used only by rules whose
   selectors start with those classes (scripts/test-build-docs.sh "theme: palette scoped" enforces it), so they
   never leak into prose, nav or controls. The small tier sits far from laser green (hue and dE, "theme: contrast")
   so it never reads as the signal, every hue reaches at least 3:1 on the surfaces (in fact over 6.5:1, so tier-
   coloured text is AA too), and every node still carries its mono tier chip: tier is never shown by colour alone. */
.diagram, .tier-legend {
  --tier-orch: #8E9CF5;
  --tier-heavy: #4FC4DB;
  --tier-small: #B4CF6A;
  --tier-micro: #E9B35C;
  --tier-frontier: #BB9CF2;
}
.diagram[data-tier="orch"], .diagram [data-tier="orch"], .tier-legend [data-tier="orch"] { --tc: var(--tier-orch); }
.diagram[data-tier="heavy"], .diagram [data-tier="heavy"], .tier-legend [data-tier="heavy"] { --tc: var(--tier-heavy); }
.diagram[data-tier="small"], .diagram [data-tier="small"], .tier-legend [data-tier="small"] { --tc: var(--tier-small); }
.diagram[data-tier="micro"], .diagram [data-tier="micro"], .tier-legend [data-tier="micro"] { --tc: var(--tier-micro); }
.diagram[data-tier="frontier"], .diagram [data-tier="frontier"], .tier-legend [data-tier="frontier"] { --tc: var(--tier-frontier); }

/* the frame: a wide diagram scrolls inside its own box, never the page */
.diagram {
  margin: 24px 0; padding: 16px; overflow-x: auto; max-width: 100%;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.diagram > svg { display: block; width: 100%; height: auto; }
.diagram--wide > svg { min-width: 1100px; }
.diagram--plain { padding: 0; background: none; border: 0; border-radius: 0; overflow: visible; }
.diagram code { white-space: nowrap; }

.tier-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 20px 0; padding: 12px 16px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.tier-legend [data-tier], .tier-legend .lg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--em-text-2); }
.tier-legend small { font-family: var(--em-mono); font-size: 12px; color: var(--em-white-72); }
.tier-legend .sep { flex-basis: 100%; height: 0; }
.tier-legend table { flex: 1 1 100%; margin: 0; }
.tier-legend td [data-tier] { color: var(--em-text); }
.tier-legend th, .tier-legend td { padding-inline: 8px; overflow-wrap: normal; }
.tier-legend td [data-tier] { white-space: nowrap; }
@media (max-width: 599.98px) { .tier-legend { padding: 10px; } }

.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--tc, var(--em-white-48)); }

/* the persona chip: tier hue on the border and dot only; the name stays starlight text */
.chip {
  display: inline-grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; min-width: 0; max-width: 100%;
  padding: 6px 10px; text-align: left; cursor: pointer;
  font: inherit; color: var(--em-text); background: var(--em-surface-2);
  border: 1px solid var(--tc, var(--em-line)); border-radius: var(--em-radius);
  transition: box-shadow var(--em-dur) var(--em-ease), background-color var(--em-dur) var(--em-ease);
}
.chip .dot { grid-row: 1 / span 2; }
.chip .cn { font-family: var(--em-mono); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip .cm { font-size: 11.5px; line-height: 1.25; color: var(--em-text-2); }
.chip .tier { font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--tc, var(--em-text-2)); }
.chip:hover { box-shadow: 0 0 0 1px var(--tc, var(--em-green-40)); }
.chip:focus-visible { outline: 2px solid var(--em-green); outline-offset: 2px; }
.chip.sel, .chip[aria-pressed="true"] { background: var(--em-surface-3); box-shadow: 0 0 0 2px var(--tc, var(--em-green)); }

/* SVG vocabulary inside a diagram (the old map's classes, ported) */
.diagram svg .node { fill: var(--em-surface-2); stroke: var(--tc, var(--em-white-24)); stroke-width: 1.5; }
.diagram svg .node.adv { stroke-dasharray: 5 4; }
.diagram svg .static { fill: var(--em-surface-2); stroke: var(--em-white-24); stroke-width: 1.5; }
.diagram svg .row { fill: var(--em-surface-3); stroke: var(--tc, var(--em-white-24)); stroke-width: 1.5; }
.diagram svg .p { cursor: pointer; }
.diagram svg .p:focus-visible { outline: 2px solid var(--em-green); outline-offset: 2px; }
.diagram svg .p:hover .node, .diagram svg .p:focus-visible .node { stroke-width: 2.5; }
.diagram svg .p.sel .node, .diagram svg .p.sel .row { fill: var(--em-surface-3); stroke-width: 3; }
.diagram svg .dotf { fill: var(--tc, var(--em-white-48)); }
.diagram svg .lbl { font: 500 9px var(--em-mono); letter-spacing: .09em; text-transform: uppercase; fill: var(--em-white-72); }
.diagram svg .pn { font: 500 10px var(--em-mono); fill: var(--em-text); }
.diagram svg .mdl { font: 400 10px var(--em-mono); fill: var(--em-text-2); }
.diagram svg .ds { font: 400 10.5px var(--em-sans); fill: var(--em-text-2); }
.diagram svg .ft { font: 500 11.5px var(--em-sans); fill: var(--em-red); }
.diagram svg .lk { font: 500 11.5px var(--em-sans); fill: var(--em-text); text-decoration: underline; cursor: pointer; }
.diagram svg .gate { fill: none; stroke: var(--em-text-2); stroke-width: 1.6; }
.diagram svg .opt { fill: none; stroke: var(--em-white-48); stroke-width: 1.4; stroke-dasharray: 4 3; }
.diagram svg .failp { fill: none; stroke: var(--em-red); stroke-width: 1.6; }
.diagram .ah-ink { fill: var(--em-text-2); }
.diagram .ah-mut { fill: var(--em-white-48); }
.diagram .ah-fail { fill: var(--em-red); }
.diagram .fail { color: var(--em-red); }
.diagram .rec { font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-green); }

/* tier chips inside an SVG diagram: a hairline pill in the tier hue around the mono tier name */
.diagram svg .chip { cursor: inherit; }
.diagram svg .chip rect { fill: var(--em-surface-1); stroke: var(--tc, var(--em-white-24)); stroke-width: 1; }
.diagram svg .chip .tier { font: 500 8.5px var(--em-mono); letter-spacing: .08em; text-transform: uppercase; fill: var(--tc, var(--em-text-2)); }
.diagram svg .p:focus { outline: none; }
.diagram svg .p:focus-visible .node, .diagram svg .p:focus-visible .row { stroke: var(--em-green); stroke-width: 3; }
.diagram svg .done { fill: var(--em-surface-2); stroke: var(--em-green-40); stroke-width: 1.5; }
.diagram svg .tick { fill: none; stroke: var(--em-green); stroke-width: 2.2; }
.diagram svg a:focus-visible .lk { outline: none; fill: var(--em-green); }
.diagram svg .lane-line { fill: none; stroke: var(--em-white-24); stroke-width: 1.4; }
.diagram svg .relay { fill: none; stroke: var(--em-text-2); stroke-width: 1.4; stroke-dasharray: 4 3; }
.diagram svg .lease { fill: var(--em-surface-3); stroke: var(--em-green-20); stroke-width: 1; }
.diagram svg .ttl { font: 700 12px var(--em-sans); letter-spacing: .04em; text-transform: uppercase; fill: var(--em-text); }
.diagram--mid > svg { min-width: 720px; }
/* a 900-unit diagram renders near 1:1, so its prose and names are sized to read at 12px; the 1284-unit lifecycle
   diagram is too dense to grow without a re-layout and keeps the base sizes */
.diagram--mid svg .ds, .diagram--mid svg .pn { font-size: 12px; }
.diagram--mid svg .mdl { font-size: 11px; }

/* ---------------------------------------------------------------- concept pages (AOS-306)
   The persona inspector, the size lanes, the escalation staircase and its signals, the Around-the-loop cards. Each
   block that holds tier chips sits inside .diagram (often .diagram--plain) so the scoped palette reaches them. */
.legend-arrow { display: block; flex: none; }
.tier-legend .lg--fail { color: var(--em-red); }

/* the inspector: hidden until a persona is selected, then it sticks to the bottom of the viewport (a third of it at
   most) until closed with its button or Esc; while it is open, the scroll padding keeps a focused node clear of it */
html:has(.diagram.insp:not([hidden])) { scroll-padding-bottom: calc(min(33vh, 300px) + 16px); }
.diagram.insp[hidden] { display: none; }
.diagram.insp {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-direction: column; margin: 40px 0 0; padding: 10px 14px 12px; overflow: hidden; max-height: min(33vh, 300px);
  background: var(--em-surface-2); border-color: var(--em-green-20); box-shadow: 0 -8px 24px rgba(0, 0, 0, .35);
}
.insp .hint { margin: 0; }
.insp .ib { min-height: 0; overflow: auto; }
.insp .ih { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; padding-right: 36px; }
.insp .x {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer;
  font: 500 18px/1 var(--em-mono); color: var(--em-text-2); background: none; border: 1px solid var(--em-line); border-radius: var(--em-radius);
}
.insp .x:hover { color: var(--em-text); background: var(--em-white-06); }
.insp .x:focus-visible { outline: 2px solid var(--em-green); outline-offset: 1px; }
.insp .ih .dot { width: 11px; height: 11px; }
.insp .in { font-family: var(--em-mono); font-size: 15px; font-weight: 500; color: var(--em-text); }
.insp .pill {
  padding: 1px 9px; border: 1px solid var(--tc, var(--em-white-24)); border-radius: 999px;
  font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--tc, var(--em-text));
}
.insp .im { font-family: var(--em-mono); font-size: 12px; color: var(--em-text-2); }
.insp .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 8px 20px; }
.insp .cols > div { min-width: 0; }
.insp .k { display: block; font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-white-72); }
.insp .v { display: block; font-size: 13.5px; line-height: 1.4; color: var(--em-text-2); }
.insp a.v { color: var(--em-text); font-size: 12.5px; white-space: nowrap; }
.insp .cols > div:last-child { grid-column: 1 / -1; }

/* size lanes */
.lanes { display: grid; gap: 10px; }
.lane {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 16px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.lane .lh b { display: block; font-family: var(--em-mono); font-size: 15px; font-weight: 500; color: var(--em-text); }
.lane .lh span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: var(--em-text-2); }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px 8px; min-width: 0; }
.st { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.st .cap, .rung .cap, .sig .k {
  font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--em-white-72);
}
.st .tx { max-width: 30ch; font-size: 13.5px; line-height: 1.38; color: var(--em-text-2); }
.st .stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.st .row2 { display: flex; flex-wrap: wrap; gap: 6px; }
.ar { align-self: center; padding-top: 14px; font-family: var(--em-mono); font-size: 16px; color: var(--em-white-48); }

/* the escalation staircase: five rungs climb from bottom left to top right, each one grid column further right and one
   row higher, so every persona name fits on one line; each rung's label is in its tier hue; the max gate, red-bordered
   with a red label, spans the row beneath them. Below
   761px the rungs stack top to bottom in climbing order, each indented a little further. */
.stair { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; container: stair / inline-size; }
.rung {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "cap cap" "chip p" "chip note";
  align-items: center; gap: 4px 12px; padding: 10px 12px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius);
}
.rung > .cap { grid-area: cap; color: var(--tc, var(--em-white-72)); }
.rung > .chip { grid-area: chip; align-self: center; }
.rung > p { grid-area: p; align-self: end; }
.rung > .note { grid-area: note; align-self: start; }
.rung p { margin: 0; font-size: 13px; line-height: 1.38; color: var(--em-text-2); }
.rung .note { font-size: 12px; color: var(--em-white-72); }
.rung.h1 { grid-column: 1 / span 4; grid-row: 5; } .rung.h2 { grid-column: 2 / span 4; grid-row: 4; }
.rung.h3 { grid-column: 3 / span 4; grid-row: 3; } .rung.h4 { grid-column: 4 / span 4; grid-row: 2; }
.rung.h5 { grid-column: 5 / span 4; grid-row: 1; }
.rung.gate { grid-column: 1 / -1; grid-row: 6; display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 4px; border-color: var(--em-red); }
.rung.gate > .cap { color: var(--em-red); }
/* a narrow staircase (a narrow column beside the tree) stacks each rung's chip above its text */
@container stair (max-width: 700px) {
  .rung:not(.gate) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cap" "chip" "p" "note"; justify-items: start; }
}
.rung .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.opt-card { display: grid; gap: 6px; padding: 8px; border: 1px dashed var(--em-white-24); border-radius: var(--em-radius); }
.opt-card .chip { justify-self: start; }
.opt-card p { margin: 0; }
.stop {
  margin: 12px 0 0; padding: 12px 16px; font-size: 14px; color: var(--em-text-2);
  background: var(--em-surface-1); border: 1px solid var(--em-red); border-radius: var(--em-radius-card);
}
.stop b { color: var(--em-red); font-weight: 600; }
.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.sig {
  display: grid; align-content: start; gap: 4px; padding: 12px 14px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.sig b { font-size: 15px; font-weight: 600; color: var(--em-text); }
.sig p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--em-text-2); }
.sig .chip { justify-self: start; margin-top: 4px; }

/* Around the loop: one card per piece, its chips, then the guide it cites */
.card .cs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.card .cite { margin: 0; font-size: 12.5px; color: var(--em-white-72); }
.card h3 { font-size: 15px; }
.card p { font-size: 14px; }

@media (max-width: 760px) {
  .lane { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stair { grid-template-columns: minmax(0, 1fr); }
  .stair .rung { grid-column: 1; grid-row: auto; grid-template-columns: minmax(0, 1fr); grid-template-areas: "cap" "chip" "p" "note"; justify-items: start; }
  .rung.h2 { margin-left: 10px; } .rung.h3 { margin-left: 20px; } .rung.h4 { margin-left: 30px; } .rung.h5 { margin-left: 40px; }
  .diagram.insp { padding: 8px 12px 10px; max-height: 30vh; }
  html:has(.diagram.insp:not([hidden])) { scroll-padding-bottom: calc(30vh + 16px); }
  .insp .ih { margin-bottom: 4px; }
  .insp .in { font-size: 14px; }
  .insp .cols { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .insp .v { font-size: 13px; }
}

/* ---------------------------------------------------------------- reduced motion: no transitions, no animation,
   no Home wireframe grid */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
  a.card:hover, a.card:focus-visible { transform: none; }
  .wire-grid::before { display: none; }
}

/* ── AOS-335: numbered step lists (Start pages) ── */

/* ---------------------------------------------------------------- numbered steps (AOS-335): Install, First session, Upgrading
   An <ol class="steps"> of bordered rows: a green mono number on the left, a bold title (<b>) and the body on the right.
   Each row is full width, so a command in a <pre> keeps its line and scrolls inside its own box on a phone. */
main > ol.steps { max-width: none; }
.steps { list-style: none; counter-reset: step; display: grid; gap: 10px; margin: 0 0 1.6em; padding: 0; }
.steps > li {
  counter-increment: step; display: grid; grid-template-columns: 2.6em minmax(0, 1fr); column-gap: 8px; min-width: 0;
  padding: 16px 20px; background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
  color: var(--em-text-2); font-size: 14.5px;
}
.steps > li::before {
  content: counter(step, decimal-leading-zero); grid-row: 1 / span 9; padding-top: 1px;
  font-family: var(--em-mono); font-size: 14px; font-weight: 500; letter-spacing: .06em; color: var(--em-green);
}
.steps > li > * { grid-column: 2; min-width: 0; }
.steps > li > b { display: block; margin: 0 0 4px; font-size: 15px; color: var(--em-text); }
.steps > li > p { margin: 0 0 8px; }
.steps > li > pre { margin: 4px 0 8px; }
.steps > li > :last-child { margin-bottom: 0; }
@media (max-width: 599.98px) {
  .steps > li { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .steps > li::before { grid-row: auto; margin: 0 0 4px; }
  .steps > li > * { grid-column: 1; }
}

/* ── AOS-335: concept-page layouts (size scale, tight grids and tables) ── */

/* Sizing (AOS-335 W2): the four lanes as columns, least ceremony on the left; two columns on a mid screen, one on a phone */
.sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.size {
  display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 14px;
  background: var(--em-surface-1); border: 1px solid var(--em-line); border-radius: var(--em-radius-card);
}
.size .lh b { display: block; font-family: var(--em-mono); font-size: 15px; font-weight: 500; color: var(--em-text); }
.size .lh span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: var(--em-text-2); }
.size .st .tx { max-width: none; }
@media (max-width: 1199.98px) { .sizes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599.98px) { .sizes { grid-template-columns: minmax(0, 1fr); } }

/* Around the loop (AOS-335 W2): a tighter card grid, three across in the 1280 body, one on a phone */
.card-grid--tight { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.card-grid--tight .card { padding: 16px 18px; }
.card-grid--tight .card h3 { margin-bottom: 6px; }
.card-grid--tight .card p { margin-bottom: 10px; line-height: 1.45; }

/* hand tables that stack on a phone (AOS-335 W2): the first two cells side by side on top, the rest beneath */
@media (max-width: 599.98px) {
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .stack-table tr { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--em-line); }
  .stack-table td { display: block; padding: 0; border: 0; overflow-wrap: normal; }
  .stack-table td:first-child { color: var(--em-text); font-weight: 500; }
  .stack-table td:nth-child(n+3) { grid-column: 1 / -1; }
}

/* a small table of very short cells (AOS-335 W2, the size budgets): cells never break, tighter gutters fit a phone */
.tight-table th, .tight-table td { padding-inline: 8px; overflow-wrap: normal; white-space: nowrap; }

/* the agentic-security grid (AOS-358): state is a dot (filled green, hollow grey, filled red) plus a text label, never colour alone */
.risk-grid td:first-child { white-space: nowrap; font-family: var(--em-mono); font-size: 13px; color: var(--em-text); }
.risk-grid td small { display: block; margin-top: 4px; color: var(--em-white-72); font-size: 12.5px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-family: var(--em-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; color: var(--em-text); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--st, var(--em-white-48)); background: var(--st-fill, transparent); box-sizing: content-box; flex: none; }
.st--covered { --st: var(--em-green); --st-fill: var(--em-green); }
.st--partial { --st: var(--em-text-2); --st-fill: transparent; }
.st--open { --st: var(--em-red); --st-fill: var(--em-red); }
.legend-row { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0 0 1.2em; }
