/* ============================================================================
   SYNERGY HOW-TO LIBRARY — COMPONENT STYLES
   ----------------------------------------------------------------------------
   Implements DESIGN-howto-library.md §6.

   Two rules govern everything below and are easy to break by accident:

   1. DENSITY NEUTRALITY (§6.8.3). Components stack. There is no layout mode
      that adds air when a step is long or tightens when a step is thin, and no
      variant keyed to step index. A heavy step must render heavy. If a page
      feels wrong in weight, that is a copy problem, not a style problem.

   2. QUIET NEXT-STEP (§6.10). The end-of-guide block is a bordered block with
      a text-weight link. It is never a filled accent button, never a coloured
      panel, never "Ready to start?". Turning it into one would convert the
      twenty steps above it into a lead magnet.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--sg-canvas);
  color: var(--sg-ink);
  font-family: var(--sg-font-sans);
  font-size: var(--sg-text-body);
  line-height: var(--sg-leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Focus is never invisible. Applied at :focus-visible so pointer users do not
   get a ring on every click, keyboard users always do. */
:focus-visible {
  outline: var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
  border-radius: 2px;
}

::selection { background: rgba(95, 200, 216, 0.25); color: var(--sg-ink); }

a { color: var(--sg-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--sg-accent); color: var(--sg-accent-ink);
  padding: var(--sg-space-2xs) var(--sg-space-sm);
  font-size: var(--sg-text-small); font-weight: 620;
}
.skip-link:focus { left: var(--sg-space-sm); top: var(--sg-space-2xs); }

/* ---- Shell ------------------------------------------------------------- */

.sg-shell { display: flex; flex-direction: column; min-height: 100vh; }

.sg-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--sg-topbar-h);
  display: flex; align-items: center; gap: var(--sg-space-md);
  padding: 0 var(--sg-space-lg);
  min-width: 0;
  background: var(--sg-canvas-raised);
  border-bottom: 1px solid var(--sg-rule);
}
.sg-topbar__brand { display: flex; align-items: center; gap: var(--sg-space-xs); }
.sg-topbar__mark {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border: 1px solid var(--sg-rule-strong); border-radius: 6px;
  font-weight: 700; font-size: 0.8125rem; color: var(--sg-ink);
  /* Flat and monochrome. The beam-spinner glow stays on the marketing site:
     a reference library does not need a light show. */
}
.sg-topbar__word {
  font-size: var(--sg-text-small); font-weight: 620; color: var(--sg-ink);
  letter-spacing: -0.005em;
}
.sg-topbar__section {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-ink-faint);
  padding-left: var(--sg-space-md); border-left: 1px solid var(--sg-rule);
}
.sg-topbar__spacer { flex: 1; }
.sg-topbar__parent {
  font-size: var(--sg-text-small); color: var(--sg-ink-muted);
}

.sg-body { display: flex; flex: 1; align-items: flex-start; }

/* ---- Left rail (§6.1) --------------------------------------------------- */

.sg-rail {
  position: sticky; top: var(--sg-topbar-h);
  width: var(--sg-rail-w); flex: 0 0 var(--sg-rail-w);
  height: calc(100vh - var(--sg-topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--sg-canvas-raised);
  border-right: 1px solid var(--sg-rule);
  padding: var(--sg-space-md) 0 var(--sg-space-2xl);
}
.sg-rail__group { margin-bottom: var(--sg-space-md); }
.sg-rail__groupbtn {
  display: flex; align-items: center; gap: var(--sg-space-2xs);
  width: 100%; background: none; border: 0; cursor: pointer;
  padding: var(--sg-space-2xs) var(--sg-space-md);
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--sg-ink-faint); text-align: left;
}
.sg-rail__groupbtn:hover { color: var(--sg-ink-muted); }
.sg-rail__chev {
  width: 10px; height: 10px; flex: 0 0 10px;
  transition: transform var(--sg-motion-slow) var(--sg-motion-ease);
}
.sg-rail__groupbtn[aria-expanded="true"] .sg-rail__chev { transform: rotate(90deg); }
.sg-rail__grouptitle { flex: 1; }
.sg-rail__groupstate {
  font-family: var(--sg-font-mono); font-size: 0.625rem;
  letter-spacing: 0.04em; color: var(--sg-ink-faint);
}

