/* ==========================================================================
   Pikkola Journal — warm paper editorial theme
   Light by default, warm graphite dark mode. No external fonts.
   ========================================================================== */

:root {
  color-scheme: light;

  --paper: #fbfbfa;
  --paper-2: #f6f5f1;
  --paper-3: #f1f0eb;
  --surface: #ffffff;
  --ink: #1d1c1a;
  --ink-2: #4b4741;
  --ink-3: #7a746a;
  --ink-4: #9a948a;
  --line: #e8e6e1;
  --line-2: #dcd9d2;
  --line-3: #cfcbc2;

  --accent: #b4522b;
  --accent-ink: #8f3f1f;
  --accent-soft: #f6ebe3;
  --accent-line: #e6c9b8;

  --tip-bg: #eef0e6;
  --tip-line: #d9dec7;
  --tip-ink: #4d5738;
  --note-bg: #eceff3;
  --note-line: #d5dce5;
  --note-ink: #3c4a5c;
  --warn-bg: #fbf0e0;
  --warn-line: #edd9bb;
  --warn-ink: #6f4a1c;

  --code-bg: #f3f2ed;
  --code-bar: #ecebe4;
  --code-ink: #2c2a26;

  --shadow-sm: 0 1px 2px rgba(29, 28, 26, .04), 0 1px 1px rgba(29, 28, 26, .03);
  --shadow-md: 0 6px 24px -12px rgba(29, 28, 26, .16), 0 2px 6px -3px rgba(29, 28, 26, .08);
  --shadow-lg: 0 24px 60px -32px rgba(29, 28, 26, .26);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 44rem;
  --wide: 68rem;
}

[data-theme="dark"] {
  color-scheme: dark;

  --paper: #191918;
  --paper-2: #1e1e1c;
  --paper-3: #232320;
  --surface: #202020;
  --ink: #ece9e2;
  --ink-2: #c2bcb0;
  --ink-3: #948e83;
  --ink-4: #7a746a;
  --line: #2c2c29;
  --line-2: #383835;
  --line-3: #46463f;

  --accent: #e18a5c;
  --accent-ink: #eda57e;
  --accent-soft: #2c211b;
  --accent-line: #4a3327;

  --tip-bg: #20261c;
  --tip-line: #313a28;
  --tip-ink: #c3cdae;
  --note-bg: #1d2229;
  --note-line: #2b3441;
  --note-ink: #b5c3d4;
  --warn-bg: #2a2217;
  --warn-line: #3f3220;
  --warn-ink: #e0c396;

  --code-bg: #161615;
  --code-bar: #1d1d1b;
  --code-ink: #ddd8cd;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 28px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -40px rgba(0, 0, 0, .8);
}

