/* ==========================================================================
   MidLife Coder — main.css
   Hand-written monochrome design system. No framework dependencies.

   Contents
   1.  Design tokens
   2.  Reset & base
   3.  Typography
   4.  Layout primitives
   5.  Header & navigation
   6.  Footer
   7.  Buttons & links
   8.  Post cards & lists
   9.  Article (prose)
   10. Taxonomy: tags & categories
   11. Pagination
   12. Search
   13. Forms
   14. Comments (placeholder region)
   15. Utilities
   16. Print
   ========================================================================== */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */

:root {
  /* --- Monochrome ramp. Only these greys are used anywhere. --- */
  --mlc-000: #ffffff;
  --mlc-050: #f7f7f6;
  --mlc-100: #eeeeec;
  --mlc-200: #dededa;
  --mlc-300: #c4c4bf;
  --mlc-400: #9b9b96;
  --mlc-500: #74746f;
  --mlc-600: #55554f;
  --mlc-700: #3a3a35;
  --mlc-800: #232320;
  --mlc-900: #141412;
  --mlc-950: #0b0b0a;

  /* --- Semantic colours (remapped in dark mode) --- */
  --color-bg: #f8fafc;
  --color-surface: var(--mlc-000);
  --color-surface-alt: var(--mlc-100);
  --color-text: var(--mlc-900);
  --color-text-muted: var(--mlc-500);
  --color-text-subtle: var(--mlc-400);
  --color-border: var(--mlc-200);
  --color-border-strong: var(--mlc-300);
  --color-accent: var(--mlc-900);
  --color-accent-contrast: var(--mlc-000);
  --color-highlight: var(--mlc-200);
  --color-focus: var(--mlc-900);

  /* --- Type --- */
  --font-display: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--2: clamp(0.72rem, 0.70rem + 0.10vw, 0.78rem);
  --step--1: clamp(0.84rem, 0.81rem + 0.15vw, 0.92rem);
  --step-0: clamp(1.02rem, 0.98rem + 0.20vw, 1.13rem);
  --step-1: clamp(1.22rem, 1.14rem + 0.38vw, 1.45rem);
  --step-2: clamp(1.46rem, 1.32rem + 0.68vw, 1.85rem);
  --step-3: clamp(1.75rem, 1.52rem + 1.14vw, 2.37rem);
  --step-4: clamp(2.10rem, 1.72rem + 1.86vw, 3.03rem);
  --step-5: clamp(2.52rem, 1.94rem + 2.90vw, 3.88rem);

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.65;
  --tracking-tight: -0.02em;
  --tracking-wide: 0.08em;

  /* --- Space (4px base) --- */
  --space-0: 0rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* --- Measure & containers ------------------------------------------------
     Every container on the site is --width-content wide, so the header, the
     listings, posts and pages all line up at the same left and right edges.
     Switch the whole site by changing this one value:

        var(--width-wide)   72rem, matching the header      (default)
        var(--width-page)   58rem, a little narrower
        100%                edge to edge, gutters only

     --measure caps the line length of body text *inside* that container. It is
     `none` so that article text fills the same width as everything else, which
     is what "all one width" means in practice. The trade-off is real: at a
     1440px window that is roughly 150 characters a line, well past the 60–80
     that is comfortable to read. Set it back to 68ch to cap article text while
     leaving every container aligned.
     -------------------------------------------------------------------- */
  --width-wide: 72rem;
  --width-page: 58rem;
  --width-prose: 42rem;
  --width-content: var(--width-wide);
  --measure: none;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  /* Images are shown as saved. Set to grayscale(100%) for a monochrome site. */
  --image-filter: none;

  /* --- Lines, radii, motion --- */
  --hairline: 1px;
  --radius: 2px;
  --radius-lg: 4px;
  --shadow-none: none;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Underlines that grow on hover: thickness, duration and easing. */
  --underline-weight: 1px;
  --underline-speed: 220ms;
  --underline-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 4.5rem;
}

/* Dark theme. Applied by js/theme.js on <html data-theme="dark">. */
[data-theme="dark"] {
  --color-bg: var(--mlc-950);
  --color-surface: var(--mlc-900);
  --color-surface-alt: var(--mlc-800);
  --color-text: var(--mlc-100);
  --color-text-muted: var(--mlc-400);
  --color-text-subtle: var(--mlc-500);
  --color-border: var(--mlc-800);
  --color-border-strong: var(--mlc-700);
  --color-accent: var(--mlc-100);
  --color-accent-contrast: var(--mlc-950);
  --color-highlight: var(--mlc-700);
  --color-focus: var(--mlc-200);
  color-scheme: dark;
}