/* Progress readout: a step count, never a percentage. A reader models the
   work in steps, not in percentages. */
.sg-rail__progress { padding: var(--sg-space-2xs) var(--sg-space-md) var(--sg-space-xs); }
.sg-rail__progresstext {
  font-family: var(--sg-font-mono); font-size: 0.625rem;
  letter-spacing: 0.04em; color: var(--sg-ink-faint);
  display: flex; justify-content: space-between; margin-bottom: 6px;
}
.sg-rail__progresstrack {
  height: 3px; background: var(--sg-canvas-sunken); border-radius: 2px; overflow: hidden;
}
.sg-rail__progressfill { height: 100%; background: var(--sg-accent-quiet); }

.sg-rail__list { list-style: none; margin: 0; padding: 0; }
.sg-rail__step {
  display: flex; align-items: flex-start; gap: var(--sg-space-2xs);
  padding: 7px var(--sg-space-md) 7px 13px;
  border-left: 3px solid transparent;
  font-size: var(--sg-text-small); line-height: 1.45;
  color: var(--sg-ink-muted);
  transition: background var(--sg-motion) ease-out, color var(--sg-motion) ease-out;
}
.sg-rail__step:hover { background: var(--sg-canvas-sunken); color: var(--sg-ink); text-decoration: none; }
.sg-rail__step--current {
  border-left-color: var(--sg-accent);
  background: var(--sg-canvas-sunken);
  color: var(--sg-ink); font-weight: 560;
}
.sg-rail__num {
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--sg-ink-faint); padding-top: 1px; flex: 0 0 auto;
}
.sg-rail__step--current .sg-rail__num { color: var(--sg-accent); }
.sg-rail__glyph { margin-left: auto; flex: 0 0 auto; opacity: 0.65; }
.sg-rail__step--done .sg-rail__glyph { color: var(--sg-success); }
.sg-rail__label { flex: 1 1 auto; }

/* ---- Main + column ------------------------------------------------------ */

.sg-main { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.sg-article {
  display: flex; gap: var(--sg-space-2xl);
  width: 100%; max-width: 74rem;
  padding: var(--sg-space-xl) var(--sg-space-lg) var(--sg-space-2xl);
}

/* Reading column. Measured in ch so it stays correct if the reader has set a
   larger base font size. Capped, never stretched. */
.sg-prose { flex: 1 1 auto; min-width: 0; max-width: var(--sg-measure); margin: 0 auto; }
.sg-prose--wide { max-width: var(--sg-measure-wide); }

/* ---- Article header ----------------------------------------------------- */

.sg-eyebrow {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-accent);
  margin: 0 0 var(--sg-space-xs);
}
.sg-h1 {
  font-size: var(--sg-text-h1); line-height: var(--sg-leading-heading);
  font-weight: 620; letter-spacing: -0.011em;
  color: var(--sg-ink); margin: 0 0 var(--sg-space-sm);
  text-wrap: balance;
}
.sg-h2 {
  font-size: var(--sg-text-h2); line-height: var(--sg-leading-heading);
  font-weight: 620; letter-spacing: -0.008em;
  color: var(--sg-ink); margin: var(--sg-space-xl) 0 var(--sg-space-sm);
  text-wrap: balance;
}
.sg-h3 {
  font-size: var(--sg-text-h3); line-height: 1.35;
  font-weight: 620; color: var(--sg-ink);
  margin: var(--sg-space-lg) 0 var(--sg-space-xs);
}

.sg-lede {
  font-size: var(--sg-text-lg); color: var(--sg-ink-muted);
  margin: 0 0 var(--sg-space-md); max-width: 62ch;
}

.sg-meta {
  display: flex; flex-wrap: wrap; gap: var(--sg-space-sm);
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.04em; color: var(--sg-ink-faint);
  padding: var(--sg-space-xs) 0; margin: 0 0 var(--sg-space-md);
  border-top: 1px solid var(--sg-rule); border-bottom: 1px solid var(--sg-rule);
}
.sg-meta__item { display: flex; gap: 6px; }
.sg-meta__k { color: var(--sg-ink-faint); }
.sg-meta__v { color: var(--sg-ink-muted); }