/* System dark preference before the toggle has run (no flash on first paint). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;

  --paper: #191918;
  --paper-2: #1e1e1c;
  --paper-3: #232320;
  --surface: #202020;
  --ink: #ece9e2;
  --ink-2: #c2bcb0;
  --ink-3: #948e83;
  --ink-4: #7a746a;
  --line: #2c2c29;
  --line-2: #383835;
  --line-3: #46463f;

  --accent: #e18a5c;
  --accent-ink: #eda57e;
  --accent-soft: #2c211b;
  --accent-line: #4a3327;

  --tip-bg: #20261c;
  --tip-line: #313a28;
  --tip-ink: #c3cdae;
  --note-bg: #1d2229;
  --note-line: #2b3441;
  --note-ink: #b5c3d4;
  --warn-bg: #2a2217;
  --warn-line: #3f3220;
  --warn-ink: #e0c396;

  --code-bg: #161615;
  --code-bar: #1d1d1b;
  --code-ink: #ddd8cd;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 28px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 70px -40px rgba(0, 0, 0, .8);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }
svg { display: block; }

a { color: inherit; text-decoration-color: var(--line-3); text-underline-offset: .18em; }
a:hover { text-decoration-color: var(--accent); }

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

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

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

.wrap { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }
.measure { max-width: var(--measure); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.progress {
  position: fixed; inset: 0 auto auto 0;
  height: 2px; width: 0%; z-index: 60;
  background: var(--accent);
  transition: width .1s linear;
}

.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.1) blur(12px);
  backdrop-filter: saturate(1.1) blur(12px);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 4.25rem;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; flex: 0 0 auto; }
.brand-mark {
  width: 1.9rem; height: 1.9rem; border-radius: 7px;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.1rem; line-height: 1;
  letter-spacing: -.04em; padding-bottom: .06em;
}
.brand-word {
  font-family: var(--serif);
  font-size: 1.32rem;
  letter-spacing: -.015em;
  font-weight: 600;
}
.brand-word em { font-style: normal; color: var(--ink-3); font-weight: 400; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }

.nav a.nav-link {
  font-size: .92rem;
  color: var(--ink-2);
  text-decoration: none;
  padding: .45rem .7rem;
  border-radius: 8px;
}
.nav a.nav-link:hover { color: var(--ink); background: var(--paper-3); }
.nav a.nav-link[aria-current="page"] { color: var(--ink); font-weight: 600; }

.icon-btn {
  appearance: none; border: 1px solid transparent; background: transparent;
  color: var(--ink-2); width: 2.3rem; height: 2.3rem;
  border-radius: 9px; display: grid; place-items: center; cursor: pointer;
  padding: 0;
}
.icon-btn:hover { color: var(--ink); background: var(--paper-3); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }

.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle { display: grid; margin-left: auto; }
  .nav { margin-left: 0; }
  .nav {
    position: fixed; inset: 4.25rem 0 auto 0;
    flex-direction: column; align-items: stretch; gap: .15rem;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .75rem clamp(1.1rem, 4vw, 2.5rem) 1.1rem;
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a.nav-link { padding: .7rem .25rem; font-size: 1rem; }
  .nav .nav-actions { display: flex; gap: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); margin-top: .5rem; }
}

.nav-actions { display: flex; align-items: center; gap: .25rem; margin-left: .35rem; }

/* ------------------------------------------------------------------ hero */

.hero { padding: clamp(3.2rem, 8vw, 6rem) 0 clamp(2.4rem, 5vw, 3.6rem); }

.eyebrow {
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 1.15rem;
  display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before {
  content: ""; width: 1.6rem; height: 1px; background: var(--accent-line);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.15rem, 5.6vw, 3.65rem);
  line-height: 1.08;
  letter-spacing: -.028em;
  margin: 0 0 1.1rem;
  max-width: 20ch;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; color: var(--accent-ink); }

.hero-lede {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 38rem;
  margin: 0;
}

.hero-meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.4rem;
  margin-top: 1.6rem;
  font-size: .84rem; color: var(--ink-3);
}
.hero-meta span { display: inline-flex; align-items: center; gap: .4rem; }
@media (max-width: 620px) {
  .hero-meta { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .hero-meta .dot { display: none; }
}
.dot { width: 1px; height: .95em; border-radius: 0; background: var(--line-2); display: inline-block; flex: 0 0 auto; align-self: center; }

/* ------------------------------------------------------------- home grid */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 600; letter-spacing: .01em;
  margin: 0;
}
.section-head .count { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center;
  padding: 1.1rem 0 1.4rem;
  border-bottom: 1px solid var(--line);
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }

.chip {
  appearance: none; cursor: pointer;
  font: inherit; font-size: .82rem;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  padding: .32rem .8rem;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--line-3); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}

.search {
  position: relative; margin-left: auto; min-width: 15rem; flex: 1 1 15rem; max-width: 20rem;
}
.search svg {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  width: 1rem; height: 1rem; color: var(--ink-4); pointer-events: none;
}
.search input {
  width: 100%; font: inherit; font-size: .9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .5rem .8rem .5rem 2.3rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.post-list { list-style: none; margin: 0; padding: 0; }

.post-item { border-bottom: 1px solid var(--line); }
.post-item[hidden] { display: none; }

.post-card {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 clamp(1rem, 3vw, 2rem);
  padding: clamp(1.5rem, 3vw, 2.1rem) 0;
  text-decoration: none;
  position: relative;
}
.post-card::after {
  content: ""; position: absolute; inset: 0 -.9rem;
  border-radius: 12px; background: var(--paper-2); opacity: 0;
  transition: opacity .18s ease; z-index: -1;
}
.post-card:hover::after { opacity: 1; }

.post-num {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--ink-4);
  padding-top: .55rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.post-body { min-width: 0; display: block; }

.post-kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: .5rem;
}
.post-kicker .tag { color: var(--accent-ink); }

