/*
Theme Name: PMx Vidhya Quantitative
Theme URI: https://pmxvidhya.com
Author: Abhigyan Ravula, PhD
Description: Personal pharmacometrics site. Blue, white and gold; Chivo, Source Serif 4 and Chivo Mono; light first, dark by toggle.
Version: 1.5.0
License: GNU General Public License v2 or later
Text Domain: pmxvidhya-quant
Requires at least: 6.0
Requires PHP: 7.4
*/

/* =====================================================================
   Tokens
   Existing names are referenced by inline SVG inside published posts:
   change values freely, never rename or remove a token.
   Blue = evidence (links, efficacy). Gold = what is weighed (safety,
   the decision). White = space and type.
   ===================================================================== */

:root{
  color-scheme: light;
  --bg: #fcfcfd;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --ink: #0b1a3a;
  --text: #22304d;
  --text-dim: #4a5570;
  --text-faint: #667085;
  --accent: #1e47c9;
  --accent-strong: #15379e;
  --accent-soft: #e7edfc;
  --accent-ink: #ffffff;
  --risk: #8a6a1f;
  --risk-soft: #f5edd6;
  --decision: #8a6a1f;
  --line: #7f8aa0;
  --border: #e2e6ee;
  --band-fill: rgba(30, 71, 201, 0.08);
  --band-line: #1e47c9;
  --shadow: 0 1px 2px rgba(11, 26, 58, 0.05), 0 18px 40px -28px rgba(11, 26, 58, 0.28);
  --conn: #9aa4b8;
  --gold-rule: #b08a3a;
  --close-bg: #0b1a3a;
  --close-ink: #f6f4ee;
  --close-text: #c3cadb;
  --close-dim: #95a0b8;
  --close-accent: #a9c1ff;
  --close-line: #2a3a63;
  --muted: var(--text-dim);
  --faint: var(--text-faint);
  --line-soft: var(--border);

  --font-sans: "Chivo", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "Chivo Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --page-max: 1200px;
  --rail: 200px;
  --gutter: clamp(24px, 4vw, 64px);
  --nav-h: 68px;
  --admin-h: var(--wp-admin--admin-bar--height, 0px);
  --radius: 3px;

  --fs-hero: clamp(2.35rem, 1.2rem + 4.4vw, 4.4rem);
  --fs-h1: clamp(2rem, 1.35rem + 2.7vw, 3.2rem);
  --fs-h2: clamp(1.6rem, 1.2rem + 1.6vw, 2.35rem);
  --fs-lede: clamp(1.15rem, 1rem + 0.55vw, 1.375rem);
  --fs-read: 1.1875rem;
  --fs-body: 1rem;
  --fs-small: 0.9375rem;
  --fs-label: 0.8125rem;
  --fs-data: 0.75rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-std: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 150ms;
  --dur-base: 260ms;
  --dur-slow: 620ms;
  --dur-draw: 1200ms;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --bg: #0a0d14;
    --surface: #10141d;
    --surface-2: #161b26;
    --ink: #f2f1ec;
    --text: #d3d7df;
    --text-dim: #a3aab8;
    --text-faint: #858d9d;
    --accent: #8fb0ff;
    --accent-strong: #b6cbff;
    --accent-soft: #17213a;
    --accent-ink: #0a0d14;
    --risk: #d8b96e;
    --risk-soft: #2b2516;
    --decision: #d8b96e;
    --line: #5f6983;
    --border: #232938;
    --band-fill: rgba(143, 176, 255, 0.12);
    --band-line: #8fb0ff;
    --shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.75);
    --conn: #5e6780;
    --gold-rule: #a88c4e;
    --close-bg: #10141d;
    --close-ink: #f2f1ec;
    --close-text: #c7ccd6;
    --close-dim: #8d95a3;
    --close-accent: #8fb0ff;
    --close-line: #232938;
  }
}

:root[data-theme="dark"]{
  color-scheme: dark;
  --bg: #0a0d14;
  --surface: #10141d;
  --surface-2: #161b26;
  --ink: #f2f1ec;
  --text: #d3d7df;
  --text-dim: #a3aab8;
  --text-faint: #858d9d;
  --accent: #8fb0ff;
  --accent-strong: #b6cbff;
  --accent-soft: #17213a;
  --accent-ink: #0a0d14;
  --risk: #d8b96e;
  --risk-soft: #2b2516;
  --decision: #d8b96e;
  --line: #5f6983;
  --border: #232938;
  --band-fill: rgba(143, 176, 255, 0.12);
  --band-line: #8fb0ff;
  --shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.75);
  --conn: #5e6780;
  --gold-rule: #a88c4e;
  --close-bg: #10141d;
  --close-ink: #f2f1ec;
  --close-text: #c7ccd6;
  --close-dim: #8d95a3;
  --close-accent: #8fb0ff;
  --close-line: #232938;
}

/* =====================================================================
   Base
   ===================================================================== */

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

html{
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--admin-h) + 16px);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.45;
  padding-inline: clamp(20px, 5vw, 56px);
  font-kerning: normal;
  font-variant-ligatures: common-ligatures contextual;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3{
  font-family: var(--font-sans);
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
  font-weight: 700;
  letter-spacing: -0.015em;
}

p{ text-wrap: pretty; }
a{ color: inherit; }
img, svg{ max-width: 100%; }

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

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

.wrap{ max-width: var(--page-max); margin-inline: auto; }

.eyebrow{
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
}

.skip-link{ position: absolute; left: -9999px; }
.skip-link:focus{
  left: 12px; top: 12px; z-index: 100;
  background: var(--surface); color: var(--ink);
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
}