/* ---- Independence notice (§6.7) ----------------------------------------
   Mandatory on every article, above the first heading. It is not boilerplate
   to be trimmed: it is the element that makes the rest of the page honest, and
   the reason an SME can use the material without wondering what is being sold. */
.sg-independence {
  font-size: var(--sg-text-small); line-height: 1.6; color: var(--sg-ink-muted);
  border-left: 2px solid var(--sg-rule-strong);
  padding: var(--sg-space-2xs) 0 var(--sg-space-2xs) var(--sg-space-sm);
  margin: 0 0 var(--sg-space-lg); max-width: 62ch;
}

/* ---- Step header (§6.2) ------------------------------------------------- */

.sg-stephead { margin: var(--sg-space-2xl) 0 var(--sg-space-md); }
.sg-stephead:first-of-type { margin-top: var(--sg-space-xl); }
.sg-stephead__rule {
  display: flex; align-items: center; gap: var(--sg-space-sm);
  margin-bottom: var(--sg-space-xs);
}
.sg-stephead__num {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--sg-accent); white-space: nowrap;
}
.sg-stephead__line { flex: 1; height: 1px; background: var(--sg-rule); }
.sg-stephead__time {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.04em; color: var(--sg-ink-faint); white-space: nowrap;
}
.sg-stephead__title {
  font-size: var(--sg-text-h2); line-height: var(--sg-leading-heading);
  font-weight: 620; letter-spacing: -0.008em; margin: 0 0 var(--sg-space-2xs);
  text-wrap: balance;
}
.sg-stephead__outcome { color: var(--sg-ink-muted); margin: 0; max-width: 64ch; }

/* ---- Prose -------------------------------------------------------------- */

.sg-prose p { margin: var(--sg-space-sm) 0 0; text-wrap: pretty; }
.sg-prose p:first-child { margin-top: 0; }
.sg-prose ul, .sg-prose ol { margin: var(--sg-space-sm) 0 0; padding-left: 1.35em; }
.sg-prose li { margin-top: var(--sg-space-2xs); }
.sg-prose li::marker { color: var(--sg-ink-faint); }
.sg-prose strong { font-weight: 640; color: var(--sg-ink); }
.sg-prose hr { border: 0; border-top: 1px solid var(--sg-rule); margin: var(--sg-space-lg) 0; }
.sg-prose blockquote {
  margin: var(--sg-space-md) 0; padding-left: var(--sg-space-sm);
  border-left: 3px solid var(--sg-rule); color: var(--sg-ink-muted);
}

/* Decimal sub-numbering (§4.3). The number is aria-hidden in markup so a
   screen reader hears the heading, not "one point one". */
.sg-prose h3.sg-numbered { display: flex; gap: 0.6em; align-items: baseline; }
.sg-prose h3.sg-numbered .sg-subnum {
  font-family: var(--sg-font-mono); font-size: 0.8125rem;
  color: var(--sg-ink-faint); font-variant-numeric: tabular-nums;
}

/* ---- Inline code + code block (§6.4) ------------------------------------ */

code {
  font-family: var(--sg-font-mono); font-size: 0.9em;
  background: var(--sg-canvas-inset); color: var(--sg-ink);
  padding: 2px 5px; border-radius: 3px;
}

.sg-code {
  margin: var(--sg-space-md) 0 0;
  border: 1px solid var(--sg-rule); border-radius: var(--sg-radius);
  background: var(--sg-canvas-sunken); overflow: hidden;
}
.sg-code__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sg-space-sm);
  padding: 6px var(--sg-space-xs) 6px var(--sg-space-sm);
  background: var(--sg-canvas-raised); border-bottom: 1px solid var(--sg-rule);
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.04em; color: var(--sg-ink-faint);
}
.sg-code__copy {
  background: none; border: 1px solid var(--sg-rule-strong);
  border-radius: 3px; cursor: pointer;
  color: var(--sg-ink-muted); font: inherit; font-family: var(--sg-font-mono);
  padding: 3px 8px; min-height: 26px;
  transition: color var(--sg-motion) ease-out, border-color var(--sg-motion) ease-out;
}
.sg-code__copy:hover { color: var(--sg-ink); border-color: var(--sg-ink-faint); }
.sg-code__copy[data-copied="true"] { color: var(--sg-success); border-color: var(--sg-success); }
.sg-code { min-width: 0; max-width: 100%; }
.sg-code pre {
  margin: 0; padding: var(--sg-space-sm);
  overflow-x: auto; tab-size: 2;
  max-width: 100%;
  font-family: var(--sg-font-mono); font-size: 0.8125rem; line-height: 1.65;
  color: var(--sg-ink);
}
.sg-code pre code { background: none; padding: 0; font-size: inherit; }

