/* ==========================================================================
   moralesworld.com — styles.css
   Design system: the design document (D-13). Every page is a light sheet on
   a slate desk with a dark cover, footer, and inset plates. One shared,
   responsive stylesheet, desktop-first with breakpoints at 1180, 960, and 560.
   ========================================================================== */

:root {
  /* Steel, for secondary graphics: timelines, connections, figure fills. */
  --slate: #50606f;
  --slate-soft: #8fa3b0;

  /* Design document (D-13). Paper and cover pairs are both AA for
     their muted text; oxblood-text-inv is the accent for text on the cover. */
  --doc-desk: #1a232b;
  --doc-cover: #1f2a33;
  --doc-cover-2: #26323c;
  --doc-cover-rule: #364450;
  --doc-cover-line: #74838e;
  --doc-cover-text: #e8edf0;
  --doc-cover-muted: #a3b0b9;
  --doc-paper: #eef1f3;
  --doc-paper-2: #e2e7ea;
  --doc-paper-rule: #c9d1d6;
  --doc-paper-line: #7f8b93;
  --doc-paper-text: #1c252c;
  --doc-paper-muted: #53606a;
  --doc-track: #d5dce1;
  --doc-oxblood: #8a2c2e;
  --doc-oxblood-text-inv: #e28a82;
  --doc-on-accent: #eef3f6;
  --doc-node-hot: #2b2a31;
  --doc-grid-dot: rgba(143, 163, 176, 0.18);

  /* Type */
  --font-doc: 'Archivo', 'Helvetica Neue', arial, sans-serif;
  --font-code: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-doc);
  color: var(--doc-paper-text);
  background: var(--doc-desk);
  line-height: 1.6;
  padding: clamp(10px, 4vw, 56px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
a { color: inherit; }

/* Focus visibility (accessibility) */
:focus-visible {
  outline: 2px solid var(--doc-oxblood-text-inv);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--doc-oxblood);
  color: var(--doc-on-accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* ==========================================================================
   THE DOCUMENT SHEET (D-13)
   One light sheet on the slate desk. Dark appears only as the cover, the
   footer, and inset plates. Components read role tokens (--fg, --bg, ...),
   which .doc sets for paper and .doc-dark resets for dark surfaces, so the
   same component renders correctly on either.
   ========================================================================== */
.doc {
  --fg: var(--doc-paper-text);
  --fg-muted: var(--doc-paper-muted);
  --bg: var(--doc-paper);
  --bg-2: var(--doc-paper-2);
  --rule: var(--doc-paper-rule);
  --line: var(--doc-paper-line);
  --accent-text: var(--doc-oxblood);
  --steel-ink: var(--slate);

  max-width: 1320px;
  margin-inline: auto;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--doc-cover-line);
  box-shadow: 0 0 0 6px var(--doc-desk), 0 0 0 7px var(--doc-cover-rule);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
}

.doc-dark {
  --fg: var(--doc-cover-text);
  --fg-muted: var(--doc-cover-muted);
  --bg: var(--doc-cover);
  --bg-2: var(--doc-cover-2);
  --rule: var(--doc-cover-rule);
  --line: var(--doc-cover-line);
  --accent-text: var(--doc-oxblood-text-inv);
  --steel-ink: var(--slate-soft);

  background-color: var(--bg);
  color: var(--fg);
}

.doc a { text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--accent-text); }
.doc a:hover { color: var(--accent-text); }
.doc :focus-visible { outline-color: var(--accent-text); }
.doc-wrap { padding-inline: clamp(16px, 4vw, 56px); }
.doc-nowrap { white-space: nowrap; }

/* ---- Cover ---- */
.doc-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; align-items: baseline; padding-block: 16px; border-bottom: 1px solid var(--rule); }
.doc-site { font-weight: 700; text-decoration: none; font-variation-settings: "wdth" 88; }
.doc-nav { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 0.9375rem; color: var(--fg-muted); }
.doc-nav a { text-decoration: none; }
.doc-nav a:hover { color: var(--fg); text-decoration: underline; }