/* Follow the OS when the visitor has expressed no preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: var(--mlc-950);
    --color-surface: var(--mlc-900);
    --color-surface-alt: var(--mlc-800);
    --color-text: var(--mlc-100);
    --color-text-muted: var(--mlc-400);
    --color-text-subtle: var(--mlc-500);
    --color-border: var(--mlc-800);
    --color-border-strong: var(--mlc-700);
    --color-accent: var(--mlc-100);
    --color-accent-contrast: var(--mlc-950);
    --color-highlight: var(--mlc-700);
    --color-focus: var(--mlc-200);
    color-scheme: dark;
  }
}

/* ==========================================================================
   2. Reset & base
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
  /* Also set here so the canvas outside <body> is themed, and so a stray
     framework stylesheet loading after this one cannot repaint the page. */
  background-color: var(--color-bg);
  color: var(--color-text);
}

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

/* `html body` rather than `body`: two element selectors beat the single-element
   `body { background-color }` rule that Bootstrap-derived stylesheets ship, so
   the theme holds even if one of them is loaded after this file. */
html body {
  background-color: var(--color-bg);
  color: var(--color-text);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select { font: inherit; color: inherit; }

p,
h1,
h2,
h3,
h4,
h5,
h6 { overflow-wrap: break-word; }

hr {
  border: 0;
  border-top: var(--hairline) solid var(--color-border);
  margin-block: var(--space-6);
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-family: var(--font-display);
  text-decoration: none;
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

/* ==========================================================================
   3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
h5 { font-size: var(--step-0); }
h6 {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

p { text-wrap: pretty; }

small { font-size: var(--step--1); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

blockquote { margin: 0; }

/* A small label in a meta line — currently only "Featured", so a pinned post
   is identifiable rather than just differently ordered. */
.meta-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: 999px;
  font-size: var(--step--2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text);
}

/* Eyebrow: small caps label above a heading. */
.eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.lede {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
  max-width: var(--measure);
}

.meta {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0;
}

.meta a { color: inherit; }

.meta-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  list-style: none;
  padding: 0;
}

.meta-list > li { display: inline-flex; align-items: center; gap: var(--space-2); }

.meta-list > li + li::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-border-strong);
  margin-right: var(--space-1);
}

/* ==========================================================================
   4. Layout primitives
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--width-content);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Kept so existing templates keep working: both now match .container, which is
   what makes every page the same width. Give either its own max-width here to
   break one page type out again. */
.container--wide,
.container--prose { max-width: var(--width-content); }

.site-main {
  flex: 1 0 auto;
  padding-block: var(--space-7) var(--space-9);
}

.section { margin-block: var(--space-8); }
.section:first-child { margin-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-6);
  border-bottom: var(--hairline) solid var(--color-border);
}

.section-head h2 { font-size: var(--step-1); }

.section-head .section-link {
  font-family: var(--font-display);
  font-size: var(--step--1);
  white-space: nowrap;
}

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.layout-sidebar {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

@media (min-width: 60em) {
  .layout-sidebar {
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: var(--space-9);
  }
}

/* ==========================================================================
   5. Header & navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: var(--hairline) solid var(--color-border);
}

@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--color-bg); }
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-height);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: inherit;
  flex: 0 0 auto;
  margin-right: auto;
}

.site-brand__logo {
  height: 2.25rem;
  width: auto;
}

/* Dark mode swaps to the white version of the logo. */
.site-brand__logo--dark { display: none; }
[data-theme="dark"] .site-brand__logo--light { display: none; }
[data-theme="dark"] .site-brand__logo--dark { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-brand__logo--light { display: none; }
  :root:not([data-theme="light"]) .site-brand__logo--dark { display: block; }
}

.site-nav { display: none; }

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__link {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text-muted);
  padding-block: var(--space-2);
  position: relative;
  transition: color var(--transition);
}

.site-nav__link:hover,
.site-nav__link:focus-visible { color: var(--color-text); }

.site-nav__link[aria-current="page"] {
  color: var(--color-text);
}