/* ---- Callouts (§6.3) ----------------------------------------------------
   A 1px left rule and a label word. Colour never carries meaning alone: every
   callout has a text label, so a colour-blind auditor loses nothing. */
.sg-callout {
  margin: var(--sg-space-md) 0 0;
  padding: var(--sg-space-sm) var(--sg-space-md);
  background: var(--sg-canvas-sunken);
  border-left: 1px solid var(--sg-rule-strong);
}
.sg-callout--important { border-left-width: 3px; border-left-color: var(--sg-danger); }
.sg-callout--caution   { border-left-color: var(--sg-warn); }
.sg-callout--note      { border-left-color: var(--sg-info); }
.sg-callout--decision  { border-left-color: var(--sg-decision); }

/* An artefact is not an alert. It is the receipt for a step: the thing you now
   hold. Given the same box as a caution it reads as one more notice to skim,
   so it loses the left accent, the fill and the alert geometry, and becomes a
   flat ledger line with a rule above it. If it ever starts looking urgent, the
   step has started looking like a sales funnel. */
.sg-callout--artefact {
  border-left: 0;
  background: transparent;
  border-top: 1px solid var(--sg-rule);
  border-radius: 0;
  padding: var(--sg-space-sm) 0 0;
  margin-top: var(--sg-space-lg);
}
.sg-callout--artefact .sg-callout__label {
  letter-spacing: 0.14em;
}
.sg-callout--requirement {
  border-left-width: 3px; border-left-color: var(--sg-rule-strong);
  background: var(--sg-canvas-raised);
}

.sg-callout__label {
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.11em; text-transform: uppercase;
  display: block; margin-bottom: var(--sg-space-2xs);
}
.sg-callout--important .sg-callout__label { color: var(--sg-danger); }
.sg-callout--caution   .sg-callout__label { color: var(--sg-warn); }
.sg-callout--note      .sg-callout__label { color: var(--sg-info); }
.sg-callout--decision  .sg-callout__label { color: var(--sg-decision); }
.sg-callout--artefact  .sg-callout__label { color: var(--sg-artefact); }
.sg-callout--requirement .sg-callout__label { color: var(--sg-ink-faint); }

.sg-callout__title { font-weight: 620; color: var(--sg-ink); margin: 0 0 var(--sg-space-2xs); }
.sg-callout p { margin: var(--sg-space-2xs) 0 0; }
.sg-callout p:first-of-type { margin-top: 0; }
.sg-callout__clause {
  font-family: var(--sg-font-mono); font-size: 0.75rem;
  color: var(--sg-ink-faint); margin-left: 6px;
}

/* ---- Tables (§6.5) ------------------------------------------------------
   Generic column spec, not a fixed shape: the system register and the evidence
   register are different specs against the same component. */
.sg-table-wrap { margin: var(--sg-space-md) 0 0; }
.sg-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--sg-text-small); line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.sg-table caption {
  caption-side: top; text-align: left;
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--sg-ink-faint); padding-bottom: var(--sg-space-2xs);
}
.sg-table th, .sg-table td {
  text-align: left; vertical-align: top;
  padding: var(--sg-space-2xs) var(--sg-space-xs);
  border-bottom: 1px solid var(--sg-rule);
}
.sg-table thead th {
  background: var(--sg-canvas-raised);
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--sg-ink-muted); font-weight: 500;
  border-bottom: 1px solid var(--sg-rule-strong);
  position: sticky; top: var(--sg-topbar-h); z-index: 5;
}
/* Row header stays pinned visually when scanning a wide register. */
.sg-table tbody th {
  font-weight: 560; color: var(--sg-ink);
  background: var(--sg-canvas-raised);
  border-right: 1px solid var(--sg-rule);
}
.sg-table td { color: var(--sg-ink-muted); }
.sg-table td.sg-cell--num { font-family: var(--sg-font-mono); color: var(--sg-ink-faint); }
.sg-table tr:hover td { background: var(--sg-canvas-sunken); }