.doc-control { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; border-bottom: 2px solid var(--fg); }
.doc-control div { padding: 10px 14px 12px 0; min-width: 0; }
.doc-control div + div { padding-left: 14px; border-left: 1px solid var(--rule); }
.doc-control dt { font-size: 0.75rem; color: var(--fg-muted); }
.doc-control dd { margin: 2px 0 0; font-size: 0.9375rem; font-weight: 600; overflow-wrap: anywhere; }

.doc-control-live dd::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--doc-oxblood-text-inv);
  vertical-align: 2px;
}

.doc-title { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: clamp(32px, 6vw, 88px); padding-block: clamp(32px, 4vw, 48px) clamp(40px, 6vw, 72px); }

/* The negative margin trims the line box above the capitals, so the visible
   gap above the name matches the gap below the contents (both the clamp above). */
.doc-name { margin-top: -0.075em; font-weight: 760; font-variation-settings: "wdth" 70; font-size: clamp(3.25rem, 10vw, 8.75rem); line-height: 0.86; letter-spacing: -0.012em; }
.doc-subtitle { margin-top: 18px; max-width: 40ch; font-size: clamp(1.125rem, 1.8vw, 1.4375rem); font-weight: 500; font-variation-settings: "wdth" 88; line-height: 1.35; color: var(--fg-muted); text-wrap: balance; }
.doc-abstract { margin-top: clamp(28px, 4vw, 40px); max-width: 62ch; }
.doc-abstract h2 { margin-bottom: 6px; font-size: 0.9375rem; font-weight: 700; color: var(--fg-muted); }
.doc-abstract p { font-size: 1.125rem; line-height: 1.55; text-wrap: pretty; }
.doc-portrait { align-self: center; }
.doc-portrait img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 22%; padding: 8px; border: 1px solid var(--line); background: var(--bg-2); }
.doc-portrait figcaption { margin-top: 10px; font-size: 0.875rem; color: var(--fg-muted); }
.doc-portrait figcaption b { color: var(--fg); font-weight: 650; }

.doc-toc { padding-bottom: clamp(32px, 4vw, 48px); }
.doc-toc h2 { margin-bottom: 10px; font-size: 0.9375rem; font-weight: 700; color: var(--fg-muted); }
.doc-toc ol { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 2px solid var(--fg); border-bottom: 1px solid var(--rule); counter-reset: toc; }
.doc-toc li { min-width: 0; counter-increment: toc; }
.doc-toc li + li { border-left: 1px solid var(--rule); }
.doc-toc a { display: grid; gap: 2px; height: 100%; padding: 12px 14px 14px; text-decoration: none; transition: background-color 160ms ease; }
.doc-toc a::before { content: counter(toc); font-size: 0.875rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-toc a b { font-size: 1rem; font-weight: 650; line-height: 1.25; font-variation-settings: "wdth" 86; }
.doc-toc a span { font-size: 0.8125rem; color: var(--fg-muted); }
.doc-toc a:hover { background: var(--doc-oxblood); }
.doc-toc a:hover, .doc-toc a:hover::before, .doc-toc a:hover span { color: var(--doc-on-accent); }

/* ---- Sections ---- */
.doc-section { padding-block: clamp(44px, 6vw, 76px); border-top: 1px solid var(--rule); }
.doc-section:first-child { border-top: 0; }
.doc-sh { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 4px 0; align-items: baseline; margin-bottom: clamp(28px, 4vw, 44px); }
.doc-no { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 300; font-variation-settings: "wdth" 72; font-variant-numeric: tabular-nums; color: var(--steel-ink); }
.doc-sh h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 740; font-variation-settings: "wdth" 72; line-height: 1.05; }
.doc-sh p { font-size: 0.9375rem; color: var(--fg-muted); text-align: right; }
.doc-more { display: inline-block; margin-top: 10px; font-weight: 600; }

/* Dark inset plates carry a faint dot-grid canvas. */
.doc-diagram, .doc-plate { background-image: radial-gradient(circle, var(--doc-grid-dot) 1px, transparent 1.3px); background-size: 22px 22px; background-position: 11px 11px; }