/* One rule for both states: the rule is always in the DOM and scaled to
   nothing, so hover grows it from the left and the current page simply starts
   at full width. */
.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--underline-speed) var(--underline-ease);
}

.site-nav__link:hover::after,
.site-nav__link:focus-visible::after,
.site-nav__link[aria-current="page"]::after { transform: scaleX(1); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: var(--hairline) solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--color-text);
  border-color: var(--color-border);
  background: var(--color-surface);
}

/* Theme toggle shows one icon per mode. */
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: inline-block; }
}

/* Header search: collapsed to an icon on small screens. */
.header-search {
  display: none;
  align-items: center;
  position: relative;
}

.header-search__input {
  width: 11rem;
  padding: var(--space-2) var(--space-3) var(--space-2) 2.25rem;
  border: var(--hairline) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: var(--font-display);
  font-size: var(--step--1);
  transition: width var(--transition), border-color var(--transition);
}

.header-search__input::placeholder { color: var(--color-text-subtle); }

.header-search__input:focus {
  width: 15rem;
  border-color: var(--color-border-strong);
  outline-offset: 1px;
}

.header-search__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  font-size: var(--step--1);
  pointer-events: none;
}

@media (min-width: 48em) {
  .site-nav { display: block; }
  .header-search { display: flex; }
  .nav-toggle { display: none; }
}

/* Mobile drawer */
.nav-drawer {
  display: block;
  border-top: var(--hairline) solid var(--color-border);
  background: var(--color-bg);
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition);
}

.nav-drawer[hidden] { display: none; }
.nav-drawer.is-open { max-height: 32rem; }

.nav-drawer__list {
  list-style: none;
  margin: 0;
  padding: var(--space-3) 0 var(--space-5);
}

.nav-drawer__link {
  display: block;
  padding: var(--space-3) 0;
  font-family: var(--font-display);
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: var(--hairline) solid var(--color-border);
}

.nav-drawer .search-form { margin-top: var(--space-4); }

@media (min-width: 48em) {
  .nav-drawer { display: none !important; }
}

/* ==========================================================================
   6. Footer
   ========================================================================== */

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  border-top: var(--hairline) solid var(--color-border);
  background: var(--color-surface);
  padding-block: var(--space-7) var(--space-5);
  font-size: var(--step--1);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 48em) {
  /* Tagline block, then the links column. */
  .site-footer__grid { grid-template-columns: 2fr minmax(0, 1fr); gap: var(--space-8); }
}

.site-footer__tagline {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-muted);
  max-width: 28ch;
}

.site-footer__tagline strong { color: var(--color-text); font-weight: 700; }

.site-footer h2 {
  font-size: var(--step--2);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-3);
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.footer-list a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-list a:hover { color: var(--color-text); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: var(--hairline) solid var(--color-border);
  color: var(--color-text-subtle);
  font-family: var(--font-display);
  font-size: var(--step--2);
}

.site-footer__bottom ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ==========================================================================
   7. Buttons & links
   ========================================================================== */

a {
  color: var(--color-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--color-border-strong);
  transition: text-decoration-color var(--transition), color var(--transition);
}

a:hover { text-decoration-color: currentColor; }

/* --- Growing underlines ---------------------------------------------------
   A background gradient rather than text-decoration, because only background
   size can be transitioned. It is painted at the bottom of the line box and
   grown from left to right on hover.

   Two layers where a link needs to be visible at rest (body copy, where an
   underline is the only thing marking a link on a monochrome site): a static
   hairline underneath, and the animated full-strength line on top. Title and
   UI links get the animated layer only — context already marks them as links.

   Multi-line links animate per line fragment, which is the trade-off for
   handling wrapped text at all.
   ------------------------------------------------------------------------ */

.prose a,
.callout a,
.post-hero__title a,
.post-row__title a,
.post-compact__title a,
.post-nav__title,
.footer-list a,
.toc a,
.series__item a,
.link-quiet,
.category-label,
.empty-state a {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% var(--underline-weight);
  transition: background-size var(--underline-speed) var(--underline-ease),
              color var(--transition);
}

