/* Every page under the homepage: Writing, Guides, About, the essays, the
   guides, the topic pages, the media kit and the 404. It carries the homepage's
   look (assets/home/home.css) to reading pages: the same menu and footer, the
   same column and three-column grid, one typeface, white, ink and one grey. The
   look is recorded in DESIGN.md in the James_Kerr_Personal_Site project.

   Two layouts, one rule. A page opens with its title at the left edge. Under
   it, each part is a row on the three columns: its heading or its notes in the
   first column, its content across the other two.

   The token names are the previous stylesheet's, so the guide tools' own CSS
   (assets/issue-tree-workshop.css) and scripts keep reading them. */

@font-face { font-family: "Mona Sans"; font-style: normal; font-weight: 200 900; font-stretch: 75% 125%; font-display: swap; src: url("/assets/fonts/mona-sans-latin.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --ink: #0f1115;
  --bg: #fff;
  --paper: #f4f4f5;        /* tile grey */
  --card: #fff;
  --muted: #5e6168;        /* reading grey, AA on white and on the tile grey */
  --soft: #5e6168;
  --line: #e4e4e7;         /* hairline between rows */
  --line-strong: #b9b9c0;  /* resting underline of a link */
  --field: #8a8c94;        /* outline of a control, 3:1 on white */
  --accent: var(--ink);    /* the page has no accent colour */
  --accent-ink: var(--ink);
  --wf-ember: #c9622a;     /* Wayfinder diagram grammar: AI doing a task only */
  --font-sans: "Mona Sans", "Helvetica Neue", Arial, sans-serif;
  --font-serif: var(--font-sans);
  --font-mono: var(--font-sans);
  --gutter: clamp(20px, 5vw, 72px);
  --column: 1120px;
  --gap: 12px;
  --radius: 6px;
  /* About 75 characters a line at each text size (the face averages 0.45em a character) */
  --measure: 36rem;        /* 17px reading text */
  --measure-text: 34rem;   /* 16px */
  --measure-small: 32rem;  /* 15px */
  --measure-fine: 30rem;   /* 14px */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #c9c9ce #fff; scroll-padding-top: 24px; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
::selection { background: var(--ink); color: #fff; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.012em; text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
ol, ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
strong { font-weight: 600; }

.skip-link { position: absolute; left: 12px; top: -80px; z-index: 20; padding: 10px 14px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; }
.skip-link:focus { top: 12px; }

.wrap { width: min(var(--column), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- the menu and the footer, as on the homepage ---------- */

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; padding-block: 20px; }
.mark { display: inline-flex; align-items: center; gap: 10px; padding: 6px 0; white-space: nowrap; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.star { width: 22px; height: 22px; flex: none; }
.bar nav { display: flex; gap: clamp(18px, 2.6vw, 34px); font-size: 15px; font-weight: 500; }
.bar nav a { padding: 11px 0; text-decoration: none; }
.bar nav a:hover, .bar nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.3em; }

.foot { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: baseline; padding-block: 22px 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot-line { display: flex; flex-wrap: wrap; gap: 4px 14px; font-variant-numeric: tabular-nums; }
.foot-motto { color: var(--ink); font-weight: 500; }
.foot-copy { text-align: right; }

/* ---------- the page ---------- */

.page { flex: 1 0 auto; padding-block: clamp(28px, 5vw, 64px) clamp(56px, 7vw, 96px); }

/* Inline links: a grey underline that turns to ink. Links that are a whole
   row or a whole tile drop it further down. */
.page a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.24em; text-decoration-color: var(--line-strong); transition: text-decoration-color 0.15s ease; }
.page a:hover { text-decoration-color: var(--ink); }

/* The title block: at the left edge, never wider than two of the three columns */
.doc-head, .home-hero, .doc-prose { max-width: calc((100% - 2 * var(--gap)) / 3 * 2 + var(--gap)); }
.doc-title, .hero-title { font-size: clamp(2rem, 4.4vw, 3.25rem); font-weight: 650; font-stretch: 108%; line-height: 1.03; letter-spacing: -0.035em; }
.hero-kicker { margin-top: 14px; color: var(--muted); font-size: 14px; }
.hero-subtitle, .doc-prose .lede { margin-top: 18px; max-width: 40rem; font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.45; }
.doc-prose p { margin-top: 14px; max-width: var(--measure-text); }
.doc-prose .lede { margin-top: 18px; max-width: 40rem; }
.essay-byline, .conditions { margin-top: 14px; color: var(--muted); font-size: 14px; }
.essay-hero-actions, .hero-actions, .doc-actions { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 10px; font-size: 15px; font-weight: 500; }
.essay-hero-actions a, .hero-actions a, .doc-actions a { padding: 8px 0; }
.hero-minimal > .profile-avatar { display: none; }
.guide-breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }

/* A row: one rule, the heading in the first column, the content in the others */
.block, .section { margin-top: clamp(36px, 4.6vw, 56px); padding-top: 18px; border-top: 1px solid var(--line); }
.block, .section > .container { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--gap); }
.block > .label, .section-header, .in-brief { grid-column: 1; padding-right: clamp(12px, 2vw, 28px); }
.block > :not(.label), .section > .container > :not(.section-header, .in-brief) { grid-column: 2 / -1; min-width: 0; }
.section > .container:not(:has(> .section-header, > .in-brief)) > * { grid-column: 1 / -1; }
/* The first row under the title opens with the ink rule */
.home-hero + .section, .doc-top + .block { margin-top: clamp(28px, 4vw, 48px); border-top-color: var(--ink); }

.block > .label, .section-title, .in-brief > h2, .essay-discovery > h2, .log-year { font-size: clamp(1.35rem, 1.9vw, 1.6rem); font-weight: 600; font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; }
.section-label, .essay-discovery-kicker { margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.section-sub, .block .note { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.block .note { margin-top: 0; max-width: var(--measure-text); color: var(--ink); font-size: 16px; line-height: 1.5; }

/* ---------- small parts ---------- */

/* A list's last row carries no rule, so it never doubles with the rule of the row after it */
.table > div:last-child, .signal-item:last-child, .bio-card:last-child, .answer-list > div:last-child, .faq-item:last-child, .page .essay-row:last-of-type, .log-row:last-child, .page .essay-related-link:last-child, .page .essay-topic-link:last-child { border-bottom: 0; padding-bottom: 0; }

/* A list of facts: a grey label and its value, a hairline under each */
.table > div, .signal-item { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 4px 16px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); }
.table > div:first-child, .signal-item:first-child { padding-top: 2px; }
.table dt, .signal-item span { color: var(--muted); font-size: 14px; }
.table dd, .signal-item strong { font-weight: 400; overflow-wrap: anywhere; }

/* Buttons share the tile's corner. The quiet one is an outline; the main one is ink. */
.linkish, .audit-button, .bio-card-heading button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--field); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 15px; font-weight: 500; text-decoration: none; transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease; }
.page a.audit-button { text-decoration: none; }
.linkish:hover, .audit-button:hover, .bio-card-heading button:hover { border-color: var(--ink); }
.audit-button--primary { min-height: 48px; padding: 0 22px; border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 600; }
.audit-button--primary:hover { background: #fff; color: var(--ink); }
.audit-button:disabled { cursor: not-allowed; opacity: 0.45; }

/* ---------- About ---------- */

/* The opening echoes the homepage: words across two columns, his photograph in the third */
.doc-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.doc-top-text { grid-column: span 2; padding-right: clamp(12px, 2vw, 28px); }
.doc-top .doc-head, .doc-top .doc-prose { max-width: none; }
.doc-portrait { overflow: hidden; border-radius: var(--radius); background: var(--paper); }
.doc-portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.context-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; font-size: 15px; font-weight: 500; }
.context-status { color: var(--muted); font-weight: 400; }

/* ---------- Writing: Start here + every entry, by year ---------- */

.start-here { margin-top: clamp(28px, 4vw, 44px); }
.start-here h2 { margin-bottom: 14px; font-size: clamp(1.35rem, 1.9vw, 1.6rem); font-weight: 600; font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.page .start-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--paper); text-decoration: none; }
.start-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 1px solid var(--line); }
.start-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 20px; flex: 1; }
.start-title { font-size: 1.05rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.012em; }
.start-card:hover .start-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.start-note { color: var(--muted); font-size: 14px; line-height: 1.45; }