/* ---- Figure 1: system context ---- */
.doc-figure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; margin-top: 12px; font-size: 0.875rem; color: var(--fg-muted); }
.doc-figure figcaption b { color: var(--fg); font-weight: 650; }
.doc-legend { display: flex; gap: 18px; align-items: center; }
.doc-legend i { display: inline-block; width: 28px; height: 0; margin-right: 6px; border-top: 1.5px solid var(--line); vertical-align: middle; }
.doc-legend .doc-legend-off { border-top-style: dashed; }
.doc-diagram { border: 1px solid var(--rule); }
.doc-diagram svg { display: block; width: 100%; height: auto; }
.doc-box { fill: var(--bg); stroke: var(--line); stroke-width: 1.5; transition: stroke 140ms ease, fill 140ms ease; }
.doc-core { fill: var(--doc-oxblood); stroke: var(--doc-oxblood-text-inv); stroke-width: 1.5; }
.doc-t { fill: var(--fg); font: 700 17px var(--font-doc); }
.doc-d { fill: var(--fg-muted); font: 400 14px var(--font-doc); }
.doc-kind { fill: var(--fg-muted); font: 600 12px var(--font-doc); }
.doc-core-t { fill: var(--doc-on-accent); font: 760 24px var(--font-doc); font-variation-settings: "wdth" 75; }
.doc-core-d { fill: var(--doc-on-accent); font: 400 15px var(--font-doc); }
.doc-core-kind { fill: var(--doc-on-accent); font: 600 12px var(--font-doc); }
.doc-edge { fill: none; stroke: var(--slate-soft); stroke-width: 1.5; transition: stroke 140ms ease; }
.doc-edge-off { stroke-dasharray: 6 5; }
.doc-arrow { fill: var(--slate-soft); }
.doc-lbl { fill: var(--fg); font: 600 13px var(--font-doc); }
.doc-lbl-bg { fill: var(--bg-2); }
.doc-edge.is-hot { stroke: var(--doc-oxblood-text-inv); stroke-width: 2.25; marker-end: url("#doc-ah-hot"); }
.doc-arrow.is-hot, .doc-lbl.is-hot { fill: var(--doc-oxblood-text-inv); }
.doc-node { cursor: pointer; }
.doc-node:hover .doc-box, .doc-node:focus-visible .doc-box, .doc-node.is-hot .doc-box { fill: var(--doc-node-hot); stroke: var(--doc-oxblood-text-inv); }
.doc-node:focus { outline: none; }
.doc-node:focus-visible .doc-box { stroke-width: 3; }

/* Figure 1 as lists, shown instead of the drawing on narrow screens. The
   group rule repeats the legend: solid for professional, dashed for off it. */
.doc-ctx { display: none; padding: 16px; }
.doc-ctx-core { display: grid; gap: 2px; padding: 14px 16px 16px; font-size: 0.9375rem; color: var(--doc-on-accent); background: var(--doc-oxblood); border: 1.5px solid var(--doc-oxblood-text-inv); }
.doc-ctx-core span { font-size: 0.75rem; font-weight: 600; }
.doc-ctx-core b { font-size: 1.375rem; font-weight: 760; font-variation-settings: "wdth" 75; line-height: 1.15; }
.doc-ctx-group { margin-top: 20px; padding-left: 14px; border-left: 1.5px solid var(--slate-soft); }
.doc-ctx-off { border-left-style: dashed; }
.doc-ctx-head { margin-bottom: 8px; font-size: 0.8125rem; font-weight: 650; color: var(--fg-muted); }
.doc-ctx ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.doc-ctx a { display: grid; gap: 1px; padding: 10px 12px 12px; font-size: 0.875rem; line-height: 1.45; color: var(--fg-muted); text-decoration: none; background: var(--bg); border: 1.5px solid var(--line); }
.doc-ctx a span { font-size: 0.75rem; font-weight: 600; color: var(--steel-ink); }
.doc-ctx a b { font-size: 1rem; font-weight: 700; color: var(--fg); }
.doc-ctx a:hover, .doc-ctx a:focus-visible { color: var(--fg-muted); background: var(--doc-node-hot); border-color: var(--doc-oxblood-text-inv); }