.prose a:hover,
.prose a:focus-visible,
.callout a:hover,
.callout a:focus-visible,
.post-hero__title a:hover,
.post-hero__title a:focus-visible,
.post-row__title a:hover,
.post-row__title a:focus-visible,
.post-compact__title a:hover,
.post-compact__title a:focus-visible,
.post-nav__title:hover,
.post-nav__title:focus-visible,
.footer-list a:hover,
.footer-list a:focus-visible,
.toc a:hover,
.toc a:focus-visible,
.series__item a:hover,
.series__item a:focus-visible,
.link-quiet:hover,
.link-quiet:focus-visible,
.category-label:hover,
.category-label:focus-visible,
.empty-state a:hover,
.empty-state a:focus-visible {
  background-size: 100% var(--underline-weight);
}

/* Body links keep a resting hairline underneath the animated one — without it
   a link in a paragraph would be invisible until hovered. */
.prose a,
.callout a {
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(var(--color-border-strong), var(--color-border-strong));
  background-size: 0% var(--underline-weight), 100% var(--underline-weight);
  background-position: 0 100%, 0 100%;
}

.prose a:hover,
.prose a:focus-visible,
.callout a:hover,
.callout a:focus-visible {
  background-size: 100% var(--underline-weight), 100% var(--underline-weight);
}

/* Links that are already a shape — a pill, a button, an arrow link, an image —
   opt out: an underline drawn beneath them reads as a stray rule. */
.prose .tag,
.callout .tag,
.prose .arrow-link,
.callout .arrow-link,
.empty-state .arrow-link,
.prose .btn,
.callout .btn {
  background-image: none;
}

/* A link wrapping an image, as markdown produces for a linked figure. */
.prose a:has(img),
.prose a:has(picture),
.callout a:has(img) {
  background-image: none;
}

/* Underlines are painted, not decorated, so they do not print. */
@media print {
  .prose a { text-decoration: underline; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: var(--hairline) solid var(--color-accent);
  border-radius: var(--radius);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition), background-color var(--transition), color var(--transition);
}

.btn:hover { opacity: 0.86; }

.btn--outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.btn--outline:hover {
  opacity: 1;
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
  padding-inline: 0;
}

.btn--ghost:hover { color: var(--color-text); opacity: 1; }

.btn--block { width: 100%; }

/* Arrow link: "Read more →" */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
}

.arrow-link i,
.arrow-link .arrow { transition: transform var(--transition); }
.arrow-link:hover i,
.arrow-link:hover .arrow { transform: translateX(3px); }

/* ==========================================================================
   8. Post cards & lists
   ========================================================================== */

/* --- Hero / featured post --- */
.post-hero {
  display: grid;
  gap: var(--space-5);
  padding-bottom: var(--space-7);
  margin-bottom: var(--space-7);
  border-bottom: var(--hairline) solid var(--color-border);
}

.post-hero__title {
  font-size: var(--step-3);
  letter-spacing: var(--tracking-tight);
}

.post-hero__title a { text-decoration: none; }


.post-hero__excerpt { max-width: var(--measure); color: var(--color-text-muted); }

.post-hero--with-media { grid-template-columns: 1fr; }

@media (min-width: 48em) {
  .post-hero--with-media {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: var(--space-7);
    align-items: center;
  }
}

/* --- Post list: text-first rows, image strictly optional --- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.post-list > li { border-bottom: var(--hairline) solid var(--color-border); }
.post-list > li:first-child { border-top: var(--hairline) solid var(--color-border); }

.post-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-5);
  transition: background-color var(--transition);
}

/* Only posts that actually have an image get the two-column treatment. */
.post-row--has-media {
  grid-template-columns: 1fr;
}

@media (min-width: 40em) {
  .post-row--has-media {
    grid-template-columns: minmax(0, 1fr) 12rem;
    align-items: start;
  }
  .post-row--has-media .post-row__media { grid-column: 2; grid-row: 1 / span 3; }
}

.post-row__media {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--color-surface-alt);
}

.post-row__media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  filter: var(--image-filter);
  transition: transform 400ms cubic-bezier(0.2, 0, 0.2, 1), filter var(--transition);
}

.post-row:hover .post-row__media img { transform: scale(1.03); }

.post-row__title {
  font-size: var(--step-1);
  margin: 0;
}

.post-row__title a { text-decoration: none; }


.post-row__excerpt {
  color: var(--color-text-muted);
  max-width: var(--measure);
  font-size: var(--step-0);
}

.post-row__meta { order: -1; }

/* --- Compact list (sidebar, related, archives) --- */
.post-compact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.post-compact__title {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 500;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-1);
}

.post-compact__title a { text-decoration: none; }