.log { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--gap); margin-top: clamp(28px, 4vw, 48px); border-top: 1px solid var(--ink); }
.log-year { grid-column: 1; padding-top: 16px; }
.log-row { grid-column: 2 / -1; display: grid; grid-template-columns: 4.4rem minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--line); }
.log-date { color: var(--muted); font-size: 14px; white-space: nowrap; }
.page .log-title { font-size: 1.12rem; font-weight: 500; line-height: 1.35; letter-spacing: -0.012em; text-decoration: none; text-wrap: pretty; }
.page .log-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.log-note { margin-top: 4px; max-width: var(--measure-small); color: var(--muted); font-size: 15px; line-height: 1.45; }
.log-bearing { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }

/* ---------- Guides: left-rail 4-step Wayfinder framework + category carousels ---------- */

.wf-section { margin-top: clamp(22px, 3.2vw, 36px); }
.wf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-bottom: 14px; }

.wf-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wf-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 500; transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease; }
.wf-filter:hover { border-color: var(--field); color: var(--ink); }
.wf-filter.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }

/* Subtle editorial category colour tokens (WCAG AA on #fff and #f4f4f5) */
.wf-badge--tool, .wf-filter--tool { --cat-bg: #fae7dc; --cat-ink: #8f380e; --cat-dot: #c9622a; --cat-line: #e4ad8d; }
.wf-badge--playbook, .wf-filter--playbook { --cat-bg: #e2eef9; --cat-ink: #1b4774; --cat-dot: #2b6cb0; --cat-line: #a4c6e8; }
.wf-badge--breakdown, .wf-filter--breakdown { --cat-bg: #ece4f8; --cat-ink: #4e2b7d; --cat-dot: #7548be; --cat-line: #bfa8e6; }
.wf-badge--essay, .wf-filter--essay { --cat-bg: #e1f2e8; --cat-ink: #1a5437; --cat-dot: #297d54; --cat-line: #a2d4b9; }
.wf-badge--idea, .wf-filter--idea { --cat-bg: #e6e6eb; --cat-ink: #363941; --cat-dot: #686b73; --cat-line: #bfc0c8; }

.wf-filter--tool.is-active,
.wf-filter--playbook.is-active,
.wf-filter--breakdown.is-active,
.wf-filter--essay.is-active,
.wf-filter--idea.is-active { border-color: var(--cat-line); background: var(--cat-bg); color: var(--cat-ink); }

.wf-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 3px 9px; border-radius: 999px; background: var(--cat-bg); color: var(--cat-ink); font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: 0.005em; }
.wf-badge-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--cat-dot); flex: none; }

.wf-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: 13px; }
.wf-key-item { display: inline-flex; align-items: center; gap: 6px; }

.wf-rows { border-top: 1px solid var(--ink); }
.wf-row { display: grid; grid-template-columns: minmax(248px, 1fr) minmax(0, 2fr); gap: 0 clamp(24px, 3vw, 44px); align-items: start; padding: clamp(22px, 2.8vw, 32px) 0; border-bottom: 1px solid var(--line); scroll-margin-top: 28px; transition: opacity 0.18s ease; }
.wf-row:last-child { border-bottom: 0; padding-bottom: 0; }
.wf-row.is-empty { opacity: 0.45; padding-block: 16px; align-items: center; }
.wf-row.is-empty .wf-step-diagram, .wf-row.is-empty .wf-carousel-bar { display: none; }

.wf-step-rail { --wf-stone-bg: var(--bg); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wf-step-title { font-size: clamp(1.18rem, 1.55vw, 1.35rem); font-weight: 650; font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wf-step-q { margin-top: 3px; color: var(--muted); font-size: 14px; line-height: 1.35; }
.wf-step-diagram { width: 100%; max-width: 248px; }

.wf-svg { display: block; width: 100%; height: auto; aspect-ratio: 220 / 124; color: var(--ink); }
.wf-svg-label { font-family: var(--font-sans); font-size: 10.5px; fill: var(--muted); }
.wf-svg-label--ink { fill: var(--ink); font-weight: 500; }

.wf-carousel-col { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.wf-carousel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.wf-carousel-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.wf-carousel-controls { display: inline-flex; align-items: center; gap: 6px; }
.wf-carousel-controls[hidden] { display: none; }
.wf-carousel-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink); font-size: 14px; line-height: 1; transition: border-color 0.15s ease, background-color 0.15s ease, opacity 0.15s ease; }
.wf-carousel-btn:hover:not(:disabled) { border-color: var(--ink); background: var(--paper); }
.wf-carousel-btn:disabled { opacity: 0.28; cursor: default; }

.wf-carousel-wrap { position: relative; min-width: 0; }
.wf-carousel-wrap[hidden] { display: none; }
.wf-carousel-wrap::before, .wf-carousel-wrap::after { content: ""; position: absolute; top: 0; bottom: 0; width: 36px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.18s ease; }
.wf-carousel-wrap::before { left: 0; background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); }
.wf-carousel-wrap::after { right: 0; background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0)); }
.wf-carousel-wrap.has-more-left::before, .wf-carousel-wrap.has-more-right::after { opacity: 1; }