/* Text links inside prose: visible underline that strengthens on hover. */
.entry-content a,
.about-copy a,
.section-note a,
.archive-head a{
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: color var(--dur-fast) var(--ease-std), text-decoration-color var(--dur-fast) var(--ease-std);
}
.entry-content a:hover,
.about-copy a:hover,
.section-note a:hover,
.archive-head a:hover{
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

/* Diagrams were drawn with Archivo and IBM Plex attributes; map them onto
   the current faces without touching the markup or post content. */
svg [font-family*="Archivo"],
svg [font-family*="Plex Sans"]{ font-family: var(--font-sans); }
svg [font-family*="Plex Mono"]{ font-family: var(--font-mono); }
svg text[letter-spacing="0.18em"],
svg text[letter-spacing="0.2em"],
svg text[letter-spacing="0.16em"]{ letter-spacing: 0.1em; }
svg text[letter-spacing="1.5"],
svg text[letter-spacing="1.6"]{ letter-spacing: 0.1em; }

/* =====================================================================
   Header and navigation
   ===================================================================== */

/* Full-bleed band and hairline come from spread shadows, which never add
   scrollable overflow the way wide pseudo-elements do. */
.site-header{
  position: sticky;
  top: var(--admin-h);
  z-index: 50;
  background: var(--bg);
  box-shadow: 0 0 0 100vmax var(--bg), 0 1px 0 100vmax transparent;
  clip-path: inset(0 -100vmax -1px);
  transition: box-shadow var(--dur-base) var(--ease-std);
}
.site-header.is-scrolled{ box-shadow: 0 0 0 100vmax var(--bg), 0 1px 0 100vmax var(--border); }

nav.wrap{
  display: flex;
  align-items: center;
  gap: 16px 28px;
  min-height: var(--nav-h);
  flex-wrap: wrap;
}

.mark{
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.mark .sub{
  font-weight: 400;
  font-size: 0.8125rem;
  letter-spacing: 0;
  color: var(--text-faint);
}

.navlinks{
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: clamp(18px, 2.6vw, 32px);
  font-size: 0.9375rem;
  font-weight: 500;
}
.navlinks a{
  position: relative;
  text-decoration: none;
  color: var(--text-dim);
  padding-block: 8px;
  transition: color var(--dur-fast) var(--ease-std);
}
.navlinks a:hover,
.navlinks a.is-current{ color: var(--ink); }

.navlinks::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 2px;
  width: var(--ind-w, 0px);
  background: var(--accent);
  transform: translateX(var(--ind-x, 0px));
  opacity: var(--ind-o, 0);
  transition:
    transform 420ms var(--ease-out),
    width 420ms var(--ease-out),
    opacity var(--dur-base) var(--ease-std);
  pointer-events: none;
}

/* The narrow-screen menu button. Hidden above 720px, where every link is already on show. */
.nav-toggle{
  display: none;
  align-items: center;
  gap: 9px;
  padding: 8px 12px 8px 14px;
  flex: none;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std);
}
.nav-toggle:hover{ border-color: var(--line); color: var(--ink); }
.nav-toggle svg{ display: block; width: 17px; height: 17px; flex: none; }
.nav-toggle .close{ display: none; }
.nav-toggle[aria-expanded="true"]{ color: var(--ink); border-color: var(--line); }
.nav-toggle[aria-expanded="true"] .bars{ display: none; }
.nav-toggle[aria-expanded="true"] .close{ display: block; }

.theme-toggle{
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex: none;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std);
}
.theme-toggle:hover{ border-color: var(--line); color: var(--ink); }
.theme-toggle svg{
  position: absolute;
  inset: 0;
  margin: auto;
  width: 17px;
  height: 17px;
  transition: opacity var(--dur-base) var(--ease-std), transform 520ms var(--ease-out);
}
.theme-toggle .sun{ opacity: 0; transform: rotate(-90deg) scale(0.6); }
.theme-toggle .moon{ opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .sun{ opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .moon{ opacity: 0; transform: rotate(90deg) scale(0.6); }
@media (prefers-color-scheme: dark){
  :root:not([data-theme]) .theme-toggle .sun{ opacity: 1; transform: none; }
  :root:not([data-theme]) .theme-toggle .moon{ opacity: 0; transform: rotate(90deg) scale(0.6); }
}

/* =====================================================================
   Buttons
   ===================================================================== */

.cta-row{ display: flex; flex-wrap: wrap; gap: 12px; }

.pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition:
    background-color var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    color var(--dur-fast) var(--ease-std),
    transform var(--dur-fast) var(--ease-std);
}
.pill:active{ transform: translateY(1px); }
.pill.solid{ background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.solid:hover{ background: var(--accent-strong); border-color: var(--accent-strong); }
.pill.ghost{ background: transparent; border-color: var(--line); color: var(--ink); }
.pill.ghost:hover{ border-color: var(--ink); color: var(--accent); }

/* =====================================================================
   Homepage
   ===================================================================== */

.site-main{ max-width: var(--page-max); margin-inline: auto; }

section{ padding-block: clamp(52px, 6.5vw, 92px); }

/* ---------- Hero ---------- */
.hero{ padding-block: clamp(56px, 10vw, 136px) clamp(48px, 7vw, 88px); }
.hero-grid{ margin-inline: auto; }
.hero .eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
}
.hero .eyebrow::before{
  content: "";
  width: 32px;
  height: 1px;
  background: var(--gold-rule);
  flex: none;
}
.hero h1{
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.028em;
  max-width: 16ch;
  margin: 22px 0 26px;
}
.hero p.lede{
  font-family: var(--font-serif);
  font-size: var(--fs-lede);
  line-height: 1.45;
  color: var(--text);
  max-width: 62ch;
  margin: 0 0 36px;
}

/* ---------- Hero figure ----------
   The opening figure sits beside the copy on wide screens and stacks under it below
   1000px. Its marks use the validated chart steps rather than --accent directly, so the
   curve keeps its contrast against the page in both themes. */
.hero-copy{ min-width: 0; }
.hero-fig{ min-width: 0; margin-top: 44px; }

@media (min-width: 1000px){
  .hero-grid{
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
    column-gap: var(--gutter);
    align-items: center;
  }
  .hero-fig{ margin-top: 0; }
  .hero h1{ font-size: clamp(2.2rem, 1.1rem + 3.1vw, 3.5rem); }
  .hero p.lede{ font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem); max-width: 58ch; }
}

.hero-figure{
  --hf-line: #1e47c9;
  --hf-edge: rgba(30, 71, 201, 0.45);
  --hf-band: rgba(30, 71, 201, 0.13);
  margin: 0;
  min-width: 0;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}
:root[data-theme="dark"] .hero-figure{
  --hf-line: #5d86ea;
  --hf-edge: rgba(93, 134, 234, 0.5);
  --hf-band: rgba(93, 134, 234, 0.17);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .hero-figure{
    --hf-line: #5d86ea;
    --hf-edge: rgba(93, 134, 234, 0.5);
    --hf-band: rgba(93, 134, 234, 0.17);
  }
}
.hero-figure .hf-svg{ display: block; width: 100%; height: auto; }
.hero-figure .hf-tick{ font-family: var(--font-mono); font-size: 12px; fill: var(--text-faint); }
.hero-figure .hf-axis{ font-family: var(--font-sans); font-size: 13px; font-weight: 500; fill: var(--text-dim); }
/* SVG text is in user units, so it shrinks with the viewBox. On a phone the figure renders
   at about 0.63x, which would put these labels near 7px; raise them in user units so the
   axes stay readable. Above this width the figure is wide enough that 12px already lands
   between 11 and 16px on screen. */