/* --- Archive grouped by year --- */
.archive-year {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-7);
}

.archive-year__label {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  padding-bottom: var(--space-2);
  border-bottom: var(--hairline) solid var(--color-border);
}

/* --- Page header block used by archive/category/tag/search --- */
.page-header {
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-7);
  border-bottom: 2px solid var(--color-text);
}

.page-header__title { font-size: var(--step-4); }
.page-header__count {
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}

/* --- Empty state --- */
.empty-state {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  border: var(--hairline) dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
}

.empty-state h2 {
  font-size: var(--step-1);
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

/* ==========================================================================
   9. Article (prose)
   ========================================================================== */

.article-header {
  max-width: var(--measure);
  margin-bottom: var(--space-7);
}

.article-header__title {
  font-size: var(--step-5);
  margin-bottom: var(--space-4);
}

.article-header__lede {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

/* Subtitle: the deck directly under the title. Set in the display face so it
   reads as part of the headline rather than as the opening of the body copy. */
.article-header__subtitle {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  max-width: var(--measure);
  text-wrap: pretty;
}

.article-header__meta {
  padding-top: var(--space-4);
  border-top: var(--hairline) solid var(--color-border);
}

.article-figure {
  margin-block: var(--space-6) var(--space-7);
}

.article-figure img {
  width: 100%;
  border-radius: var(--radius);
  filter: var(--image-filter);
}

.article-figure figcaption {
  margin-top: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-subtle);
}

/* Full-bleed variant for header images. */
.article-figure--wide {
  width: min(var(--width-content), 100vw - var(--gutter) * 2);
  margin-inline: calc(50% - min(var(--width-content), 100vw - var(--gutter) * 2) / 2);
}

/* The prose block styles raw markdown output. */
.prose {
  max-width: var(--measure);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
}

.prose > * + * { margin-top: var(--space-5); }

.prose h2 {
  font-size: var(--step-2);
  margin-top: var(--space-8);
  padding-bottom: var(--space-2);
  border-bottom: var(--hairline) solid var(--color-border);
}

.prose h3 { font-size: var(--step-1); margin-top: var(--space-7); }
.prose h4 { font-size: var(--step-0); margin-top: var(--space-6); text-transform: none; }

.prose h2 + *,
.prose h3 + *,
.prose h4 + * { margin-top: var(--space-4); }

.prose a { text-decoration-color: var(--color-text-subtle); }

.prose ul,
.prose ol { padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose li::marker { color: var(--color-text-subtle); }

.prose blockquote {
  padding-left: var(--space-5);
  border-left: 2px solid var(--color-text);
  font-style: italic;
  color: var(--color-text-muted);
}

.prose blockquote > * + * { margin-top: var(--space-4); }

.prose img,
.prose video {
  border-radius: var(--radius);
  filter: var(--image-filter);
}

.prose figure figcaption {
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-subtle);
}

.prose code {
  padding: 0.15em 0.35em;
  border: var(--hairline) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-alt);
}

.prose pre {
  padding: var(--space-5);
  border: var(--hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
  overflow-x: auto;
  line-height: 1.55;
  font-size: var(--step--1);
  tab-size: 2;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}

.prose th,
.prose td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: var(--hairline) solid var(--color-border);
}

.prose th {
  font-family: var(--font-display);
  font-weight: 700;
  border-bottom-color: var(--color-text);
}

.prose mark {
  background: var(--color-highlight);
  color: var(--color-text);
  padding: 0.05em 0.2em;
}

.prose kbd {
  padding: 0.1em 0.4em;
  border: var(--hairline) solid var(--color-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.8em;
}

.prose hr { margin-block: var(--space-7); }

/* Footnotes emitted by most markdown renderers. */
.prose .footnotes {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--color-border);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

/* --- Article footer: tags, share, prev/next --- */
.article-footer {
  max-width: var(--measure);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 2px solid var(--color-text);
}

.post-nav {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--color-border);
}

.post-nav__item { min-width: 0; }

@media (min-width: 40em) {
  .post-nav { grid-template-columns: 1fr 1fr; gap: var(--space-7); }
  .post-nav__item--next { text-align: right; }
}

.post-nav__label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-2);
}

.post-nav__title {
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  text-decoration: none;
}



/* Table of contents (optional, rendered by the SSG). */
.toc {
  padding: var(--space-5);
  border: var(--hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  font-size: var(--step--1);
}

.toc h2 {
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-3);
  border: 0;
  padding: 0;
}