.post-title {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.28rem, 2.4vw, 1.62rem);
  line-height: 1.28;
  letter-spacing: -.018em;
  font-weight: 600;
  margin: 0 0 .5rem;
  text-wrap: balance;
}
.post-card:hover .post-title { color: var(--accent-ink); }

.post-dek {
  display: block;
  margin: 0 0 .8rem;
  color: var(--ink-2);
  font-size: .97rem;
  line-height: 1.65;
  max-width: 44rem;
}

.post-foot {
  display: flex; flex-wrap: wrap; gap: .45rem .9rem;
  font-size: .8rem; color: var(--ink-3);
}
.post-foot .sep { color: var(--line-3); }

@media (max-width: 620px) {
  .byline .dot { display: none; }
  .byline { column-gap: .5rem; }
  .post-card { grid-template-columns: 1fr; }
  .post-num { padding-top: 0; margin-bottom: .6rem; }
}

.empty {
  padding: 3rem 0 4rem; color: var(--ink-3);
  font-family: var(--serif); font-size: 1.1rem;
}
.empty[hidden] { display: none; }

/* --------------------------------------------------------------- tools */

.tools {
  padding-block: clamp(3rem, 6vw, 4.5rem);
}
.tools-grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.tool {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.4rem 1.5rem 1.5rem;
  background: var(--paper);
  text-decoration: none;
  transition: background .18s ease;
}
.tool:hover { background: var(--paper-2); }
.tool-name {
  font-family: var(--serif); font-size: 1.08rem; font-weight: 600;
  letter-spacing: -.01em;
  display: flex; align-items: center; gap: .4rem;
}
.tool-name svg { width: .85rem; height: .85rem; color: var(--ink-4); transition: transform .18s ease, color .18s ease; }
.tool:hover .tool-name svg { transform: translate(2px, -2px); color: var(--accent); }
.tool p { margin: 0; font-size: .88rem; color: var(--ink-3); line-height: 1.55; }
.tool code { font-family: var(--mono); font-size: .78rem; color: var(--ink-4); }

/* --------------------------------------------------------------- article */

.article-shell {
  padding: clamp(2.4rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 4.5rem);
}

.article-head {
  padding: 0 0 clamp(1.6rem, 3vw, 2.4rem);
  border-bottom: 0;
}

@media (min-width: 1040px) {
  .article-shell {
    display: grid;
    grid-template-columns: 12.5rem minmax(0, var(--measure));
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
    justify-content: center;
    align-items: start;
  }
  .article-head { grid-column: 2; grid-row: 1; }
  .toc { grid-column: 1; grid-row: 2; }
  .article-body { grid-column: 2; grid-row: 2; }
}

.article-body { padding-top: clamp(1.8rem, 3.6vw, 2.6rem); min-width: 0; }

.toc {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  padding: 1.15rem 1.2rem 1.25rem;
  font-size: .85rem;
}
@media (min-width: 1040px) {
  .toc { position: sticky; top: 6rem; }
}
.toc h2 {
  font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; margin: 0 0 .7rem;
  font-family: var(--sans);
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin: 0; }
.toc a {
  display: block;
  padding: .28rem 0 .28rem 1.6rem;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.45;
  position: relative;
  border-radius: 5px;
}
.toc a::before {
  content: counter(toc) ".";
  position: absolute; left: 0;
  color: var(--ink-4); font-variant-numeric: tabular-nums;
  font-size: .78rem;
}
.toc a:hover { color: var(--ink); background: var(--paper-3); }
.toc a.is-active { color: var(--accent-ink); font-weight: 600; }
.toc a.is-active::before { color: var(--accent); }

.prose { font-size: 1.0625rem; line-height: 1.78; color: var(--ink-2); min-width: 0; }
.prose > *:first-child { margin-top: 0; }