/* Mobile: reflow to definition blocks. A register you have to swipe sideways
   on a phone is a register nobody reads. */
@media (max-width: 767px) {
  .sg-table, .sg-table thead, .sg-table tbody, .sg-table tr, .sg-table th, .sg-table td {
    display: block;
  }
  .sg-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
  }
  .sg-table tr {
    border: 1px solid var(--sg-rule); border-radius: var(--sg-radius);
    padding: var(--sg-space-xs); margin-bottom: var(--sg-space-xs);
    background: var(--sg-canvas-sunken);
  }
  .sg-table tbody th {
    background: none; border: 0; padding: 0 0 var(--sg-space-2xs);
    font-size: var(--sg-text-body);
  }
  /* Definition rows: label column fixed, value column wraps and never
     overflows. On a 375px screen a 40% label leaves too little for a sentence
     like "Sampling log, 20 items/wk, 12% reject" — it clipped. 6.5rem is the
     longest label we expect (OPERATING / LAST CHECKED) and the value gets the
     rest of the line, wrapping onto its own line when it needs it. */
  .sg-table td {
    border: 0; padding: 3px 0; display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: var(--sg-space-2xs);
    align-items: baseline;
  }
  .sg-table td::before {
    content: attr(data-label);
    font-family: var(--sg-font-mono); font-size: 0.6875rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--sg-ink-faint);
    line-height: 1.35;
  }
  .sg-table td > * , .sg-table td { overflow-wrap: anywhere; }
/* Column headers are labels, not sentences. Let them break at a space rather
   than mid-word: "DATA PROCESSED" was hyphenating to "DATA PRO-CESSED". */
.sg-table th { overflow-wrap: break-word; hyphens: none; }

/* Alternating rows plus a slightly stronger rule. An eight-column register is
   read across, and at this width the eye needs help tracking a single row. */
.sg-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.022); }
.sg-table tbody tr:hover { background: rgba(255, 255, 255, 0.045); }
.sg-table td { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.sg-table tbody tr:last-child td { border-bottom: 0; }
  .sg-table thead th { position: static; }
}

/* ---- On this page (§6 shell) -------------------------------------------- */

.sg-toc {
  position: sticky; top: calc(var(--sg-topbar-h) + var(--sg-space-lg));
  width: var(--sg-toc-w); flex: 0 0 var(--sg-toc-w);
  align-self: flex-start; max-height: calc(100vh - var(--sg-topbar-h) - var(--sg-space-2xl));
  overflow-y: auto;
}
.sg-toc__label {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-ink-faint);
  margin: 0 0 var(--sg-space-xs); padding-bottom: var(--sg-space-2xs);
  border-bottom: 1px solid var(--sg-rule);
}
.sg-toc__list { list-style: none; margin: 0; padding: 0; }
.sg-toc__item a {
  display: block; padding: 4px 0 4px var(--sg-space-xs);
  border-left: 1px solid var(--sg-rule);
  font-size: var(--sg-text-small); line-height: 1.45;
  color: var(--sg-ink-muted);
}
.sg-toc__item a:hover { color: var(--sg-ink); text-decoration: none; }
.sg-toc__item--active a {
  border-left: 2px solid var(--sg-accent); color: var(--sg-ink); font-weight: 560;
  padding-left: calc(var(--sg-space-xs) - 1px);
}
.sg-toc__item--sub a { padding-left: var(--sg-space-md); font-size: 0.8125rem; }

/* ---- Prev / next (§6.6) ------------------------------------------------- */