/* ---- Career history, drawn to scale ---- */
.doc-plate { padding: clamp(20px, 3vw, 36px); border: 1px solid var(--rule); }
.doc-dims, .doc-years { display: grid; grid-template-columns: 14fr 6fr 3fr 2fr 2.67fr 1fr; }
.doc-dim { position: relative; height: 78px; border-left: 1px solid var(--slate-soft); font-variant-numeric: tabular-nums; }
.doc-dim-now { border-right: 1px dashed var(--line); }
.doc-ln { position: absolute; left: 1px; right: 1px; top: 48px; height: 1.5px; background: var(--slate-soft); transform-origin: left center; }

.doc-ln::before, .doc-ln::after {
  content: "";
  position: absolute;
  top: -4px;
  border-block: 4.75px solid transparent;
}

.doc-ln::before { left: 0; border-right: 9px solid var(--slate-soft); }
.doc-ln::after { right: 0; border-left: 9px solid var(--slate-soft); }
.doc-len { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font-size: clamp(0.875rem, 1.6vw, 1.375rem); font-weight: 650; font-variation-settings: "wdth" 80; white-space: nowrap; color: var(--fg-muted); }
.doc-dim-now .doc-len { left: auto; right: 0; transform: none; }
.doc-dim.is-on .doc-ln { background: var(--doc-oxblood-text-inv); }
.doc-dim.is-on .doc-ln::before { border-right-color: var(--doc-oxblood-text-inv); }
.doc-dim.is-on .doc-ln::after { border-left-color: var(--doc-oxblood-text-inv); }
.doc-dim.is-on .doc-len { color: var(--fg); }
.doc-axis { border-top: 3px solid var(--fg); }
.doc-years { padding-top: 8px; font-size: 0.8125rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-roles { list-style: none; padding: 0; margin-top: clamp(24px, 3vw, 32px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* The role being pointed at (the current role at rest) gets a tint and an
   oxblood top rule; its span on the drawing turns oxblood with it. Roles are
   not links, so they do not take the full oxblood fill. */
.doc-roles li { min-width: 0; padding: 14px 16px 18px; border-top: 1px solid var(--rule); transition: background-color 160ms ease; }
.doc-roles li.is-on { padding-top: 13px; background: var(--bg-2); border-top: 2px solid var(--accent-text); }
.doc-when { font-size: 0.8125rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-roles h3 { margin: 6px 0 2px; font-size: 1.0625rem; font-weight: 700; line-height: 1.25; font-variation-settings: "wdth" 86; }
.doc-org { margin-bottom: 10px; font-size: 0.9375rem; color: var(--fg-muted); }
.doc-roles p:last-child { font-size: 0.9375rem; line-height: 1.5; }

/* One motion moment: the dimension lines draw once on first view.
   JS adds .is-pre only when the plate starts below the fold and motion is
   allowed, so the resting state is always fully drawn. */
@media (prefers-reduced-motion: no-preference) {
  .doc-plate.is-pre .doc-ln { transform: scaleX(0); }
  .doc-plate.is-pre .doc-len, .doc-plate.is-pre .doc-years { opacity: 0; }
  .doc-plate.is-drawing .doc-ln { transition: transform 700ms cubic-bezier(0.5, 0, 0.2, 1); }
  .doc-plate.is-drawing .doc-len, .doc-plate.is-drawing .doc-years { transition: opacity 400ms ease; }
  .doc-plate.is-drawing .doc-dim:nth-child(2) > * { transition-delay: 160ms; }
  .doc-plate.is-drawing .doc-dim:nth-child(3) > * { transition-delay: 320ms; }
  .doc-plate.is-drawing .doc-dim:nth-child(4) > * { transition-delay: 440ms; }
  .doc-plate.is-drawing .doc-dim:nth-child(5) > * { transition-delay: 560ms; }
  .doc-plate.is-drawing .doc-dim:nth-child(6) > * { transition-delay: 680ms; }
}

/* ---- Measured results ---- */
.doc-scroll { overflow-x: auto; }
.doc-results { width: 100%; border-collapse: collapse; }
.doc-results th, .doc-results td { padding: 18px 16px 18px 0; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.doc-results thead th { padding: 10px 16px 10px 12px; font-size: 0.8125rem; font-weight: 600; color: var(--doc-cover-text); background: var(--doc-cover); border-bottom: 0; }
.doc-results thead th + th { padding-left: 0; }
.doc-results tbody th { width: 24%; padding-left: 12px; font-weight: 650; font-variation-settings: "wdth" 88; }
.doc-v { width: 12%; font-size: clamp(1.25rem, 2.4vw, 1.875rem); font-weight: 760; font-variation-settings: "wdth" 72; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-results .doc-g { width: 24%; min-width: 170px; padding-right: 32px; }
.doc-results thead th:nth-child(3) { padding-right: 32px; text-align: center; }
.doc-c { font-size: 0.9375rem; color: var(--fg-muted); }

/* Rows are not links, so hover is a quiet tint, not the oxblood fill that
   marks something you can follow. */
.doc-results tbody tr { transition: background-color 160ms ease; }
.doc-results tbody tr:hover { background: var(--bg-2); }

.doc-track { position: relative; display: block; height: 10px; background: var(--doc-track); }

/* Each figure states its real value once, as --to / --at on its track;
   the fill and the label both read it, so they cannot drift apart. */
.doc-track-org { --to: 90%; }
.doc-track-cov { --to: 93%; }
.doc-track-up { --at: 62%; }
.doc-fill { position: absolute; top: 0; bottom: 0; left: 0; width: var(--to, 100%); background: var(--slate); }
.doc-track-up b { position: absolute; top: -5px; bottom: -5px; left: var(--at); width: 2px; background: var(--doc-oxblood); }
.doc-ticks { position: absolute; top: 14px; left: 0; right: 0; display: block; font-size: 0.75rem; line-height: 1; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.doc-ticks-org span, .doc-ticks-cov span { left: var(--to); }
.doc-ticks-up span { left: var(--at); }
.doc-merge { display: flex; justify-content: center; align-items: center; gap: 10px; }
.doc-three { display: grid; gap: 3px; }
.doc-three i { display: block; width: 26px; height: 7px; background: var(--slate); }
.doc-to { position: relative; width: 30px; height: 1.5px; background: var(--slate); }
.doc-to::after { content: ""; position: absolute; right: -1px; top: -4px; border-block: 4.75px solid transparent; border-left: 8px solid var(--slate); }
.doc-one { display: block; width: 44px; height: 27px; background: var(--doc-oxblood); }
.doc-cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.doc-cells i { display: block; padding: 6px 0; overflow: hidden; font-size: 0.6875rem; font-style: normal; font-weight: 650; text-align: center; text-overflow: ellipsis; color: var(--doc-on-accent); background: var(--slate); }

/* ---- Decision records ---- */
.doc-adrs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(28px, 4vw, 56px); }
.doc-adr { padding: 16px 0 28px; border-top: 2px solid var(--fg); }
.doc-adr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.875rem; color: var(--fg-muted); }
.doc-adr-head span:first-child { font-weight: 650; color: var(--steel-ink); }
.doc-status { font-weight: 650; color: var(--accent-text); }
.doc-adr h3, .doc-ref h3, .doc-open h3 { font-size: 1.375rem; font-weight: 720; font-variation-settings: "wdth" 80; }
.doc-adr h3 { margin: 8px 0 14px; line-height: 1.2; }
.doc-adr dl { display: grid; gap: 10px; margin: 0; }
.doc-adr dl div { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 12px; }
.doc-adr dt { padding-top: 2px; font-size: 0.875rem; color: var(--fg-muted); }
.doc-adr dd { margin: 0; font-size: 0.9375rem; line-height: 1.55; }

/* ---- Reference builds ---- */
.doc-refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 4vw, 56px); }
.doc-frame { padding: 8px; border: 1px solid var(--doc-cover-rule); background: var(--doc-cover-2); }
.doc-frame img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.doc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.doc-pair span { position: relative; display: block; }
.doc-pair img { aspect-ratio: 3 / 4; }
.doc-pair span:first-child img { object-position: 58% 50%; }
.doc-pair span:last-child img { object-position: 38% 50%; }
.doc-pair small { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; font-size: 0.75rem; font-weight: 650; color: var(--doc-cover-text); background: var(--doc-cover); }
.doc-cap { margin-top: 10px; font-size: 0.875rem; color: var(--fg-muted); }
.doc-cap b { color: var(--fg); font-weight: 650; }
.doc-ref h3 { margin: 16px 0 6px; }
.doc-ref > p:not(.doc-cap) { max-width: 56ch; color: var(--fg-muted); }

/* ---- Writing and open items ---- */
.doc-two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 88px); }
.doc-posts { list-style: none; padding: 0; border-top: 1px solid var(--fg); }
.doc-posts li { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.doc-posts time { padding-top: 3px; font-size: 0.875rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-posts a { font-size: 1.1875rem; font-weight: 650; font-variation-settings: "wdth" 86; line-height: 1.3; text-decoration: none; }
.doc-posts a:hover { text-decoration: underline; }
.doc-posts p { margin-top: 4px; font-size: 0.9375rem; color: var(--fg-muted); }
.doc-open { padding: 20px 22px; border: 1px solid var(--rule); }
.doc-open .doc-adr-head { margin-bottom: 8px; }
.doc-open h3 { margin-bottom: 8px; }
.doc-open p { margin-bottom: 10px; font-size: 0.9375rem; }
.doc-q { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--fg-muted); }
.doc-q b { display: block; margin-bottom: 4px; font-weight: 600; color: var(--fg); }

/* ---- Footer ---- */
.doc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 32px; padding-block: 32px 36px; font-size: 0.9375rem; }
.doc-mail { font-size: clamp(1.25rem, 2.6vw, 1.75rem); font-weight: 720; font-variation-settings: "wdth" 80; text-decoration: none; }
.doc-end { color: var(--fg-muted); }

/* ==========================================================================
   INTERIOR PAGES ON THE DOCUMENT SHEET (D-13)
   Same sheet, desk, strip, and footer as the homepage. The cover is lighter:
   the strip and a page head, no document control.
   ========================================================================== */
.doc-nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent-text); text-decoration-thickness: 2px; }