.prose p { margin: 0 0 1.35em; }
.prose p.lede {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.62;
  color: var(--ink);
}
.prose p.lede::first-letter { font-size: 1.02em; }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: -.018em;
  text-wrap: balance;
}
.prose h2 {
  font-size: clamp(1.42rem, 2.4vw, 1.7rem);
  font-weight: 600;
  line-height: 1.3;
  margin: 2.6em 0 .7em;
  padding-top: .2em;
  scroll-margin-top: 6rem;
}
.prose h3 {
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 2em 0 .6em;
  scroll-margin-top: 6rem;
}
.prose h2 + p, .prose h3 + p { margin-top: 0; }
.prose h2:first-child { margin-top: 0; }

.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .16em;
  text-decoration-color: var(--accent-line);
}
.prose a:hover { text-decoration-color: var(--accent); }

.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }

.prose ul, .prose ol { margin: 0 0 1.35em; padding-left: 1.35em; }
.prose li { margin: 0 0 .5em; padding-left: .2em; }
.prose li::marker { color: var(--ink-4); }
.prose ul li::marker { font-size: .9em; }

.prose blockquote {
  margin: 1.9em 0;
  padding: 0 0 0 1.4rem;
  border-left: 2px solid var(--accent-line);
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink);
}
.prose blockquote p { margin: 0 0 .6em; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote cite {
  display: block; margin-top: .6rem;
  font-family: var(--sans); font-size: .8rem; font-style: normal; color: var(--ink-3);
}

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

/* callouts */
.callout {
  --c-bg: var(--note-bg); --c-line: var(--note-line); --c-ink: var(--note-ink);
  margin: 1.9em 0;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-left: 2px solid var(--c-ink);
  border-radius: 0 10px 10px 0;
  padding: 1.05rem 1.2rem;
  color: var(--ink-2);
  font-size: .97rem;
  line-height: 1.68;
}
.callout > *:first-child { margin-top: 0; }
.callout > *:last-child { margin-bottom: 0; }
.callout p { margin: 0 0 .7em; }
.callout-label {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--sans);
  font-size: .7rem; letter-spacing: .13em; text-transform: uppercase;
  font-weight: 700; color: var(--c-ink);
  margin-bottom: .45rem;
}
.callout-tip { --c-bg: var(--tip-bg); --c-line: var(--tip-line); --c-ink: var(--tip-ink); }
.callout-warn { --c-bg: var(--warn-bg); --c-line: var(--warn-line); --c-ink: var(--warn-ink); }
.callout code { background: rgba(0,0,0,.05); }
[data-theme="dark"] .callout code { background: rgba(255,255,255,.06); }