@media (max-width: 539px){
  .hero-figure .hf-tick{ font-size: 18px; }
  .hero-figure .hf-axis{ font-size: 19px; }
}
.hero-figure .hf-key{
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 4px 0 0;
  padding: 0;
  font-size: var(--fs-label);
  color: var(--text-dim);
}
.hero-figure .hf-k{ display: inline-flex; align-items: center; gap: 9px; }
.hero-figure .hf-sw{ width: 22px; height: 0; border-top: 2.2px solid var(--hf-line); flex: none; }
.hero-figure .hf-sw.is-band{
  height: 11px;
  border: 0;
  background: var(--hf-band);
  box-shadow: inset 0 0 0 1px var(--hf-edge);
}
.hero-figure figcaption{
  margin-top: 14px;
  font-size: var(--fs-label);
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 62ch;
}
.hero-figure figcaption b{ font-weight: 600; color: var(--text-dim); }

/* The simulation parameters are documentation, not the point of the figure: available on
   demand, and not four lines of small print between the reader and the articles. */
.hf-assumptions{ margin-top: clamp(14px, 2vw, 20px); border-top: 1px solid var(--border); }
.hf-assumptions > summary{
  list-style: none;
  cursor: pointer;
  padding-top: 12px;
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text-dim);
  transition: color var(--dur-fast) var(--ease-std);
}
.hf-assumptions > summary::-webkit-details-marker{ display: none; }
.hf-assumptions > summary::after{
  content: "+";
  margin-left: 8px;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-faint);
}
.hf-assumptions[open] > summary::after{ content: "\2212"; }
.hf-assumptions > summary:hover{ color: var(--ink); }
.hf-assumptions figcaption{ border-top: 0; padding-top: 0; margin-top: 10px; }

/* ---------- Proof rail ---------- */
#proof{ padding: 0; }
.proof-rail{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--border);
}
.proof-rail li{
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px 22px;
  border-left: 1px solid var(--border);
}
.proof-rail li:first-child{ border-left: 0; padding-left: 0; }
.proof-rail b{
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}
.proof-rail span{ font-size: 0.875rem; line-height: 1.4; color: var(--text-dim); }

/* ---------- Section shell ---------- */
.site-main{ counter-reset: sec; }
.home .site-main > section[id]:not(#proof){ counter-increment: sec; }

.section-head{ margin-bottom: clamp(32px, 4vw, 48px); }
.section-head h2{
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 24ch;
  margin-top: 16px;
}
.section-head.is-flush{ margin-bottom: 0; }
.section-head.is-flush .section-note{ max-width: 56ch; margin-top: 10px; }
.section-note{
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text-dim);
  max-width: 58ch;
  margin: 16px 0 0;
}