.doc-head { padding-block: clamp(32px, 4vw, 48px) clamp(40px, 6vw, 64px); }
.doc-h1 { max-width: 22ch; font-size: clamp(2.25rem, 5.5vw, 4.5rem); font-weight: 740; font-variation-settings: "wdth" 72; line-height: 1; letter-spacing: -0.01em; text-wrap: balance; }
.doc-head .doc-subtitle { margin-top: 14px; }
.doc-lede { margin-top: clamp(20px, 3vw, 28px); max-width: 62ch; font-size: 1.125rem; line-height: 1.55; text-wrap: pretty; }
.doc-date { margin-top: 18px; font-size: 0.9375rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.doc-body { padding-block: clamp(44px, 6vw, 76px); }

/* ---- Index lists (Writing, Building, Home Lab) ---- */
.post-list { list-style: none; max-width: 980px; padding: 0; border-top: 1px solid var(--fg); }
.post-item article { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: 4px 24px; padding: 22px 0 24px; border-bottom: 1px solid var(--rule); }
.post-date { grid-row: 1 / span 2; padding-top: 4px; font-size: 0.9375rem; color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.post-item-title { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 650; font-variation-settings: "wdth" 86; line-height: 1.25; }
.post-item-title a { text-decoration: none; }
.post-item-title a:hover { text-decoration: underline; }
.post-excerpt { max-width: 64ch; color: var(--fg-muted); }

/* ---- Entry pages (posts, builds, lab notes) ---- */
.prose { max-width: 68ch; font-size: 1.125rem; line-height: 1.7; counter-reset: fig; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 2.2em; font-size: clamp(1.5rem, 2.6vw, 1.875rem); font-weight: 740; font-variation-settings: "wdth" 72; line-height: 1.1; }
.prose h3 { margin-top: 1.8em; font-size: 1.25rem; font-weight: 650; font-variation-settings: "wdth" 86; line-height: 1.25; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: 0.4em; }
.prose strong { font-weight: 650; }
.prose blockquote { margin-inline: 0; padding-left: 20px; border-left: 2px solid var(--accent-text); font-size: 1.1875rem; font-weight: 500; }
.prose code { padding: 0.1em 0.35em; font-family: var(--font-code); font-size: 0.85em; background: var(--bg-2); border: 1px solid var(--rule); }
.prose hr { margin-block: 2.2em; border: 0; border-top: 1px solid var(--rule); }

/* Photos in a figure sit in the homepage's dark frame and are numbered. */
.prose-figure { margin-block: 1.8em; counter-increment: fig; }
.prose-figure img { width: 100%; height: auto; padding: 8px; border: 1px solid var(--doc-cover-rule); background: var(--doc-cover-2); }
.prose-figure figcaption { margin-top: 10px; font-size: 0.875rem; line-height: 1.5; color: var(--fg-muted); }
.prose-figure figcaption::before { content: "Figure " counter(fig) ". "; font-weight: 650; color: var(--fg); }

.post-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; max-width: 68ch; margin-top: clamp(40px, 5vw, 56px); padding-top: 16px; border-top: 1px solid var(--fg); }
.page-back { font-weight: 600; }
.post-linkedin { color: var(--fg-muted); }

/* Placeholder pages show their status as an open item on the paper. */
.doc-wip { max-width: 640px; }
.doc-wip h2 { margin-bottom: 8px; font-size: 1.375rem; font-weight: 720; font-variation-settings: "wdth" 80; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (width <= 1180px) {
  .doc-toc ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .doc-toc li:nth-child(5) { border-left: 0; }
  .doc-toc li:nth-child(n+5) { border-top: 1px solid var(--rule); }
}

@media (width <= 960px) {
  .doc-control { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-control div:nth-child(4) { padding-left: 0; border-left: 0; }
  .doc-control div:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .doc-title, .doc-adrs, .doc-refs, .doc-two { grid-template-columns: minmax(0, 1fr); }
  .doc-portrait { order: -1; max-width: 200px; }
  .doc-roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-dim:nth-child(n+3) .doc-len { display: none; }
  .doc-sh p { grid-column: 2 / -1; text-align: left; }
  .doc-diagram svg { display: none; }
  .doc-ctx { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .doc-ctx-core { grid-column: 1 / -1; }
}

@media (width <= 560px) {
  body { padding: 6px; }
  .doc { box-shadow: none; }
  .doc-nav a { display: inline-block; padding-block: 6px; }

  /* On a phone, document control keeps Role, Location, and Status so the
     name reaches the first screen. Owner repeats the title; the rest is
     detail a phone visitor does not need before the name. */
  .doc-control { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-control div:nth-child(1), .doc-control div:nth-child(n+5) { display: none; }
  .doc-control div:nth-child(2) { grid-column: 1 / -1; }
  .doc-control div:nth-child(n) { padding-left: 0; border-left: 0; }
  .doc-control div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .doc-control div:nth-child(4) { padding-left: 14px; border-left: 1px solid var(--rule); }
  .doc-ctx { grid-template-columns: minmax(0, 1fr); }
  .doc-portrait { max-width: 150px; }
  .doc-portrait figcaption { display: none; }
  .doc-toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-toc li:nth-child(n) { border-left: 0; border-top: 1px solid var(--rule); }
  .doc-toc li:nth-child(even) { border-left: 1px solid var(--rule); }
  .doc-toc li:nth-child(-n+2) { border-top: 0; }
  .doc-roles { grid-template-columns: minmax(0, 1fr); }
  .doc-years span:nth-child(4), .doc-years span:nth-child(5) { visibility: hidden; }
  .doc-results thead { display: none; }
  .doc-results tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .doc-results th, .doc-results td { width: auto; padding: 0; border: 0; }
  .doc-results tbody th { width: auto; padding-left: 0; }
  .doc-results .doc-g { grid-column: 1 / -1; width: auto; min-width: 0; padding: 10px 0 22px; }
  .doc-merge { justify-content: flex-start; }
  .doc-c { grid-column: 1 / -1; padding-top: 4px; }
  .doc-adr dl div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .doc-posts li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .doc-pair img { aspect-ratio: 1 / 1; }
  .post-item article { grid-template-columns: minmax(0, 1fr); }
  .post-date { grid-row: auto; padding-top: 0; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