/* code */
.prose pre, .code-block {
  margin: 1.7em 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  font-size: .86rem;
  line-height: 1.62;
}
.code-bar {
  display: flex; align-items: center; gap: .6rem;
  padding: .45rem .8rem .45rem 1rem;
  background: var(--code-bar);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.code-bar .copy {
  margin-left: auto;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--sans);
  font-size: .72rem; color: var(--ink-3);
  padding: .2rem .5rem; border-radius: 6px; cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.code-bar .copy:hover { background: var(--paper-3); color: var(--ink); }
.code-bar .copy.done { color: var(--tip-ink); }
.prose pre code {
  display: block;
  padding: 1rem 1.15rem 1.15rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .86rem;
  color: var(--code-ink);
  background: none;
  border: 0;
  tab-size: 2;
}
.prose :not(pre) > code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .1em .35em;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.prose pre code .c { color: var(--ink-4); font-style: italic; }
.prose pre code .k { color: var(--accent-ink); }
.prose pre code .s { color: var(--tip-ink); }

/* tables */
.table-wrap {
  margin: 1.7em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%; border-collapse: collapse;
  margin: 0; font-size: .92rem;
  display: table;
  table-layout: auto;
}
.prose th, .prose td {
  text-align: left; padding: .6rem .8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.prose th {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }

/* figures */
figure { margin: 2em 0; }
figure img, figure svg { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
figcaption {
  margin-top: .7rem; font-size: .8rem; color: var(--ink-3); line-height: 1.5;
}

/* end matter */
.endmatter { margin-top: 3rem; }

.promo {
  display: block;
  position: relative;
  padding: 1.3rem 3.2rem 1.35rem 1.4rem;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 13px;
  text-decoration: none;
}
.promo::after {
  content: "\2192";
  position: absolute; right: 1.3rem; top: 50%;
  transform: translateY(-50%);
  color: var(--accent-ink); font-size: 1.1rem;
  transition: transform .18s ease;
}
.promo:hover::after { transform: translate(3px, -50%); }
.promo-label {
  display: block;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  font-weight: 700; color: var(--accent-ink);
  margin-bottom: .3rem;
}
.promo strong {
  display: block;
  font-family: var(--serif); font-size: 1.15rem; color: var(--ink); font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}
.promo p { margin: 0; font-size: .9rem; color: var(--ink-2); line-height: 1.55; }
.promo .arrow { display: none; }

.related { margin-top: 2.6rem; }
.related h2 {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 700;
  margin: 0 0 .9rem;
}
.related ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.related li { border-bottom: 1px solid var(--line); }
.related a {
  display: flex; gap: 1rem; align-items: baseline; justify-content: space-between;
  padding: .85rem 0; text-decoration: none;
}
.related a:hover .rt { color: var(--accent-ink); }
.related .rt { font-family: var(--serif); font-size: 1rem; color: var(--ink); line-height: 1.4; }
.related .rm { font-size: .76rem; color: var(--ink-4); white-space: nowrap; }

.author-box {
  margin-top: 2.6rem;
  border-top: 1px solid var(--line);
  padding-top: 1.4rem;
  display: flex; gap: 1rem; align-items: flex-start;
  font-size: .88rem; color: var(--ink-3); line-height: 1.6;
}
.author-box .brand-mark { width: 2.4rem; height: 2.4rem; flex: 0 0 auto; font-size: 1.2rem; }
.author-box p { margin: 0; }
.author-box strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------- legal pages */

.page-head { padding: clamp(2.6rem, 6vw, 4.4rem) 0 1.5rem; }
.page-head h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.14;
  letter-spacing: -.026em; margin: 0 0 .8rem;
}
.page-head p {
  font-family: var(--serif); font-size: 1.1rem; color: var(--ink-2);
  line-height: 1.6; margin: 0; max-width: 42rem;
}
.page-meta { margin-top: 1.2rem; font-size: .8rem; color: var(--ink-3); }

.legal { padding-bottom: clamp(3rem, 6vw, 5rem); }
.legal .prose { max-width: 46rem; }
.legal h2 { font-size: 1.3rem; margin-top: 2.1em; }
.legal h3 { font-size: 1.04rem; margin-top: 1.6em; }
.legal table { display: table; }
.legal ul { padding-left: 1.2em; }

.defs { list-style: none; padding: 0 !important; margin: 1.4em 0; }
.defs li { padding-left: 0; }
.defs strong { display: block; font-size: .95rem; color: var(--ink); }

/* contact form-less cards */
.contact-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 2rem 0 0;
}
.contact-card {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 1.3rem 1.4rem; background: var(--paper-2);
}
.contact-card h2 {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 700;
  margin: 0 0 .6rem;
}
.contact-card p { margin: 0 0 .5rem; font-size: .93rem; color: var(--ink-2); line-height: 1.6; }
.contact-card a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.contact-card a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: clamp(2.6rem, 5vw, 3.8rem) 0 2.2rem;
  margin-top: auto;
}
.footer-grid {
  display: grid; gap: 2rem;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  align-items: start;
}
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

.footer-brand .brand { margin-bottom: .8rem; }
.footer-brand p { margin: 0; font-size: .87rem; color: var(--ink-3); line-height: 1.65; max-width: 24rem; }

.footer h2 {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 700;
  margin: 0 0 .7rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0 0 .4rem; }
.footer a { font-size: .88rem; color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }

.footer-bottom {
  margin-top: 2.4rem; padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: center;
  font-size: .78rem; color: var(--ink-3);
}
.footer-bottom .made { margin-left: auto; }
.footer-bottom .made a { font-size: .78rem; }

/* ---------------------------------------------------------------- misc */

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

.back-to-top {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: 1.6rem;
  font-size: .82rem; color: var(--ink-3); text-decoration: none;
}
.back-to-top:hover { color: var(--ink); }

@media print {
  .masthead, .footer, .toc, .progress, .promo, .related, .back-to-top, .byline .share { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .article-layout { display: block; padding: 0; }
  .prose a { color: #000; text-decoration: underline; }
  .prose pre { border: 1px solid #ccc; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
}