.home .section-head .eyebrow{
  display: block;
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  padding-top: 12px;
  border-top: 1px solid var(--ink);
}
.home .section-head .eyebrow::before{
  content: counter(sec, decimal-leading-zero);
  font-family: var(--font-mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  margin-right: 12px;
}

@media (min-width: 1000px){
  /* :where() keeps these generic rules at class weight so the overrides below win. */
  .home .site-main > section:not(:where(#proof)) > .wrap{
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: var(--gutter);
    align-items: start;
  }
  .home .site-main > section:not(:where(#proof)) > .wrap > *{ grid-column: 2; }
  .home .section-head,
  .home .section-head > div:not(.cta-row){ display: contents; }
  .home .section-head .eyebrow{
    grid-column: 1;
    grid-row: 1 / span 40;
    align-self: start;
    position: sticky;
    top: calc(var(--nav-h) + var(--admin-h) + 32px);
  }
  .home .section-head .eyebrow::before{ display: block; margin: 0 0 6px; }
  .home .section-head h2{ grid-column: 2; margin-top: 0; }
  .home .section-head .section-note,
  .home .section-head .cta-row{ grid-column: 2; }
  .home .section-head + *{ margin-top: clamp(36px, 4vw, 52px); }
  .home #science .figure{ grid-column: 1 / -1; }
}

/* ---------- The figure ---------- */
.figure{ margin: 0; }
.pmxv-dose{
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 1px solid var(--ink);
  padding: clamp(14px, 2.6vw, 36px);
}
.pmxv-dose svg{ display: block; width: 100%; height: auto; }
.pmxv-dose svg > circle{ fill: var(--risk-soft); stroke: var(--decision); }
.pmxv-dose svg > text:nth-of-type(2){ fill: var(--decision); }
.figure figcaption{
  margin: clamp(14px, 2.4vw, 28px) 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text-dim);
  max-width: 64ch;
}

.dose-list{ display: none; }
@media (max-width: 639px){
  .pmxv-dose svg{ display: none; }
  .dose-list{
    display: block;
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .dose-list > li{
    display: grid;
    gap: 4px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    font-size: var(--fs-small);
    color: var(--text-dim);
  }
  .dose-list > li:first-child{ border-top: 0; padding-top: 0; }
  .dose-list .dl-k{
    font-family: var(--font-mono);
    font-size: var(--fs-data);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
  }
  .dose-list .dl-centre .dl-k,
  .dose-list .dl-risk .dl-k{ color: var(--decision); }
  .dose-list .dl-centre b{ font-size: 1.25rem; color: var(--ink); }
  .dose-list b{ color: var(--ink); font-weight: 600; }
}

/* ---------- Three questions ---------- */
.concept-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px clamp(24px, 3vw, 40px);
}
/* Seven topics: the first (MIDD, the one with notes) takes a full row so the
   other six fill whole rows at two columns and at three. */
@media (min-width: 600px){
  .concept-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .concept-grid > :first-child{ grid-column: 1 / -1; }
  .concept-grid > :first-child p{ max-width: 60ch; }
}
@media (min-width: 1000px){
  .concept-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.concept-grid + .cta-row{ margin-top: clamp(32px, 4vw, 48px); }
.concept{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  text-decoration: none;
  color: inherit;
}
.concept::before{
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-slow) var(--ease-out);
}
.concept .ctag{
  order: 2;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--accent);
}
.concept h3{
  order: 1;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  transition: color var(--dur-fast) var(--ease-std);
}
.concept p{ order: 3; margin: 0; font-size: var(--fs-small); color: var(--text-dim); flex-grow: 1; }
.concept .more{ order: 4; font-size: var(--fs-label); font-weight: 600; color: var(--accent); }
/* A topic with nothing published against it says so, and is not dressed up as a link. */
.concept .more.is-pending{
  font-family: var(--font-mono);
  font-size: var(--fs-data);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
a.concept:hover::before,
a.concept:focus-visible::before{ transform: scaleX(1); }
a.concept:hover h3{ color: var(--accent-strong); }
.concept.is-empty{ cursor: default; }
.concept.is-empty h3{ color: var(--text-dim); }

/* ---------- Case notes ---------- */
.applied-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}
.applied-card{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 36px 34px 0;
  border-bottom: 1px solid var(--border);
}
.applied-card:nth-child(2n){ padding: 28px 0 34px 36px; border-left: 1px solid var(--border); }
.applied-card > div{ display: contents; }
.applied-card .xtag{
  order: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--accent);
}
.applied-card .xtag::before{ content: ""; width: 6px; height: 6px; background: currentColor; }
.applied-card h3{
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.375rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  order: 1;
  margin: 0;
}
.applied-card .note{
  order: 3;
  margin-top: 10px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 20px;
  align-items: baseline;
}
.applied-card .note dt{
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0;
}
.applied-card .note dd{ margin: 0; font-size: var(--fs-small); line-height: 1.45; color: var(--text); }
.applied-card .note dt.is-outcome{ color: var(--decision); }
.applied-card .note dd.is-outcome{ color: var(--ink); font-weight: 600; }
.applied-card .note dd em{ font-style: italic; }

/* Three case notes read better as full-width ruled rows: the question, approach,
   uncertainty and decision entries run long, and two columns squeeze them. */
.applied-grid.is-trio{ grid-template-columns: minmax(0, 1fr); }
.applied-grid.is-trio .applied-card,
.applied-grid.is-trio .applied-card:nth-child(2n){
  padding: 30px 0 34px;
  border-left: 0;
}
.applied-grid.is-trio .applied-card:last-child{ border-bottom: 0; }
/* Full width would run the measure past 100 characters; hold it inside the house range. */
.applied-grid.is-trio .applied-card .note dd{ max-width: 74ch; }
.applied-grid.is-trio /* The homepage carries one example as a short teaser; the structured Question / Approach /
   Uncertainty / Decision notes live on /about/, where there is room for all three. */
.applied-grid.is-teaser{ grid-template-columns: minmax(0, 1fr); }
.applied-grid.is-teaser .applied-card{ padding: 0; border: 0; }
.applied-grid.is-teaser .applied-card p{ order: 3; margin: 0; max-width: 70ch; font-size: var(--fs-small); line-height: 1.5; color: var(--text-dim); }
.applied-grid.is-teaser .applied-card p em{ font-style: italic; }
.applied-grid.is-teaser .applied-card h3{ margin-bottom: 10px; }

.applied-src{ max-width: 74ch; }

/* Attribution under a case note: who did what, and where the public record is. */
.applied-src{
  order: 4;
  margin: 16px 0 0;
  font-size: var(--fs-label);
  line-height: 1.5;
  color: var(--text-faint);
}
.applied-src a{
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.applied-src a:hover{ color: var(--accent-strong); }
.applied-src i{ font-style: italic; }

/* ---------- Writing list ---------- */
/* The article index exists to show articles. One short heading, one sentence, then the list.
   `.archive-head` keeps the longer hub intros the topic pages rank on. */
.topic-filter{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 20px;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.topic-filter-label{
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.topic-filter a{
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-std);
}
.topic-filter a:hover{ color: var(--accent-strong); }
.topic-filter .topic-count{ font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-faint); }

.list-empty{ color: var(--text-dim); padding-block: 28px; }

.insight-list{ display: flex; flex-direction: column; border-top: 1px solid var(--ink); }
.insight{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding-block: 26px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.insight > div{ display: flex; flex-direction: column; }
.insight .cat{
  order: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  margin-bottom: 10px;
  font-size: var(--fs-label);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
/* Topic, date and reading time on one line, separated rather than punctuated in markup. */
.insight .cat > * + *::before{
  content: "\00B7";
  margin-right: 9px;
  color: var(--border);
}
.insight .cat .cat-topic{ font-weight: 600; color: var(--accent); }
.insight h3,
.insight h2{
  order: 1;
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
  transition: color var(--dur-fast) var(--ease-std);
}
.insight .dek{ order: 3; margin: 0; max-width: 64ch; font-size: var(--fs-small); color: var(--text-dim); }
.insight .arrow{
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    transform var(--dur-base) var(--ease-out),
    color var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    background-color var(--dur-fast) var(--ease-std);
}
.insight .arrow svg{ display: block; width: 18px; height: 18px; }
.insight:hover h3,
.insight:hover h2{ color: var(--accent-strong); }
.insight:hover .arrow{
  transform: translateX(4px);
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* Featured writing on the homepage: the same list, given more room. With a single
   published article it becomes one deliberate feature rather than a list of one. */
.insight-list.is-featured .insight{ padding-block: 30px; }
.insight-list.is-featured .insight h3,
.insight-list.is-featured .insight h2{ font-size: clamp(1.3rem, 1.05rem + 1vw, 1.75rem); }
.insight-list.is-single .insight h3,
.insight-list.is-single .insight h2{ font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2.1rem); }
.insight-list.is-single .insight .dek{ font-size: 1.0625rem; max-width: 60ch; }
#insights .cta-row{ margin-top: 30px; }

/* Start here (v1.5.0): the curated reading path. A numbered, ruled list on the same
   grid as the article rows, three columns at desktop, one below 760px. */
.path-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}
.path-step{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  padding: 26px 28px 30px 0;
  border-bottom: 1px solid var(--border);
}
.path-step + .path-step{ padding-left: 28px; border-left: 1px solid var(--border); }
.path-step:last-child{ padding-right: 0; }
.path-step > div{ display: flex; flex-direction: column; }
.path-num{
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1;
  color: var(--accent-ink);
  background: var(--accent);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.path-label{
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}
.path-step h3{
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.path-step h3 a{ color: inherit; text-decoration: none; transition: color var(--dur-fast) var(--ease-std); }
.path-step h3 a:hover{ color: var(--accent-strong); }
.path-step .dek{ margin: 0; font-size: var(--fs-small); color: var(--text-dim); max-width: 44ch; }
@media (max-width: 760px){
  .path-list{ grid-template-columns: 1fr; }
  .path-step,
  .path-step + .path-step,
  .path-step:last-child{ padding: 22px 0 24px; border-left: 0; }
}

/* Nav targets a heading inside the track grid, so it needs its own scroll offset. */
#publications, #midd, #capabilities, #standards{ scroll-margin-top: calc(var(--nav-h) + var(--admin-h) + 24px); }

/* ---------- Expertise ---------- */
/* ---------- Track record ---------- */
.track{
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
.timeline{ position: relative; padding-left: 30px; }
.timeline::before,
.timeline::after{
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline::after{ background: var(--accent); transform-origin: top; transform: scaleY(0); opacity: 0; }
.tl-item{ position: relative; padding-bottom: 32px; }
.tl-item:last-child{ padding-bottom: 0; }
.tl-item::before{
  content: "";
  position: absolute;
  z-index: 1;
  left: -30px;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.tl-item.past::before{ border-color: var(--line); }
.tl-years{
  font-family: var(--font-mono);
  font-size: var(--fs-data);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.tl-item.past .tl-years{ color: var(--text-faint); }
.tl-item h3{ font-size: 1.125rem; font-weight: 600; line-height: 1.3; margin: 6px 0 3px; }
.tl-org{ font-size: var(--fs-small); font-weight: 500; color: var(--text-dim); }
.tl-item p{ margin: 10px 0 0; font-size: var(--fs-small); color: var(--text-dim); max-width: 62ch; }

.track-side h3.side-title{ font-size: 1.0625rem; font-weight: 600; margin: 0 0 6px; }
.pubs{ list-style: none; margin: 0; padding: 0; }
.pubs li{ padding-block: 16px; border-bottom: 1px solid var(--border); }
.pubs .ptitle{
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-small);
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
}
.pubs .pmeta{ display: block; font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--text-faint); text-wrap: pretty; }

.key{
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
  color: var(--ink);
  font-weight: 600;
  padding: 0 1px;
}
.key.is-risk{ background: linear-gradient(transparent 62%, var(--risk-soft) 62%); }

/* ---------- About ---------- */
.about-grid{ max-width: none; }
.about-copy p{
  font-family: var(--font-serif);
  font-size: var(--fs-read);
  line-height: 1.45;
  color: var(--text);
  max-width: 64ch;
  margin: 0 0 1em;
}
.about-copy > p:first-child{ font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.4375rem); color: var(--ink); }
.home .about-copy > p:first-child{ font-size: var(--fs-read); color: var(--text); }
.facts{
  list-style: none;
  margin: 44px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 36px;
  border-top: 1px solid var(--ink);
}
.facts li{
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding-block: 14px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-small);
  color: var(--text-dim);
}
.facts li strong{
  padding-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.about-more{ margin: 28px 0 0; font-size: var(--fs-small); font-weight: 500; }
.about-more a{ color: var(--accent); text-decoration: none; }
.about-more a:hover{ color: var(--accent-strong); }
.coi-note{
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--gold-rule);
  max-width: 64ch;
  font-size: var(--fs-small);
  color: var(--text-dim);
}

/* The About page is ordinary page content, so these shared blocks land inside
   `.entry-content`, which sets the reading serif. Data blocks stay on the UI face. */
.entry-content .timeline,
.entry-content .applied-grid,
.entry-content .pubs,
.entry-content .facts,
.entry-content .coi-note{ font-family: var(--font-sans); }
.entry-content .timeline,
.entry-content .applied-grid,
.entry-content .pubs,
.entry-content .facts{ margin-bottom: 0; }
.entry-content .profile-section{ margin-top: clamp(48px, 6vw, 72px); }
.entry-content .profile-section > h2{
  margin: 0 0 clamp(20px, 2.5vw, 28px);
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.7rem);
  line-height: 1.15;
}
.entry-content .profile-section > h2::before{ content: none; }
.pmxv-page-about .article-wrap{ max-width: 58rem; }
.pmxv-page-about .facts{ margin-top: 0; }

/* A tool page states what it is and whether it currently runs. */
.status-note{
  margin: 0 0 2em;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--decision);
  background: var(--surface);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--text-dim);
}
.status-note strong{ color: var(--ink); }

/* ---------- Closing band: contact and footer ---------- */
#contact,
body > footer{
  background: var(--close-bg);
  box-shadow: 0 0 0 100vmax var(--close-bg);
  clip-path: inset(0 -100vmax);
  color: var(--close-text);
}
#contact{
  margin-top: clamp(24px, 4vw, 56px);
  padding-block: clamp(72px, 11vw, 144px) clamp(64px, 8vw, 104px);
}
.home #contact .section-head .eyebrow{ color: var(--close-ink); border-top-color: var(--close-ink); }
.home #contact .section-head .eyebrow::before{ color: var(--close-dim); }
#contact h2{
  color: var(--close-ink);
  font-size: clamp(2rem, 1.1rem + 3vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.024em;
  max-width: 20ch;
}
#contact .section-note{
  font-family: var(--font-serif);
  font-size: var(--fs-read);
  color: var(--close-text);
}
#contact .cta-row{ margin-top: 36px; }
#contact .pill.solid{ background: var(--close-ink); border-color: var(--close-ink); color: var(--close-bg); }
#contact .pill.solid:hover{ background: var(--close-accent); border-color: var(--close-accent); }
#contact .pill.ghost{ border-color: color-mix(in srgb, var(--close-ink) 38%, transparent); color: var(--close-ink); }
#contact .pill.ghost:hover{ border-color: var(--close-ink); color: var(--close-accent); }