.toc ol, .toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.toc ol ol, .toc ul ul { padding-left: var(--space-4); margin-top: var(--space-2); }
.toc a { color: var(--color-text-muted); text-decoration: none; }
.toc a:hover { color: var(--color-text); }

/* ==========================================================================
   Obsidian callouts

   The one place colour is allowed. Values are Obsidian's own palette, held as
   RGB triples so the same hue can serve as border, tint and text at different
   alphas. Light and dark get separate triples, as Obsidian does.

   Title text is darkened slightly in light mode: Obsidian's yellow and cyan
   sit at about 2:1 against a pale background, which is unreadable at body size.
   ========================================================================== */

.callout {
  /* Fallback, overridden per type below. */
  --callout-rgb: 8, 109, 221;
  --callout-ink: color-mix(in srgb, rgb(var(--callout-rgb)) 76%, #000);

  margin-block: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: var(--hairline) solid rgba(var(--callout-rgb), 0.35);
  border-radius: var(--radius-lg);
  background: rgba(var(--callout-rgb), 0.08);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .callout { --callout-ink: rgb(var(--callout-rgb)); }
}

[data-theme="dark"] .callout { --callout-ink: rgb(var(--callout-rgb)); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .callout { --callout-ink: rgb(var(--callout-rgb)); }
}

.callout-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--callout-ink);
}

.callout-icon {
  flex: 0 0 auto;
  font-size: 0.9em;
  color: rgb(var(--callout-rgb));
}

.callout-title-text > p { display: inline; }

.callout-content { margin-top: var(--space-3); }
.callout-content > * + * { margin-top: var(--space-4); }
.callout-content > *:first-child { margin-top: 0; }
.callout-content > *:last-child { margin-bottom: 0; }

/* Nested callouts sit tighter than top-level ones. */
.callout .callout { margin-block: var(--space-4); }

/* --- Foldable (details/summary) --- */

.callout--foldable > .callout-title {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: var(--space-5);
}

.callout--foldable > .callout-title::-webkit-details-marker { display: none; }

.callout--foldable > .callout-title::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0.45em;
  width: 0.5em;
  height: 0.5em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transform-origin: center;
  opacity: 0.6;
  transition: transform var(--transition);
}

.callout--foldable[open] > .callout-title::after { transform: rotate(-135deg); }
.callout--foldable > .callout-title:hover::after { opacity: 1; }

/* --- Types. Obsidian's mapping: several types share a hue. --- */

.callout--note,
.callout--info,
.callout--todo     { --callout-rgb: 8, 109, 221; }   /* blue   */
.callout--abstract,
.callout--tip      { --callout-rgb: 0, 191, 188; }   /* cyan   */
.callout--success  { --callout-rgb: 8, 185, 78; }    /* green  */
.callout--question { --callout-rgb: 224, 172, 0; }   /* yellow */
.callout--warning  { --callout-rgb: 236, 117, 0; }   /* orange */
.callout--failure,
.callout--danger,
.callout--bug      { --callout-rgb: 233, 49, 71; }   /* red    */
.callout--example  { --callout-rgb: 120, 82, 238; }  /* purple */
.callout--quote    { --callout-rgb: 122, 122, 122; } /* grey   */

/* Obsidian brightens its palette in dark mode rather than reusing the light
   values, which would go muddy against a near-black background. */