.sg-pager {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--sg-rule-strong);
  margin-top: var(--sg-space-2xl);
}
.sg-pager__cell {
  display: block; padding: var(--sg-space-md) var(--sg-space-sm);
  color: var(--sg-ink); text-decoration: none;
  transition: background var(--sg-motion) ease-out;
}
.sg-pager__cell:hover { background: var(--sg-canvas-raised); text-decoration: none; }
.sg-pager__cell--next { text-align: right; border-left: 1px solid var(--sg-rule); }
.sg-pager__cell--empty { visibility: hidden; }
.sg-pager__dir {
  display: block; font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-ink-faint);
  margin-bottom: 4px;
}
.sg-pager__title { display: block; font-weight: 560; font-size: var(--sg-text-body); }
.sg-pager__count {
  display: block; font-family: var(--sg-font-mono); font-size: 0.6875rem;
  color: var(--sg-ink-faint); margin-top: 4px;
}

/* ---- Next step (§6.10) -------------------------------------------------
   THE QUIET BLOCK. Not a CTA. Read the rule in the spec before changing it:
   the library's entire value is that a reader can tell they have left the
   marketing funnel. An accent button here would make the twenty steps above it
   bait. Keep it a bordered block with a text-weight link. */
.sg-nextstep {
  margin-top: var(--sg-space-lg);
  padding: var(--sg-space-md);
  border: 1px solid var(--sg-rule);
  border-radius: var(--sg-radius);
  background: transparent;
}
.sg-nextstep__label {
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--sg-ink-faint);
  display: block; margin-bottom: var(--sg-space-2xs);
}
.sg-nextstep__title { font-weight: 620; margin: 0 0 var(--sg-space-2xs); }
.sg-nextstep__why { color: var(--sg-ink-muted); margin: 0 0 var(--sg-space-xs); font-size: var(--sg-text-small); }
.sg-nextstep__link { font-weight: 560; font-size: var(--sg-text-small); }

/* ---- Footer ------------------------------------------------------------- */

/* The footer is now two registers in one block: the identity line the site has
   always had, and a legal note underneath it. The legal note is deliberately
   quieter than everything else on the page — smaller, dimmer, tighter leading,
   no borders. It must be present and readable without ever competing with the
   guide above it, because a disclaimer that shouts reads as a warning about
   the content rather than an attribution. */
.sg-footer {
  border-top: 1px solid var(--sg-rule);
  padding: var(--sg-space-lg);
  display: flex; flex-direction: column; gap: var(--sg-space-sm);
  font-size: var(--sg-text-small); color: var(--sg-ink-faint);
}
.sg-footer__identity {
  display: flex; flex-wrap: wrap; gap: var(--sg-space-md);
  justify-content: space-between; align-items: baseline;
}
.sg-footer__links { display: flex; flex-wrap: wrap; gap: var(--sg-space-md); }
.sg-footer a { color: var(--sg-ink-muted); }
.sg-footer a:hover { color: var(--sg-accent); }

.sg-footer__legal {
  /* One measured column, opened up a little. Measured at 1440 the first
     version stacked into an L-shape with a dead gap on the right and ragged
     breaks mid-clause; wider measure and more leading fixes both without
     making the note any louder. */
  max-width: 104ch;
  display: flex; flex-direction: column; gap: 0.5em;
  font-size: 0.75rem; line-height: 1.65;
  color: var(--sg-ink-faint);
  opacity: 0.85;
  text-wrap: pretty;
}
.sg-footer__legal p { margin: 0; }
.sg-footer__legal a { color: var(--sg-ink-muted); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Drawer (mobile rail) ----------------------------------------------- */

.sg-drawer-toggle {
  display: none; align-items: center; gap: var(--sg-space-2xs);
  background: none; border: 1px solid var(--sg-rule-strong);
  border-radius: 3px; color: var(--sg-ink-muted);
  font: inherit; font-size: var(--sg-text-small);
  padding: 5px var(--sg-space-xs); cursor: pointer; min-height: 34px;
}

@media (max-width: 1439px) {
  .sg-article { gap: var(--sg-space-xl); }
}
@media (max-width: 1279px) {
  .sg-toc { display: none; }
  .sg-article { max-width: 60rem; }
}
@media (max-width: 1023px) {
  .sg-drawer-toggle { display: inline-flex; }
  .sg-rail {
    position: fixed; top: var(--sg-topbar-h); left: 0; z-index: 60;
    width: 86vw; max-width: 20rem; height: calc(100vh - var(--sg-topbar-h));
    transform: translateX(-100%);
    transition: transform var(--sg-motion-slow) var(--sg-motion-ease);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0);
  }
  .sg-rail[data-open="true"] {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(7, 10, 14, 0.72);
  }
  .sg-article { padding: var(--sg-space-lg) var(--sg-space-sm) var(--sg-space-2xl); }
}
@media (max-width: 767px) {
  .sg-prose { max-width: 100%; }
  .sg-stephead { margin-top: var(--sg-space-xl); }
  .sg-pager { grid-template-columns: 1fr; }
  .sg-pager__cell--next { border-left: 0; border-top: 1px solid var(--sg-rule); text-align: left; }
  .sg-pager__cell--empty { display: none; }
  .sg-topbar { padding: 0 var(--sg-space-sm); }
  .sg-topbar__section { display: none; }
  .sg-article { padding-left: var(--sg-space-sm); padding-right: var(--sg-space-sm); }
}