body > footer{
  padding-block: 28px 48px;
  box-shadow: 0 0 0 100vmax var(--close-bg), 0 -1px 0 100vmax var(--close-line);
  clip-path: inset(-1px -100vmax 0);
}
.footer-grid{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}
.footer-copy{ font-size: 0.875rem; color: var(--close-dim); }
.footer-links{ display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 0.875rem; }
.footer-links a{
  color: var(--close-text);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size var(--dur-base) var(--ease-out), color var(--dur-fast) var(--ease-std);
}
.footer-links a:hover{ color: var(--close-ink); background-size: 100% 1px; }

/* =====================================================================
   Posts, pages, archives
   ===================================================================== */

.article-wrap{
  max-width: 45rem;
  margin-inline: auto;
  padding-block: clamp(48px, 8vw, 104px) clamp(64px, 8vw, 112px);
}
.article-head{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  margin-bottom: 44px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.article-head .cat{
  order: 2;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.article-head a.cat:hover{ color: var(--accent-strong); }
.article-head .cat:has(~ .article-meta)::after{ content: "\00B7"; margin-left: 12px; font-weight: 400; color: var(--text-faint); }
.article-head h1{
  order: 1;
  flex-basis: 100%;
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.024em;
  margin: 0 0 18px;
}
.article-meta{
  order: 3;
  margin: 0;
  font-size: var(--fs-label);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
/* Byline (v1.5.0): the author is the first thing after the title, so it reads darker
   than the dates around it. Separators are inline middots so the line wraps cleanly
   on phones without orphaning a dot. */
.article-byline{
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 4px;
  color: var(--text-dim);
}
.article-byline .byline-author{ color: var(--ink); font-weight: 600; }
.article-byline .byline-author a{ color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.article-byline .byline-author a:hover{ color: var(--accent-strong); border-bottom-color: currentColor; }
.article-byline .byline-sep{ color: var(--text-faint); }
.article-byline .byline-updated{ color: var(--text-faint); }
@media (max-width: 600px){
  /* The topic sits on its own line above the byline, so its trailing dot would dangle. */
  .article-head .cat:has(~ .article-meta)::after{ content: none; }
  .article-head .article-byline{ flex-basis: 100%; margin-top: 6px; }
}

.entry-content{
  font-family: var(--font-serif);
  font-size: var(--fs-read);
  line-height: 1.45;
  color: var(--text);
}
/* One flow rule for every direct child; element selectors below override it deliberately.
   Do not reintroduce `.entry-content p{margin:0}`: it outranks a sibling selector and
   silently collapses paragraph spacing. */
.entry-content > *{ margin-top: 0; margin-bottom: 1.1em; }
.entry-content > :first-child{ margin-top: 0; }
.entry-content > :last-child{ margin-bottom: 0; }
.entry-content h2,
.entry-content h3{ font-family: var(--font-sans); color: var(--ink); }
.entry-content h2{
  font-size: clamp(1.375rem, 1.2rem + 0.7vw, 1.625rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: 2.2em;
  margin-bottom: 0.6em;
}
.entry-content h3{ font-size: 1.1875rem; line-height: 1.3; margin-top: 1.8em; margin-bottom: 0.5em; }
/* A heading jumped to from the contents list must clear the sticky header. */
.entry-content h2[id],
.entry-content h3[id]{ scroll-margin-top: calc(var(--nav-h) + var(--admin-h) + 24px); }

/* ---------- Contents list on long posts ---------- */
/* The article head already closes with a rule, so this block opens without one. */
.pmxv-toc{
  padding: 0 0 22px;
  border-bottom: 1px solid var(--border);
}
.entry-content > .pmxv-toc{ margin-bottom: 2.4em; }
.entry-content .pmxv-toc-title{
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0 0 14px;
}
.pmxv-toc-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px 30px;
  counter-reset: pmxvtoc;
}
@media (min-width: 720px){
  .pmxv-toc-list{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.entry-content .pmxv-toc-list li{ counter-increment: pmxvtoc; margin: 0; }
.pmxv-toc-list li::before{
  content: counter(pmxvtoc, decimal-leading-zero);
  margin-right: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-data);
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.pmxv-toc-list a{
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--text);
  text-decoration: none;
}
.pmxv-toc-list a:hover{ color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.entry-content strong{ font-weight: 600; color: var(--ink); }
.entry-content ul,
.entry-content ol{ padding-left: 1.3em; }
.entry-content li{ margin-bottom: 0.45em; }
.entry-content li::marker{ color: var(--accent); font-family: var(--font-sans); }
.entry-content blockquote{
  margin: 1.6em 0;
  padding: 2px 0 2px 22px;
  border-left: 1px solid var(--line);
  color: var(--ink);
}
.entry-content code{
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 2px;
}
/* A long code line scrolls inside its own box; it never widens the page on a phone. */
.entry-content pre{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  font-size: 0.875rem;
  tab-size: 2;
}
.entry-content pre code{ white-space: pre; }
/* Same for a wide table: the figure scrolls, the article does not. */
.entry-content .wp-block-table,
.entry-content figure.wp-block-table{ max-width: 100%; overflow-x: auto; }
.entry-content pre code{ background: none; padding: 0; }
.entry-content img,
.entry-content svg{ max-width: 100%; height: auto; display: block; }
.entry-content figure{ margin: 2.2em 0; }
.entry-content figure img,
.entry-content figure svg{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.entry-content figcaption,
.entry-content .figure-caption{
  margin-top: 12px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--text-dim);
}
.entry-content .has-text-align-center{ text-align: center; }
.entry-content hr,
.entry-content .wp-block-separator{
  width: 100%;
  max-width: none;
  border: 0;
  border-top: 1px solid var(--border);
  opacity: 1;
  margin: 2.6em 0;
}
.entry-content table{
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
}
.entry-content th,
.entry-content td{ text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.entry-content th{
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.entry-content .pmxv-figure{
  margin: 2.4em 0;
  padding: 22px 22px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.entry-content .pmxv-figure svg{ width: 100%; height: auto; display: block; border: 0; border-radius: 0; background: none; }
.entry-content .pmxv-figure figcaption{ margin-top: 14px; max-width: 62ch; }

/* Post footer: onward links and author credit, appended by pmxv_seo_post_footer(). */
.entry-content .pmxv-more,
.entry-content .pmxv-author{
  margin-top: 3.2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
}
.entry-content .pmxv-more-title{
  margin: 0 0 0.9rem;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink);
}
.entry-content .pmxv-more-list{ list-style: none; margin: 0 0 1rem; padding: 0; }
.entry-content .pmxv-more-list li{ margin: 0 0 0.5rem; padding: 0; }
.entry-content .pmxv-more-hub{ color: var(--text-dim); }
/* Reading-path handoff (v1.5.0): the deliberately chosen next article, above the
   category siblings. Same rule as .pmxv-more so the three asides read as one block. */
.entry-content .pmxv-next{
  margin-top: 3.2rem;
  padding: 1.25rem 1.5rem 1.35rem;
  border-top: 1px solid var(--ink);
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
}
.entry-content .pmxv-next-label{ margin: 0 0 0.35rem; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.02em; color: var(--accent); }
.entry-content .pmxv-next-title{ margin: 0 0 0.4rem; font-size: 1.125rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.entry-content .pmxv-next-title a{ color: inherit; text-decoration: none; }
.entry-content .pmxv-next-title a:hover{ color: var(--accent-strong); }
.entry-content .pmxv-next-why{ margin: 0; color: var(--text-dim); max-width: 64ch; }
.entry-content .pmxv-next + .pmxv-more{ margin-top: 2.25rem; border-top-color: var(--border); }
.entry-content .pmxv-author{ margin-top: 2.25rem; border-top-color: var(--border); }
.entry-content .pmxv-author-name{ margin: 0 0 0.3rem; font-weight: 600; color: var(--ink); }
.entry-content .pmxv-author-bio{ margin: 0; color: var(--text-dim); max-width: 64ch; }

.article-foot{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-small);
}
.article-foot a{ color: var(--accent); font-weight: 600; text-decoration: none; }
.article-foot a:hover{ color: var(--accent-strong); }

/* Reading progress on posts, driven by scroll where supported. */
@supports (animation-timeline: scroll()){
  .single .site-main::before{
    content: "";
    position: fixed;
    z-index: 60;
    top: var(--admin-h);
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: pmxv-progress linear both;
    animation-timeline: scroll(root block);
    pointer-events: none;
  }
  @keyframes pmxv-progress{ to{ transform: scaleX(1); } }
}

.archive-head{ display: flex; flex-direction: column; max-width: 48rem; padding-block: clamp(48px, 8vw, 104px) 36px; }
.archive-head .eyebrow{ order: 2; align-self: flex-start; margin-top: 14px; }
.archive-head p{ order: 3; }
.archive-head h1{
  order: 1;
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.024em;
}
.archive-head p{
  font-family: var(--font-serif);
  font-size: var(--fs-read);
  color: var(--text);
  max-width: 60ch;
  margin: 20px 0 0;
}

/* The index's job is to show articles. A short heading and one sentence, so the first
   title lands in the opening screen; the topic hubs keep their longer ranking intro. */
.archive-head.is-compact{ padding-block: clamp(36px, 5vw, 64px) clamp(20px, 2.5vw, 28px); }
.archive-head.is-compact p{ font-family: var(--font-sans); font-size: 1.0625rem; color: var(--text-dim); margin-top: 14px; max-width: 64ch; }
.archive-guide{ order: 4; margin-top: 16px; font-family: var(--font-sans); font-size: var(--fs-small); font-weight: 500; }

main.wrap .insight-list{ margin-bottom: 24px; }

.pagination{ padding-block: 24px 72px; font-size: var(--fs-small); }
.pagination .nav-links{ display: flex; flex-wrap: wrap; gap: 8px; }
.pagination .page-numbers{
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-dim);
  transition: border-color var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std);
}
.pagination a.page-numbers:hover{ border-color: var(--line); color: var(--ink); }
.pagination .page-numbers.current{ background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* =====================================================================
   MIDD schematic page
   ===================================================================== */

/* Header, footer and page text stay on the site-wide 1200px grid; only the schematic's
   frame breaks out to 1330px so the diagram renders near full size. */
.page-template-page-midd .site-main{ max-width: 1330px; }
.midd-page{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1200px) minmax(0, 1fr);
}
.midd-page > *{ grid-column: 2; }
.midd-page > .figwrap{ grid-column: 1 / -1; }
.midd-page{ max-width: 1330px; margin-inline: auto; padding-block: clamp(48px, 8vw, 104px) clamp(64px, 8vw, 112px); }
.midd-page .top{ display: flex; flex-direction: column; gap: 18px; max-width: 48rem; margin: 0 0 48px; }
.midd-page .top .eyebrow{ order: 2; margin: 0; align-self: flex-start; }
.midd-page .top .dek{ order: 3; }
.midd-page .top h1{
  order: 1;
  font-size: clamp(2.2rem, 1.3rem + 3.2vw, 3.6rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.028em;
}
.midd-page .dek{
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--fs-lede);
  line-height: 1.45;
  color: var(--text);
  max-width: 60ch;
}

.midd-page .twin{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 920px;
  margin-bottom: 56px;
  border-top: 1px solid var(--ink);
}
.midd-page .twin > div{ padding: 20px 32px 8px 0; }
.midd-page .twin > div + div{ padding: 20px 0 8px 32px; border-left: 1px solid var(--border); }
.midd-page .twin .k{ margin-bottom: 8px; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }
.midd-page .twin p{ margin: 0; font-size: var(--fs-small); color: var(--text-dim); }
@media (max-width: 640px){
  .midd-page .twin{ grid-template-columns: 1fr; }
  .midd-page .twin > div,
  .midd-page .twin > div + div{ padding: 18px 0; border-left: 0; }
  .midd-page .twin > div + div{ border-top: 1px solid var(--border); }
}

.midd-page .figwrap{
  padding: clamp(8px, 1.4vw, 20px);
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.midd-page figure{ margin: 0; }
.midd-page svg.schematic{ display: block; min-width: 1180px; width: 100%; height: auto; }
.midd-page .scrollhint{
  display: none;
  margin: 0 0 10px;
  font-size: var(--fs-label);
  color: var(--text-faint);
}
/* Schematic labels drawn at 9.5 and 10.5 units read at about 10px once the SVG scales;
   raise them to ~11px effective. Phase meta lines switch to the narrower text face so
   they still fit their boxes, and the 4-unit side bars on each box are dropped. */
.midd-page svg.schematic text[font-size="9.5"],
.midd-page svg.schematic text[font-size="10.5"],
.midd-page svg.schematic text[font-size="11"]{ font-size: 11.5px; }
.midd-page svg.schematic text[font-size="9.5"][opacity="0.85"]{ font-family: var(--font-sans); letter-spacing: 0; }
.midd-page svg.schematic rect[width="4"]{ display: none; }
@media (max-width: 1250px){ .midd-page .scrollhint{ display: block; } }
@media (max-width: 899px){ .midd-page svg.schematic{ min-width: 1330px; } }

.midd-page .legend{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
  margin: 20px 2px 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.midd-page .lg{ display: inline-flex; align-items: center; gap: 10px; font-size: 0.875rem; color: var(--text-dim); }
.midd-page .sw{ width: 10px; height: 10px; border-radius: 1px; flex: none; }
.midd-page figcaption{
  margin: 18px 2px 0;
  max-width: 72ch;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  color: var(--text);
  text-align: left;
}

.midd-page h2{
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: clamp(72px, 9vw, 112px) 0 14px;
  max-width: 26ch;
}
.midd-page .sect-note{
  margin: 0 0 36px;
  max-width: 64ch;
  font-family: var(--font-serif);
  font-size: var(--fs-read);
  line-height: 1.45;
  color: var(--text);
}

.midd-page .cards{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}
.midd-page .card{ display: flex; flex-direction: column; gap: 14px; padding: 24px 28px 32px 0; }
.midd-page .card + .card{ padding: 24px 28px 32px; border-left: 1px solid var(--border); }
.midd-page .card:last-child{ padding-right: 0; }
.midd-page .c-head{ display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.midd-page .c-badge{
  order: 2;
  flex: none;
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: lowercase;
  color: var(--accent);
}
.midd-page .c-badge::first-letter{ text-transform: uppercase; }
.midd-page .c-title{ order: 1; font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.midd-page .q{
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--decision);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
}
.midd-page ul.pts{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.midd-page ul.pts li{ position: relative; padding-left: 16px; font-size: var(--fs-small); color: var(--text-dim); }
.midd-page ul.pts li::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  background: var(--accent);
}
.midd-page ul.pts code{ font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink); }
@media (max-width: 959px){
  .midd-page .cards{ grid-template-columns: 1fr; }
  .midd-page .card,
  .midd-page .card + .card,
  .midd-page .card:last-child{ padding: 24px 0 28px; border-left: 0; }
  .midd-page .card + .card{ border-top: 1px solid var(--border); }
}

.midd-page .closing{ margin-top: clamp(72px, 9vw, 112px); padding-top: 32px; border-top: 2px solid var(--ink); }
.midd-page .closing p{
  margin: 0;
  max-width: 64ch;
  font-family: var(--font-serif);
  font-size: var(--fs-lede);
  line-height: 1.45;
  color: var(--ink);
}
.midd-page .closing p + p{ margin-top: 16px; font-size: var(--fs-read); color: var(--text); }
.midd-page .closing strong{ font-weight: 600; }

/* References (v1.5.0): numbered sources for the page's regulatory and methodological
   claims, with in-text superscript links. */
.midd-page sup{ font-size: 0.7em; line-height: 0; vertical-align: super; }
.midd-page sup a{ color: var(--accent); text-decoration: none; font-weight: 600; }
.midd-page sup a:hover{ color: var(--accent-strong); }
.midd-page .refs{ margin-top: clamp(56px, 7vw, 88px); padding-top: 28px; border-top: 1px solid var(--border); }
.midd-page .refs h2{ margin-top: 0; font-size: 1.25rem; }
.midd-page .ref-list{ margin: 0; padding-left: 1.5rem; display: flex; flex-direction: column; gap: 12px; }
.midd-page .ref-list li{ font-size: var(--fs-small); line-height: 1.5; color: var(--text-dim); max-width: 78ch; scroll-margin-top: calc(var(--nav-h) + var(--admin-h) + 24px); }
.midd-page .ref-list li::marker{ font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.midd-page .ref-list a{ color: var(--accent); overflow-wrap: anywhere; }
.midd-page .ref-note{ margin: 20px 0 0; font-size: var(--fs-label); color: var(--text-faint); max-width: 70ch; }

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 999px){
  .home .section-head > div{ display: flex; flex-direction: column; padding-top: 14px; border-top: 1px solid var(--ink); }
  .home #contact .section-head > div{ border-top-color: var(--close-ink); }
  .home .section-head h2{ order: 1; margin-top: 0; }
  .home .section-head .eyebrow{ order: 2; margin-top: 10px; padding-top: 0; border-top: 0; font-weight: 500; color: var(--text-faint); }
  .home #contact .section-head .eyebrow{ color: var(--close-dim); }
  .home .section-head > div > .section-note{ order: 3; }
}

@media (max-width: 959px){
  .applied-grid{ grid-template-columns: 1fr; }
  .applied-card,
  .applied-card:nth-child(2n){ padding: 26px 0 30px; border-left: 0; }
  .track{ grid-template-columns: 1fr; }
  .facts{ grid-template-columns: 1fr; }
}

/* Tablet: the full link set plus the identity and the toggle only just fit on one row.
   Tighten the gaps rather than let the toggle wrap onto a line of its own. */
@media (min-width: 720px) and (max-width: 919px){
  nav.wrap{ column-gap: 18px; }
  .navlinks{ gap: 16px; font-size: 0.875rem; }
}

@media (max-width: 819px){
  .proof-rail{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof-rail li{ padding: 18px 20px 20px; }
  .proof-rail li:nth-child(odd){ border-left: 0; padding-left: 0; }
  .proof-rail li:nth-child(-n+2){ border-bottom: 1px solid var(--border); }
}

@media (max-width: 719px){
  .site-header{ position: relative; top: 0; }
  nav.wrap{ padding-block: 12px; gap: 12px; }
  /* Shorten the headline before shrinking it: three lines at 390px, not five. */
  .hero h1{ font-size: clamp(1.9rem, 1.35rem + 2.6vw, 2.15rem); max-width: 18ch; margin: 18px 0 20px; }
  /* The opening figure costs about 460px on a phone and pushes the first article title
     to y=1220. It keeps its place from tablet up, where it costs nothing vertically. */
  .hero-fig{ display: none; }
  .hero{ padding-block: 40px 36px; }
  /* Sections, not type, are where the page length is. */
  .home .site-main > section{ padding-block: 38px; }
  .section-head{ margin-bottom: 26px; }
  .nav-toggle{ display: inline-flex; order: 2; margin-left: auto; }
  .theme-toggle{ order: 3; margin-left: 0; }
  /* The links become a disclosure panel: hidden until the button says otherwise, so no
     link is parked off-screen behind a scroll the way the old swipe row left them. */
  .navlinks{
    order: 4;
    display: none;
    width: 100%;
    margin: 2px 0 6px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-top: 1px solid var(--border);
  }
  body.nav-open .navlinks{ display: flex; }
  .navlinks a{
    padding-block: 15px;
    font-size: 1rem;
    color: var(--ink);
    border-bottom: 1px solid var(--border);
  }
  .navlinks a:last-child{ border-bottom: 0; }
  .navlinks a.is-current{ color: var(--accent); }
  .navlinks::after{ display: none; }
  .hero .eyebrow{ flex-direction: column; align-items: flex-start; gap: 12px; }
  .insight{ grid-template-columns: 1fr; }
  .insight .arrow{ display: none; }
  .applied-card .note{ grid-template-columns: 1fr; gap: 2px; }
  .applied-card .note dd{ margin-bottom: 10px; }
  .applied-card .note dd:last-child{ margin-bottom: 0; }
}

@media (max-width: 539px){
  /* The brand subtitle wraps onto a second and third line here and pushes the header
     past 110px. The homepage eyebrow says the same thing, in the place it is read. */
  .mark .sub{ display: none; }
}

@media (max-width: 459px){
  .proof-rail{ grid-template-columns: 1fr; }
  .proof-rail li,
  .proof-rail li:nth-child(odd){ padding: 14px 0; border-left: 0; border-bottom: 1px solid var(--border); }
  .proof-rail li:last-child{ border-bottom: 0; }
  .facts li{ grid-template-columns: 1fr; gap: 4px; }
}

/* =====================================================================
   Motion
   Content is visible without JavaScript. footer.php marks elements with
   data-reveal only when motion is allowed and the element starts below
   the fold, then clears the attribute once it has arrived.
   ===================================================================== */

@view-transition{ navigation: auto; }
::view-transition-old(root),
::view-transition-new(root){
  animation-duration: 280ms;
  animation-timing-function: var(--ease-std);
}

@media (prefers-reduced-motion: no-preference){
  .hero .reveal{ animation: pmxv-rise 900ms var(--ease-out) both; }
  .hero .reveal.d1{ animation-delay: 90ms; }
  .hero .reveal.d2{ animation-delay: 190ms; }
  .hero .cta-row.reveal{ animation-delay: 300ms; }
  .hero .hero-fig.reveal{ animation: pmxv-fade 1000ms var(--ease-out) 380ms both; }

  [data-reveal]{
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition:
      opacity var(--dur-slow) var(--ease-out),
      transform var(--dur-slow) var(--ease-out);
    transition-delay: calc(var(--reveal-i, 0) * 70ms);
  }
  [data-reveal].is-in{ opacity: 1; transform: none; }

  @supports (animation-timeline: view()){
    .timeline::after{
      opacity: 1;
      animation: pmxv-draw-y linear both;
      animation-timeline: view();
      animation-range: entry 15% cover 60%;
    }
  }
}

@keyframes pmxv-rise{
  from{ opacity: 0; transform: translate3d(0, 18px, 0); }
  to{ opacity: 1; transform: none; }
}
@keyframes pmxv-fade{
  from{ opacity: 0; }
  to{ opacity: 1; }
}
@keyframes pmxv-draw-y{
  from{ transform: scaleY(0); }
  to{ transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce){
  @view-transition{ navigation: none; }
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media print{
  .site-header, body > footer, .theme-toggle, .single .site-main::before{ display: none !important; }
  #contact{ background: none; box-shadow: none; color: inherit; }
  [data-reveal]{ opacity: 1 !important; transform: none !important; }
}