[data-theme="dark"] .callout--note,
[data-theme="dark"] .callout--info,
[data-theme="dark"] .callout--todo     { --callout-rgb: 2, 122, 255; }
[data-theme="dark"] .callout--abstract,
[data-theme="dark"] .callout--tip      { --callout-rgb: 83, 223, 221; }
[data-theme="dark"] .callout--success  { --callout-rgb: 68, 207, 110; }
[data-theme="dark"] .callout--question { --callout-rgb: 224, 222, 113; }
[data-theme="dark"] .callout--warning  { --callout-rgb: 233, 151, 63; }
[data-theme="dark"] .callout--failure,
[data-theme="dark"] .callout--danger,
[data-theme="dark"] .callout--bug      { --callout-rgb: 251, 70, 76; }
[data-theme="dark"] .callout--example  { --callout-rgb: 168, 130, 255; }
[data-theme="dark"] .callout--quote    { --callout-rgb: 158, 158, 158; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .callout--note,
  :root:not([data-theme="light"]) .callout--info,
  :root:not([data-theme="light"]) .callout--todo     { --callout-rgb: 2, 122, 255; }
  :root:not([data-theme="light"]) .callout--abstract,
  :root:not([data-theme="light"]) .callout--tip      { --callout-rgb: 83, 223, 221; }
  :root:not([data-theme="light"]) .callout--success  { --callout-rgb: 68, 207, 110; }
  :root:not([data-theme="light"]) .callout--question { --callout-rgb: 224, 222, 113; }
  :root:not([data-theme="light"]) .callout--warning  { --callout-rgb: 233, 151, 63; }
  :root:not([data-theme="light"]) .callout--failure,
  :root:not([data-theme="light"]) .callout--danger,
  :root:not([data-theme="light"]) .callout--bug      { --callout-rgb: 251, 70, 76; }
  :root:not([data-theme="light"]) .callout--example  { --callout-rgb: 168, 130, 255; }
  :root:not([data-theme="light"]) .callout--quote    { --callout-rgb: 158, 158, 158; }
}

/* Images inside callouts keep the site's greyscale treatment. */
.callout img { filter: var(--image-filter); }

@media print {
  .callout {
    background: none;
    border-color: #999;
  }
  .callout--foldable > .callout-title::after { display: none; }
  /* Print collapsed callouts open — paper has no disclosure triangle. */
  .callout--foldable > .callout-content { display: block !important; }
}

/* Homepage intro written as a markdown page (content/pages/home.md). The first
   paragraph carries the lede treatment so the page opens the way the built-in
   intro block does. */

.home-intro__title {
  font-size: var(--step-4);
  margin-bottom: var(--space-5);
}

.home-intro > p:first-of-type {
  font-size: var(--step-1);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
}

/* --- Series: a multi-part run of posts --- */

.series {
  max-width: var(--measure);
  margin-block: var(--space-6) var(--space-7);
  padding: var(--space-5);
  border: var(--hairline) solid var(--color-border);
  border-left: 2px solid var(--color-text);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: var(--color-surface);
}

.series__label {
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.series__label strong { color: var(--color-text); font-weight: 700; }

.series__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: series;
  display: grid;
  gap: var(--space-2);
}

.series__item {
  counter-increment: series;
  display: flex;
  gap: var(--space-3);
  font-size: var(--step--1);
  line-height: var(--leading-snug);
}

.series__item::before {
  content: counter(series) ".";
  flex: 0 0 1.5rem;
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-subtle);
}

.series__item a { color: var(--color-text-muted); text-decoration: none; }
.series__item a:hover { color: var(--color-text); }

.series__item--current { font-weight: 600; }
.series__item--current::before { color: var(--color-text); }
.series__item--current span { color: var(--color-text); }

.series__next {
  margin-top: var(--space-5);
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

/* Sidebar block */
.sidebar { display: grid; gap: var(--space-7); align-content: start; }

@media (min-width: 60em) {
  .sidebar--sticky {
    position: sticky;
    top: calc(var(--header-height) + var(--space-5));
  }
}

.sidebar__title {
  font-family: var(--font-display);
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: var(--hairline) solid var(--color-border);
}

/* ==========================================================================
   10. Taxonomy: tags & categories
   ========================================================================== */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
}