/* ============================================================================
   ADDITIONS — index-level components (door, register, cards)
   Missing from the first pass: the index rendered these as plain prose, which
   made the door indistinguishable from body copy and printed the register band
   as "1guides / 5steps". Fixed here rather than by loosening the prose styles.
   ========================================================================= */

.sg-register {
  display: flex; flex-wrap: wrap;
  gap: 0;
  margin: var(--sg-space-md) 0 0;
  border-top: 1px solid var(--sg-rule);
  border-bottom: 1px solid var(--sg-rule);
}
.sg-register > div {
  flex: 1 1 0; min-width: 6rem;
  padding: var(--sg-space-xs) var(--sg-space-sm) var(--sg-space-xs) 0;
  border-right: 1px solid var(--sg-rule);
}
.sg-register > div:last-child { border-right: 0; }
.sg-register > div + div { padding-left: var(--sg-space-sm); }
.sg-register__n {
  display: block;
  font-family: var(--sg-font-mono); font-size: 1.125rem;
  font-variant-numeric: tabular-nums; color: var(--sg-ink);
  line-height: 1.3;
}
.sg-register__k {
  display: block;
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-ink-faint);
}

/* The door (§6.8.1). Reads as a portal, not as guide 0: full width, stronger
   boundary, its own eyebrow. If it ever looks like a fifth card, the reader is
   forced to compare it against the four guides and the point is lost. */
.sg-door {
  margin: var(--sg-space-2xl) 0 0;
  padding: var(--sg-space-lg);
  background: var(--sg-canvas-raised);
  border: 1px solid var(--sg-rule-strong);
  border-radius: var(--sg-radius);
}
.sg-door__body {
  color: var(--sg-ink-muted); margin: var(--sg-space-2xs) 0 0; max-width: 58ch;
}
.sg-door__meta {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.04em; color: var(--sg-ink-faint);
  margin: var(--sg-space-sm) 0 0;
}
.sg-door__link {
  display: inline-block; margin-top: var(--sg-space-sm);
  font-weight: 560;
  border-bottom: 1px solid var(--sg-accent-quiet);
  padding-bottom: 1px;
}
.sg-door__link:hover { text-decoration: none; border-bottom-color: var(--sg-accent); }

.sg-cards { display: flex; flex-direction: column; gap: var(--sg-space-md); margin-top: var(--sg-space-md); }
.sg-card {
  padding: var(--sg-space-md);
  background: var(--sg-canvas-raised);
  border: 1px solid var(--sg-rule);
  border-radius: var(--sg-radius);
}
.sg-card__eyebrow {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--sg-ink-faint);
  margin: 0 0 var(--sg-space-2xs);
}
.sg-card__title {
  font-size: var(--sg-text-h3); font-weight: 620; color: var(--sg-ink);
  margin: 0 0 var(--sg-space-2xs);
}
.sg-card__scope { color: var(--sg-ink-muted); margin: 0 0 var(--sg-space-sm); }
.sg-card__steps {
  margin: 0; padding-left: 0; list-style: none;
  border-top: 1px solid var(--sg-rule);
}
.sg-card__steps li {
  border-bottom: 1px solid var(--sg-rule);
  padding: 5px 0;
  font-size: var(--sg-text-small);
}
.sg-card__steps li a { color: var(--sg-ink-muted); display: flex; gap: var(--sg-space-xs); }
.sg-card__steps li a:hover { color: var(--sg-ink); text-decoration: none; }
.sg-card__steps { counter-reset: step; }
.sg-card__steps li { counter-increment: step; }
.sg-card__steps li a::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--sg-font-mono); font-size: 0.6875rem;
  color: var(--sg-ink-faint); flex: 0 0 auto;
}
.sg-card__meta {
  font-family: var(--sg-font-mono); font-size: var(--sg-text-label);
  color: var(--sg-ink-faint); margin: var(--sg-space-xs) 0 0;
}