.wf-carousel-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; scroll-behavior: smooth; scrollbar-width: none; padding: 2px 2px 4px; }
.wf-carousel-track::-webkit-scrollbar { display: none; }
.wf-carousel-track:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }

.page .wf-card { flex: 0 0 276px; display: flex; flex-direction: column; min-height: 214px; padding: 18px 20px; border-radius: 8px; background: var(--paper); text-decoration: none; scroll-snap-align: start; transition: background-color 0.16s ease; }
.page .wf-card[hidden] { display: none; }
.page .wf-card:hover { background: #ececef; }
.wf-card-title { margin-top: 12px; font-size: 1.04rem; font-weight: 600; line-height: 1.28; letter-spacing: -0.014em; color: var(--ink); }
.page .wf-card:hover .wf-card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.wf-card-desc { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wf-card-go { margin-top: auto; padding-top: 16px; font-size: 14px; font-weight: 500; color: var(--ink); }
.wf-empty-note { color: var(--muted); font-size: 14px; }
.wf-empty-note[hidden] { display: none; }

/* Compact 4-step zoom-out strip on individual guide pages */
.guide-map-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 16px 0 0; padding: 8px 12px; border-radius: var(--radius); background: var(--paper); font-size: 13px; color: var(--muted); }
.page .guide-map-step { padding: 3px 8px; border-radius: 4px; text-decoration: none; color: var(--muted); }
.page .guide-map-step:hover { color: var(--ink); text-decoration: underline; }
.guide-map-step--current { background: #fff; border: 1px solid var(--ink); color: var(--ink); font-weight: 600; }
.page .guide-map-all { margin-left: auto; color: var(--ink); font-weight: 500; text-decoration: none; }
.page .guide-map-all:hover { text-decoration: underline; }

.writing-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.writing-step-tag { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.writing-item:only-child { grid-column: 1 / -1; }
.page .writing-link { display: flex; flex-direction: column; height: 100%; min-height: 220px; padding: 24px; border-radius: var(--radius); background: var(--paper); text-decoration: none; }
.writing-copy { display: flex; flex-direction: column; flex: 1; }
.writing-copy .essay-date { color: var(--muted); font-size: 14px; }
.writing-title { margin-top: 0; font-size: clamp(1.35rem, 1.9vw, 1.6rem); font-weight: 600; font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; }
.writing-copy .essay-date + .writing-title { margin-top: 10px; }
.writing-summary { margin-top: 8px; max-width: var(--measure-small); color: var(--muted); font-size: 15px; line-height: 22px; }
.writing-go { margin-top: auto; padding-top: 20px; font-size: 15px; font-weight: 500; }
.writing-link:hover .writing-go { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.3em; }

/* ---------- reading pages: essays, guides and the framework ---------- */

/* The notes stay beside the text while it scrolls */
.in-brief { grid-row: 1 / span 12; align-self: start; position: sticky; top: 24px; }
.in-brief-row { margin-top: 16px; }
.in-brief-row h3 { color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.in-brief-row p { margin-top: 2px; font-size: 15px; line-height: 1.45; }

.essay-foot.essay-canonical-note { max-width: var(--measure); margin-top: 4px; margin-bottom: 28px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.5; }
.essay-canonical-note p { max-width: var(--measure-fine); }
.essay-canonical-note strong { color: var(--ink); }

.essay-body { font-size: 17px; line-height: 1.65; }
.essay-body > :not(table, .table-scroll), p.essay-body { max-width: var(--measure); }
.essay-body > :first-child { margin-top: 0; }
.essay-body p + p, .essay-body p + ul, .essay-body p + ol, .essay-body ul + p, .essay-body ol + p { margin-top: 1.05em; }
.essay-body h2 { margin: 2em 0 0.55em; font-size: clamp(1.35rem, 1.9vw, 1.6rem); font-stretch: 108%; line-height: 1.2; letter-spacing: -0.02em; }
.essay-body h3 { margin: 1.7em 0 0.45em; font-size: 1.18rem; line-height: 1.3; }
.essay-body h4 { margin: 1.5em 0 0.4em; font-size: 1rem; }
.essay-body h2 strong, .essay-body h3 strong, .essay-body h4 strong { font-weight: inherit; }
.essay-body ul, .essay-body ol { padding-left: 1.3em; }
.essay-body ul { list-style: disc; }
.essay-body ol { list-style: decimal; }
.essay-body li { margin-top: 0.4em; }
.essay-body li::marker { color: var(--muted); }
.essay-body blockquote { margin: 1.5em 0; padding-left: 1.1em; border-left: 2px solid var(--ink); }
.essay-body blockquote p + p { margin-top: 0.6em; }
.essay-body img, .essay-body video { width: 100%; margin: 1.7em 0; border-radius: var(--radius); background: var(--paper); }
.essay-body hr { height: 1px; margin: 2.4em 0; border: 0; background: var(--line); }
.essay-body code { padding: 0.05em 0.35em; border-radius: 4px; background: var(--paper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
.essay-body small { color: var(--muted); font-size: 14px; }

.table-scroll { margin: 1.6em 0; overflow-x: auto; overscroll-behavior-inline: contain; }
.essay-body table { width: 100%; margin: 1.6em 0; border-collapse: collapse; border-top: 1px solid var(--ink); font-size: 15px; line-height: 1.45; }
.table-scroll table { margin: 0; }
.essay-body th, .essay-body td { padding: 11px 16px 11px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.essay-body thead th { color: var(--muted); font-size: 14px; font-weight: 400; }
.essay-body tbody th { width: 24%; font-weight: 600; }

/* A guide with no notes column reads from the left edge, under its title */
details.guide-intro { margin-top: 28px; }
.guide-intro summary { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 15px; font-weight: 500; cursor: pointer; }
.guide-intro[open] summary { margin-bottom: 14px; }
p.essay-body { margin-top: 20px; }

/* What to read next, and the closing line */
.essay-discovery { max-width: var(--measure); margin-top: clamp(44px, 5vw, 64px); padding-top: 18px; border-top: 1px solid var(--ink); }
.essay-discovery-group { margin-top: 22px; }
.essay-discovery-group > h3 { color: var(--muted); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.essay-topic-links, .essay-related-links { margin-top: 6px; }
.essay-discovery > .essay-topic-links { margin-top: 16px; }
.page .essay-topic-link, .page .essay-related-link { display: block; padding: 13px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.essay-topic-link span, .essay-related-link span { display: block; color: var(--muted); font-size: 14px; }
.essay-topic-link strong, .essay-related-link strong { display: block; font-size: 1.12rem; font-weight: 500; line-height: 1.35; letter-spacing: -0.012em; }
.essay-related-link > span:last-child { margin-top: 2px; max-width: var(--measure-small); font-size: 15px; line-height: 1.45; }
.essay-topic-link:hover strong, .essay-related-link:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.guide-handoff { max-width: var(--measure); margin-top: clamp(36px, 4vw, 48px); padding: 22px 24px; border-radius: var(--radius); background: var(--paper); }
.guide-handoff h2 { font-size: clamp(1.25rem, 1.6vw, 1.45rem); font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; }
.guide-handoff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.guide-handoff-heading { font-size: 14px; font-weight: 600; }
.guide-handoff-copy { margin-top: 4px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.page .guide-handoff-link { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 500; }
.essay-foot { max-width: var(--measure-small); margin-top: 28px; color: var(--muted); font-size: 15px; }
.essay-foot a { color: var(--ink); }

/* ---------- topic pages ---------- */

.prose-content:not(.essay-body) { max-width: var(--measure-text); }
.prose-content:not(.essay-body) p + p { margin-top: 12px; }
.prose-content + .answer-list { margin-top: 28px; }
.answer-list > div, .faq-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.answer-list > div:first-child, .faq-item:first-child { padding-top: 2px; }
.prose-content + .answer-list > div:first-child { padding-top: 16px; border-top: 1px solid var(--line); }
.answer-list span { display: block; color: var(--muted); font-size: 14px; }
.answer-list strong, .faq-item h3 { display: block; font-size: 1.12rem; font-weight: 500; line-height: 1.35; letter-spacing: -0.012em; }
.answer-list p, .faq-item p { margin-top: 6px; max-width: var(--measure-text); color: var(--muted); }

.page .essay-row { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr); gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.page .essay-row:first-of-type { padding-top: 2px; }
.essay-row .essay-date { color: var(--muted); font-size: 14px; white-space: nowrap; }
.essay-title-text { font-size: 1.12rem; font-weight: 500; line-height: 1.35; letter-spacing: -0.012em; }
.essay-row:hover .essay-title-text { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

/* ---------- media kit ---------- */

.bio-card { padding: 16px 0; border-bottom: 1px solid var(--line); }
.bio-card:first-child { padding-top: 0; }
.bio-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bio-card-heading span { color: var(--muted); font-size: 14px; }
.bio-card-heading button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.bio-card p { margin-top: 8px; max-width: var(--measure-text); }

.profile-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.profile-photo-card > a { display: block; overflow: hidden; border-radius: var(--radius); background: var(--paper); }
.profile-photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 20%; }
.profile-photo-card figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.profile-photo-card figcaption a { color: var(--ink); }

.media-link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.page .media-link-grid > a { display: flex; flex-direction: column; gap: 4px; padding: 20px 24px; border-radius: var(--radius); background: var(--paper); text-decoration: none; }
.media-link-grid span { color: var(--muted); font-size: 14px; }
.media-link-grid strong { font-size: 1.12rem; font-weight: 500; line-height: 1.35; letter-spacing: -0.012em; }
.media-link-grid > a:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }

.social-links-list { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 14px; font-size: 15px; font-weight: 500; }
.social-link-item { padding: 8px 0; }
.media-contact .section-title { max-width: 26rem; }
.media-contact .section-sub { max-width: var(--measure-small); }
.media-contact-button { justify-self: start; margin-top: 20px; }

/* ---------- the audit studio (full-width single-screen workbench) ---------- */

.section--tool { margin-top: clamp(24px, 3.2vw, 36px); padding-top: 20px; border-top-color: var(--ink); }
.audit-tool { width: 100%; max-width: none; margin-bottom: 0; padding: clamp(18px, 2.4vw, 26px); border-radius: 10px; background: var(--paper); }
.audit-tool-intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.audit-tool-intro h2 { font-size: clamp(1.2rem, 1.6vw, 1.4rem); font-stretch: 108%; line-height: 1.15; letter-spacing: -0.02em; }
.audit-tool-intro > .audit-privacy { margin-top: 0; color: var(--muted); font-size: 13px; }
.audit-tool-intro > .audit-privacy strong { color: var(--ink); font-weight: 500; }

.audit-studio { display: grid; gap: 14px; margin-top: 14px; }
.audit-studio-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.audit-studio-status { color: var(--muted); font-size: 13.5px; }
.audit-studio-head-actions { display: inline-flex; align-items: center; gap: 6px; }
.audit-mini-btn { min-height: 30px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; transition: border-color 0.15s ease, background-color 0.15s ease; }
.audit-mini-btn[hidden] { display: none; }
.audit-mini-btn:hover { border-color: var(--ink); background: var(--paper); }

.audit-workbench { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }

.audit-map-card { display: flex; flex-direction: column; justify-content: space-between; padding: 14px 16px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.audit-map-stage { touch-action: none; user-select: none; }
.amap-svg { display: block; width: 100%; height: auto; font-family: var(--font-sans); cursor: crosshair; }
.amap-q-title { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; }
.amap-q-title--compounding { fill: #1a5437; }
.amap-q-title--willingness { fill: #8f380e; }
.amap-q-title--theatre { fill: #4e2b7d; }
.amap-q-title--leave { fill: #52555e; }
.amap-q-hint { font-size: 11px; fill: #6c6f78; }
.amap-tick { font-size: 11px; fill: #7c7f87; font-variant-numeric: tabular-nums; }
.amap-axis { font-size: 11.5px; fill: var(--muted); font-weight: 500; }
.amap-empty { font-size: 13px; fill: var(--muted); }
.amap-dot { cursor: grab; outline: none; }
.amap-dot:active { cursor: grabbing; }
.amap-dot-circle { transition: transform 0.14s ease; }
.amap-dot:hover .amap-dot-circle { transform: scale(1.08); }
.amap-dot-focus { fill: none; stroke: var(--ink); stroke-opacity: 0.25; stroke-width: 2; }
.amap-dot-halo { fill: var(--wf-ember); fill-opacity: 0.18; }
.amap-dot--measured .amap-dot-circle,
.amap-dot--repeated .amap-dot-circle { fill: var(--wf-ember); stroke: #fff; stroke-width: 1.5; }
.amap-dot--measured .amap-dot-num,
.amap-dot--repeated .amap-dot-num { fill: #fff; font-size: 12px; font-weight: 650; }
.amap-dot--provisional .amap-dot-circle { fill: #fff; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 3 2.2; }
.amap-dot--provisional .amap-dot-num { fill: var(--ink); font-size: 12px; font-weight: 650; }
.amap-dot-label { font-size: 11.5px; fill: #3f424a; font-weight: 500; }
.amap-dot-label.is-active { fill: var(--ink); font-weight: 650; }

.audit-map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.audit-map-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.amap-drag-tip { margin-left: auto; color: var(--muted); }
.amap-swatch { width: 10px; height: 10px; border-radius: 999px; display: inline-block; flex: none; }
.amap-swatch--proven { background: var(--wf-ember); }
.amap-swatch--provisional { background: #fff; border: 1.5px dashed var(--ink); }

/* Single right-hand inspector card (no repeated lists) */
.audit-inspector { display: flex; flex-direction: column; border-radius: 8px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.audit-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafafa; }
.audit-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 9px 0 5px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 500; max-width: 158px; transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease; }
.audit-tab:hover { border-color: var(--ink); color: var(--ink); }
.audit-tab.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }
.audit-tab--add { padding: 0 10px; border-style: dashed; color: var(--ink); }
.audit-tab-dot { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 999px; font-size: 11px; font-weight: 650; flex: none; font-variant-numeric: tabular-nums; }
.audit-tab-dot--proven { background: var(--wf-ember); color: #fff; }
.audit-tab-dot--provisional { background: #fff; border: 1.5px dashed var(--ink); color: var(--ink); }
.audit-tab-dot--empty { background: var(--paper); color: var(--muted); }
.audit-tab.is-active .audit-tab-dot--provisional { border-color: #fff; background: transparent; color: #fff; }
.audit-tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.audit-inspector-body { display: flex; flex-direction: column; gap: 13px; padding: 15px 16px 16px; flex: 1; }
.audit-inline-top { display: flex; align-items: flex-end; gap: 8px; }
.audit-inline-name { flex: 1; display: grid; gap: 4px; min-width: 0; }
.audit-inline-name > span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.audit-inline-name input { width: 100%; min-height: 38px; padding: 7px 11px; border: 1px solid var(--field); border-radius: var(--radius); background: #fff; font-size: 15px; font-weight: 500; }
.audit-remove-btn { min-height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.audit-remove-btn:hover { border-color: var(--ink); color: var(--ink); }

.audit-control-group { display: grid; gap: 5px; min-width: 0; }
.audit-control-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.audit-control-label { color: var(--ink); font-size: 13.5px; font-weight: 600; }
.audit-control-meaning { color: var(--muted); font-size: 12.5px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.audit-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.audit-seg-btn { min-height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 550; font-variant-numeric: tabular-nums; transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease; }
.audit-seg-btn:hover { border-color: var(--ink); background: var(--paper); }
.audit-seg-btn.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }

.audit-ev-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.audit-ev-btn { min-height: 34px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 500; transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease; }
.audit-ev-btn:hover { border-color: var(--ink); color: var(--ink); }
.audit-ev-btn.is-active { border-color: var(--ink); background: var(--ink); color: #fff; }

/* Instant colour-coded verdict card inside the inspector */
.audit-verdict { margin-top: auto; padding: 13px 14px; border-radius: 8px; border: 1px solid var(--line); display: grid; gap: 7px; }
.audit-verdict--compounding { background: #eef7f2; border-color: #c2e0ce; }
.audit-verdict--willingness { background: #fdf4ee; border-color: #eed0bd; }
.audit-verdict--theatre { background: #f5f0fa; border-color: #d9caf0; }
.audit-verdict--leave { background: #f4f4f6; border-color: #dcdce2; }
.audit-verdict-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.audit-verdict-status { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.audit-verdict-action { font-size: 13.5px; line-height: 1.45; color: var(--ink); }

.audit-q-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.audit-q-pill--compounding { background: #d6eedf; color: #1a5437; }
.audit-q-pill--willingness { background: #f7dfd0; color: #8f380e; }
.audit-q-pill--theatre { background: #e6dbf5; color: #4e2b7d; }
.audit-q-pill--leave { background: #e4e4ea; color: #363941; }

.audit-optional { padding-top: 4px; }
.audit-optional-toggle { border: 0; background: transparent; padding: 2px 0; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.audit-optional-toggle:hover { color: var(--ink); text-decoration: underline; }
.audit-optional-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.audit-optional-fields[hidden] { display: none; }

/* Compact single bottom footer bar + optional expandable full verdict list */
.audit-footer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.audit-results { flex: 1 1 320px; min-width: 0; }
.audit-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.audit-bar-metrics { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.audit-bar-metrics strong { color: var(--ink); font-weight: 650; }
.audit-bar-summary { color: var(--muted); font-size: 14px; }
.audit-all-toggle { border: 0; background: transparent; padding: 2px 0; color: var(--ink); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-color: var(--line-strong); }
.audit-all-toggle:hover { text-decoration-color: var(--ink); }

.audit-all-list { display: grid; gap: 8px; margin-top: 12px; width: 100%; }
.audit-all-list[hidden] { display: none; }
.audit-table-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); cursor: pointer; }
.audit-table-row.is-active { border-color: var(--ink); }
.audit-table-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.audit-table-main strong { font-size: 14px; color: var(--ink); }
.audit-table-main span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.audit-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 999px; font-size: 12px; font-weight: 650; flex: none; font-variant-numeric: tabular-nums; }
.audit-num--proven { background: var(--wf-ember); color: #fff; }
.audit-num--provisional { background: #fff; border: 1.5px dashed var(--ink); color: var(--ink); }

/* Native no-JS fallback form stays clean if JS is off */
.audit-form { display: grid; gap: var(--gap); margin-top: 18px; }
.audit-form[hidden] { display: none; }
.audit-workflow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; border: 0; border-radius: var(--radius); background: #fff; }
.audit-workflow[hidden], .audit-button[hidden] { display: none; }
.audit-workflow legend { float: left; width: 100%; grid-column: 1 / -1; font-size: 15px; font-weight: 600; }
.audit-field { display: grid; align-content: start; gap: 4px; min-width: 0; }
.audit-field--wide { grid-column: 1 / -1; }
.audit-field > span { color: var(--muted); font-size: 12.5px; }
.audit-field input, .audit-field select { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--field); border-radius: var(--radius); background: #fff; font-size: 14px; }
.audit-field input::placeholder { color: var(--muted); opacity: 1; }
.audit-actions, .audit-export-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.audit-export-actions .audit-button { min-height: 36px; padding: 0 13px; font-size: 13.5px; }
.audit-caveat { margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* ---------- the 404 ---------- */

.bearings { max-width: var(--measure); margin-top: clamp(28px, 4vw, 48px); padding-top: 14px; border-top: 1px solid var(--ink); }
.bearings dt { color: var(--ink); font-size: 16px; font-weight: 500; }
.bearings dd { color: var(--muted); }

/* ---------- narrower screens ----------
   Under 1000px the three columns are too narrow for a heading beside its
   content, so each row stacks: heading, then content. */

@media (max-width: 999px) {
  .doc-head, .home-hero, .doc-prose { max-width: none; }
  .block, .section > .container, .log { grid-template-columns: minmax(0, 1fr); }
  .block > .label, .section-header, .in-brief, .log-year,
  .block > :not(.label), .section > .container > :not(.section-header, .in-brief), .log-row { grid-column: 1; }
  .block > .label, .section-header { margin-bottom: 16px; padding-right: 0; }
  .in-brief { grid-row: auto; position: static; margin-bottom: 28px; padding: 0 0 20px; border-bottom: 1px solid var(--line); }
  .in-brief-row p { max-width: var(--measure-small); }
  .log-year { padding-top: 28px; }
  .log-year:first-child { padding-top: 16px; }
  .doc-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-top-text { grid-column: span 1; }
  .wf-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .wf-step-rail { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .wf-step-diagram { width: 176px; max-width: none; flex: none; }
  .audit-workbench { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 699px) {
  .doc-top { grid-template-columns: minmax(0, 1fr); row-gap: 24px; }
  .doc-top-text { padding-right: 0; }
  .doc-portrait img { aspect-ratio: 4 / 3; object-position: 50% 30%; }
  .profile-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-grid, .writing-list, .media-link-grid, .guide-handoff-grid, .audit-workflow { grid-template-columns: minmax(0, 1fr); }
  .wf-step-diagram { width: 156px; }
  .page .wf-card { flex: 0 0 min(82vw, 286px); min-height: 204px; padding: 16px 18px; }
  .guide-map-all { margin-left: 0; }
  .audit-field--wide { grid-column: auto; }
  .audit-optional-fields { grid-template-columns: minmax(0, 1fr); }
  .audit-ev-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amap-drag-tip { margin-left: 0; }
  .audit-table-row { flex-wrap: wrap; }
  .table > div, .signal-item { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .essay-body table { display: block; overflow-x: auto; }
  .essay-body th, .essay-body td { min-width: 9rem; }
  .foot { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .foot-copy { text-align: left; }
}

/* ---------- moving between pages ---------- */

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

@media print {
  .bar, .foot, .skip-link, .audit-form, .audit-export-actions, .audit-studio-head, .audit-inspector, .audit-all-toggle, .in-brief, .essay-discovery, .guide-handoff { display: none !important; }
  .page { padding-block: 0; }
  .audit-tool { padding: 0; background: none; }
  .audit-workbench { grid-template-columns: minmax(0, 1fr); }
  .audit-all-list[hidden] { display: grid !important; }
  .audit-table-row { break-inside: avoid; }
  .page a { text-decoration: none; }
  /* Printing the audit prints the map and verdicts, not the long-form guide below */
  .section--tool ~ #guide { display: none !important; }
}