.tag:hover,
.tag:focus-visible {
  color: var(--color-accent-contrast);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.tag--active {
  color: var(--color-accent-contrast);
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.tag__count { color: inherit; opacity: 0.6; }

/* Inline #tags written in the body of a post. Same pill, sized to sit in a
   line of text without disturbing the leading. */
.tag--inline {
  display: inline;
  padding: 0.1em 0.45em;
  font-size: 0.85em;
  line-height: inherit;
  white-space: nowrap;
  vertical-align: baseline;
}

.prose .tag--inline { text-decoration: none; }

/* Category is rendered as a plain uppercase label, not a pill. */
.category-label {
  font-family: var(--font-display);
  font-size: var(--step--2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
  color: var(--color-text);
}



/* Big category index cards */
.category-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.category-card {
  display: block;
  padding: var(--space-5);
  border: var(--hairline) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  text-decoration: none;
  transition: border-color var(--transition), transform var(--transition);
}

.category-card:hover {
  border-color: var(--color-text);
  transform: translateY(-2px);
}

.category-card__name,
.category-card__desc {
  /* Both are spans, so they need to be blocks to stack: the name, then the
     description, then the count, each on its own line. */
  display: block;
}

.category-card__name {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-0);
}

.category-card__desc {
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

.category-card__desc + .category-card__desc { margin-top: var(--space-2); }

/* ==========================================================================
   11. Pagination
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--color-border);
  font-family: var(--font-display);
  font-size: var(--step--1);
}

.pagination__pages {
  display: flex;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding-inline: var(--space-2);
  border: var(--hairline) solid transparent;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}

.pagination__link:hover { color: var(--color-text); border-color: var(--color-border); }

.pagination__link[aria-current="page"] {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-color: var(--color-accent);
}

.pagination__gap { display: inline-flex; align-items: center; padding-inline: var(--space-2); color: var(--color-text-subtle); }

.pagination__edge[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

/* ==========================================================================
   12. Search
   ========================================================================== */

.search-form {
  display: flex;
  gap: var(--space-2);
  width: 100%;
}

.search-form__field {
  position: relative;
  flex: 1 1 auto;
}

.search-form__input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) 2.75rem;
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-family: var(--font-display);
}

.search-form__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  pointer-events: none;
}

.search-summary {
  font-family: var(--font-display);
  font-size: var(--step--1);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.search-summary strong { color: var(--color-text); }

.search-results { margin-top: var(--space-6); }

.search-results mark {
  background: var(--color-highlight);
  color: var(--color-text);
  padding: 0 0.15em;
}

.search-suggestions {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--color-border);
}

/* ==========================================================================
   13. Forms
   ========================================================================== */

.form { display: grid; gap: var(--space-5); max-width: 34rem; }

.form-row { display: grid; gap: var(--space-2); }

@media (min-width: 40em) {
  .form-row--split { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
}

.form-label {
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 500;
}

.form-hint {
  font-family: var(--font-display);
  font-size: var(--step--2);
  color: var(--color-text-subtle);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--step-0);
  transition: border-color var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus { border-color: var(--color-text); }

.form-textarea { min-height: 10rem; resize: vertical; line-height: var(--leading-snug); }

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

.form-checkbox input { margin-top: 0.3em; accent-color: var(--color-text); }

.form-note {
  padding: var(--space-4);
  border-left: 2px solid var(--color-border-strong);
  background: var(--color-surface-alt);
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

/* ==========================================================================
   14. Comments (placeholder region)
   Markup ships disabled; drop a provider in later and remove [hidden].
   ========================================================================== */

.comments {
  max-width: var(--measure);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--color-border);
  scroll-margin-top: calc(var(--header-height) + var(--space-5));
}

.comments__title {
  font-size: var(--step-1);
  margin-bottom: var(--space-5);
}

.comments__closed {
  padding: var(--space-5);
  border: var(--hairline) dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  color: var(--color-text-muted);
  font-size: var(--step--1);
  text-align: center;
}

.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6); }

.comment {
  display: grid;
  gap: var(--space-2);
  padding-bottom: var(--space-5);
  border-bottom: var(--hairline) solid var(--color-border);
}

.comment__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
}

.comment__author { font-family: var(--font-display); font-weight: 700; font-size: var(--step-0); }
.comment__date { font-family: var(--font-display); font-size: var(--step--2); color: var(--color-text-subtle); }
.comment__body > * + * { margin-top: var(--space-3); }
.comment--reply { margin-left: var(--space-6); padding-left: var(--space-5); border-left: 2px solid var(--color-border); }

/* ==========================================================================
   15. Utilities
   ========================================================================== */

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

.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-center { text-align: center; }
.measure { max-width: var(--measure); }
.mono { font-family: var(--font-mono); }
.display { font-family: var(--font-display); }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.divider { border-top: var(--hairline) solid var(--color-border); }
.divider-strong { border-top: 2px solid var(--color-text); }

.no-js-hidden { display: none; }
.js .no-js-hidden { display: revert; }
.js .js-hidden { display: none; }

/* ==========================================================================
   16. Print
   ========================================================================== */

@media print {
  .site-header,
  .site-footer,
  .post-nav,
  .comments,
  .header-actions,
  .pagination { display: none !important; }

  body { background: #fff; color: #000; font-size: 11pt; }
  .prose { max-width: none; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #555; }
  .article-figure img, .prose img { max-height: 8cm; }
}