/* ---- Very narrow screens (320–359px) ------------------------------------
   Found by measurement, not by guesswork: at 320px the top bar's parent link
   and the code block both pushed past the viewport. A documentation page that
   scrolls sideways is broken, so these are hard constraints rather than
   preferences. */
@media (max-width: 359px) {
  .sg-topbar { padding: 0 var(--sg-space-2xs); gap: var(--sg-space-2xs); }
  .sg-topbar__parent { display: none; }
  .sg-article { padding-left: var(--sg-space-3xs); padding-right: var(--sg-space-3xs); }
  .sg-prose { max-width: 100%; }
  .sg-code pre { font-size: 0.75rem; }
  .sg-table td { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .sg-callout { padding: var(--sg-space-xs); }
  .sg-nextstep { padding: var(--sg-space-sm); }
}

/* ---- Legal slot for the self-assessment (not yet built) -------------------
   Counsel's requirement: if the assessment logs an IP, sets a cookie, or asks
   for an email — including to send the result — then GDPR art. 13 applies and
   the privacy notice must sit DIRECTLY BESIDE the Start control, not in the
   footer, not on a separate page reached by a link in small text.

   The slot is built now, before the component exists, because a legal
   requirement discovered after the form is designed gets bolted on as a
   footnote. This one is part of the control's own line.

   Nothing here is active yet: the assessment has no route, so the block
   renders as copy only. When the form lands, the button and this link share
   one row and the link is a sibling of the control, not a caption. */
.sg-assess-actions {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: var(--sg-space-sm) var(--sg-space-md);
  margin-top: var(--sg-space-sm);
}
.sg-assess-actions__legal {
  font-size: 0.75rem;
  color: var(--sg-ink-faint);
  line-height: 1.5;
}
.sg-assess-actions__legal a {
  color: var(--sg-ink-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sg-assess-actions__legal a:hover { color: var(--sg-accent); }

/* "Not open yet" is a statement, not a disabled button. It must not look
   clickable, and it must not look like an error either. */
.sg-door__meta--pending {
  font-family: var(--sg-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sg-ink-faint);
  border-left: 2px solid var(--sg-rule);
  padding-left: var(--sg-space-xs);
}

/* ---- Liability frame, above the verdict ---------------------------------
   Counsel's requirement: the disclaimer must be read BEFORE the result, not
   after. A note under a verdict is absorbed after the reader has already
   formed a conclusion, so it is not opposable and does nothing except protect
   us on paper while failing the person reading.

   So it is not a quiet footer note. It is a framed block that sits above the
   verdict and encloses the reading of it — but it stays in the same calm
   register as the rest of the page: a hairline frame, no fill, no icon, no
   warning colour. The frame is the emphasis; the styling stays quiet.

   It must survive being the last thing on a page or a narrow phone screen,
   so the measure is capped and the text is never justified. */
.sg-liability {
  border: 1px solid var(--sg-rule-strong);
  border-radius: 4px;
  padding: var(--sg-space-m) var(--sg-space-m);
  margin-block: var(--sg-space-xl) var(--sg-space-m);
  max-width: 72ch;
  background: color-mix(in oklab, var(--sg-canvas-sunken) 45%, transparent);
}
.sg-liability__label {
  display: block;
  font-family: var(--sg-font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sg-ink-muted);
  margin-bottom: 0.6em;
}
.sg-liability p {
  margin: 0;
  font-size: var(--sg-text-small);
  line-height: 1.6;
  color: var(--sg-ink-muted);
  text-wrap: pretty;
}
