/* tokens.css — design tokens (DESIGN.md §2, §3.2, §4.2)
   Brand palette: plum #601D49 · rose #BD5579 · blush #EA9D9D · cream #FFEBB8 */

:root {
  /* Brand */
  --plum: #601d49;
  --rose: #bd5579;
  --blush: #ea9d9d;
  --cream: #ffebb8;

  /* Surfaces (light) */
  --bg: #fbf7f0;
  --surface: #ffffff;
  --surface-2: #f7eee3;
  --code-bg: var(--cream);
  --prompt-bg: #fff4d6;
  --result-bg: #ffffff;
  --callout-note: rgba(234, 157, 157, 0.22);
  --callout-warning: var(--cream);
  --callout-pitfall: #f5d5d5;

  /* Text (light) */
  --text: var(--plum);
  --text-2: #7a5a6e;
  --text-on-brand: var(--cream);
  --code-text: #4a1a3a;

  /* Lines */
  --border: rgba(234, 157, 157, 0.55);
  --border-strong: var(--blush);
  --border-hover: var(--rose);

  /* Links & accents */
  --link: var(--rose);
  --link-hover: var(--plum);
  --accent: var(--rose);
  --focus: var(--rose);
  --header-bg: rgba(251, 247, 240, 0.85);

  /* Status (rating only) */
  --ok: #5a8c5a;
  --mid: var(--cream);
  --bad: #a04545;

  /* Pill */
  --pill-bg: rgba(234, 157, 157, 0.28);
  --pill-border: var(--blush);
  --pill-text: var(--plum);

  /* Rating stars */
  --star-empty: #f3dfc0;
  --star-full: var(--rose);

  /* Type */
  --font-sans: 'Noto Sans Thai', 'Fraunces', serif;
  --font-serif: 'Fraunces', 'Noto Sans Thai', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --fs-display: clamp(2.5rem, 5vw, 4rem);
  --fs-h1: clamp(2rem, 4vw, 2.75rem);
  --fs-h2: clamp(1.5rem, 2.5vw, 2rem);
  --fs-h3: clamp(1.25rem, 2vw, 1.5rem);
  --fs-body-lg: clamp(1.125rem, 1.5vw, 1.25rem);
  --fs-body: 1.0625rem;
  --fs-body-sm: 0.875rem;
  --fs-code: 0.9375rem;
  --fs-overline: 0.75rem;

  --lh-body: 1.7;
  --lh-tight: 1.25;
  --lh-sm: 1.5;
  --lh-code: 1.6;

  /* Spacing */
  --sp-xs: 0.5rem;
  --sp-sm: 0.75rem;
  --sp-md: 1rem;
  --sp-lg: 1.5rem;
  --sp-xl: 2.5rem;
  --sp-2xl: 4rem;
  --sp-3xl: 6rem;

  /* Layout */
  --container: 1100px;
  --measure: 720px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --header-h: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;

  color-scheme: light;
}

html.theme-dark {
  --bg: #1f1420;
  --surface: #2a1a2a;
  --surface-2: #33203a;
  --code-bg: #2d1f2d;
  --prompt-bg: #35263a;
  --result-bg: #2a1a2a;
  --callout-note: rgba(234, 157, 157, 0.14);
  --callout-warning: rgba(255, 235, 184, 0.14);
  --callout-pitfall: rgba(160, 69, 69, 0.28);

  --text: #f5efe6;
  --text-2: #c9b8c4;
  --text-on-brand: var(--cream);
  --code-text: var(--cream);

  --border: rgba(234, 157, 157, 0.28);
  --border-strong: rgba(234, 157, 157, 0.5);
  --border-hover: #d67094;

  --link: #d67094;
  --link-hover: var(--cream);
  --accent: #d67094;
  --focus: #d67094;
  --header-bg: rgba(31, 20, 32, 0.85);

  --pill-bg: rgba(234, 157, 157, 0.18);
  --pill-border: rgba(234, 157, 157, 0.55);
  --pill-text: #f5efe6;

  --star-empty: #4a3448;
  --star-full: #d67094;

  --ok: #8fbf8f;
  --bad: #d67a7a;

  color-scheme: dark;
}
/* Generated by scripts/fetch-fonts.mjs — self-hosted fonts (OFL licensed). Do not edit by hand. */
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/fraunces-400-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/fraunces-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/fraunces-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/fraunces-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-400-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-500-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-700-thai.woff2') format('woff2');
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/noto-sans-thai-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* base.css — reset + typography (DESIGN.md §3) */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

html:focus-within {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition:
    background-color 200ms ease,
    color 200ms ease;
}

main {
  flex: 1;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur) var(--ease);
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection {
  background: var(--blush);
  color: var(--plum);
}

/* Headings — Fraunces with Noto Sans Thai fallback for Thai glyphs */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--lh-tight);
  color: var(--text);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

h1 {
  font-size: var(--fs-h1);
}
h2 {
  font-size: var(--fs-h2);
}
h3 {
  font-size: var(--fs-h3);
}
h4 {
  font-size: var(--fs-body-lg);
}

p {
  text-wrap: pretty;
}

.display {
  font-size: var(--fs-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.lead {
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: var(--text-2);
  max-width: 60ch;
}

.overline {
  font-family: var(--font-mono);
  font-size: var(--fs-overline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

/* Thai text should not get wide letter-spacing (vowel marks detach) */
:lang(th) .overline {
  letter-spacing: 0.04em;
}

.small,
small {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-sm);
}

.muted {
  color: var(--text-2);
}

.num {
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: var(--fs-code);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html:focus-within {
    scroll-behavior: auto;
  }
}
/* layout.css — container, header, footer, page grids (DESIGN.md §4, §5.1, SPEC.md §2) */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure {
  max-width: var(--measure);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition:
    background-color 200ms ease,
    border-color 200ms ease;
}

.site-header.is-scrolled {
  background: var(--header-bg);
  border-bottom-color: var(--border);
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-header.is-scrolled {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
}

.brand {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.brand:hover {
  color: var(--link);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--sp-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm);
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--text);
}

.site-nav a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--rose);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition:
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--pill-bg);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon {
  display: none;
}
html.theme-dark .theme-toggle .icon-moon {
  display: block;
}
html.theme-dark .theme-toggle .icon-sun {
  display: none;
}

/* Hide toggle until JS is ready (no-JS users just get the OS preference) */
html.no-js .theme-toggle {
  visibility: hidden;
}

@media (max-width: 639px) {
  .site-header {
    --header-h: 56px;
  }
  .site-nav a {
    padding-inline: var(--sp-xs);
    font-size: 0.875rem;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--sp-3xl);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-xl) var(--sp-lg);
  color: var(--text-2);
}

.footer-inner {
  display: grid;
  gap: var(--sp-lg);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .footer-meta {
    grid-column: 1 / -1;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.footer-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  color: var(--text);
}

.footer-tagline {
  font-size: var(--fs-body-sm);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
}

.footer-nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: var(--fs-body-sm);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-nav a:hover {
  color: var(--link);
}

.footer-meta {
  font-size: var(--fs-body-sm);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
}

/* ---------- Page sections ---------- */
.page-hero {
  padding-block: var(--sp-2xl) var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.page-hero .display,
.page-hero h1 {
  max-width: 22ch;
}

@media (min-width: 1024px) {
  .page-hero {
    padding-block: var(--sp-3xl) var(--sp-xl);
  }
}

.section {
  padding-block: var(--sp-xl);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
  margin-bottom: var(--sp-lg);
}

.section__head h2 {
  font-size: var(--fs-h3);
}

/* Post grid — 1 col mobile, 2 col tablet+ */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-lg);
  list-style: none;
  padding: 0;
}

@media (min-width: 640px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-xl) var(--sp-xl);
  }
}

.post-grid > li[hidden] {
  display: none;
}

/* Post page layout — TOC column appears on desktop */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-xl);
}

@media (min-width: 1024px) {
  .post-layout.has-toc {
    grid-template-columns: 220px minmax(0, var(--measure));
    justify-content: center;
    gap: var(--sp-2xl);
  }
}

/* Small tag grid */
.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-md);
  list-style: none;
  padding: 0;
}

.tag-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-lg);
  list-style: none;
  padding: 0;
}

@media (min-width: 640px) {
  .tag-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .tag-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.stack-lg {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}
/* components.css — post card, pills, filter bar, code/prompt/result blocks,
   callouts, rating, TOC, breadcrumb, buttons (DESIGN.md §5, SPEC.md §4) */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xs);
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  text-decoration: none;
  transition:
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.btn:hover {
  border-color: var(--border-hover);
  color: var(--link);
}

.btn--primary {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--text-on-brand);
}

.btn--primary:hover {
  background: var(--rose);
  border-color: var(--rose);
  color: var(--surface);
}

html.theme-dark .btn--primary:hover {
  color: #1f1420;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 44px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.9375rem;
}

.link-arrow:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--pill-border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.pill--category {
  border-color: transparent;
}

a.pill:hover {
  border-color: var(--border-hover);
  color: var(--pill-text);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  list-style: none;
  padding: 0;
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  padding-block: var(--sp-md);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.filter-bar__label {
  margin-right: var(--sp-xs);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.25rem 0.875rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-decoration: none;
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.filter-btn.is-active,
.filter-btn[aria-pressed='true'] {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--text-on-brand);
}

.filter-bar .link-arrow {
  margin-left: auto;
  min-height: 36px;
}

.filter-empty {
  padding-block: var(--sp-xl);
  color: var(--text-2);
  text-align: center;
}

/* ---------- Post card ---------- */
.post-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease);
}

.post-card:hover,
.post-card:focus-within {
  border-color: var(--border-hover);
}

.post-card__title {
  font-size: 1.375rem;
  line-height: 1.3;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
}

.post-card__title a::after {
  /* stretch the click target across the card */
  content: '';
  position: absolute;
  inset: 0;
}

.post-card {
  position: relative;
}

.post-card__title a:hover {
  color: var(--link);
}

.post-card__excerpt {
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card__footer {
  margin-top: auto;
  padding-top: var(--sp-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.post-card__footer .pill {
  position: relative;
  z-index: 1;
}

.score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.125rem;
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.score__value {
  font-size: 1.125rem;
  font-weight: 500;
}

.score__max {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: 0.375rem;
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-2);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--link);
  text-decoration: underline;
}

.breadcrumb [aria-current='page'] {
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------- Post header ---------- */
.post-header {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  padding-block: var(--sp-lg) var(--sp-xl);
  border-bottom: 1px solid var(--border);
}

.post-header .lead {
  max-width: none;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm) var(--sp-md);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.post-meta__model {
  color: var(--text);
}

.post-meta__version {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.post-cover {
  margin-top: var(--sp-md);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ---------- TOC ---------- */
.toc {
  font-size: var(--fs-body-sm);
}

.toc__title {
  margin-bottom: var(--sp-sm);
}

.toc ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.toc li.depth-3 {
  padding-left: var(--sp-md);
}

.toc a {
  display: block;
  padding: 0.375rem var(--sp-sm);
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  line-height: 1.45;
  transition:
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.toc a:hover {
  color: var(--text);
  background: var(--pill-bg);
}

.toc a.is-active {
  color: var(--text);
  background: var(--pill-bg);
}

.toc--sticky {
  display: none;
}

.toc--inline {
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-xl);
}

@media (min-width: 1024px) {
  .toc--sticky {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + var(--sp-lg));
    align-self: start;
    max-height: calc(100dvh - var(--header-h) - var(--sp-2xl));
    overflow-y: auto;
  }
  .toc--inline {
    display: none;
  }
}

/* ---------- Prose (post body) ---------- */
.prose {
  max-width: var(--measure);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.prose > * + * {
  margin-top: 1em;
}

.prose > h2 {
  margin-top: 2.25em;
  padding-top: var(--sp-sm);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose > h3 {
  margin-top: 1.75em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose > h4 {
  margin-top: 1.5em;
}

.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.75em;
}

.prose p,
.prose li {
  max-width: 68ch;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
  display: flex;
  flex-direction: column;
  gap: 0.375em;
}

.prose li::marker {
  color: var(--rose);
}

.prose strong {
  font-weight: 700;
}

.prose :not(pre) > code {
  font-size: 0.875em;
  padding: 0.125em 0.4em;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 4px;
}

.prose blockquote {
  padding: var(--sp-md) var(--sp-lg);
  background: var(--callout-note);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-style: italic;
}

.prose blockquote p {
  max-width: none;
}

.prose figure {
  margin-block: var(--sp-lg);
}

.prose figure img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prose figcaption {
  margin-top: var(--sp-xs);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.prose img {
  border-radius: var(--radius);
}

.prose a[data-external]::after {
  content: '';
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.2em;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* Tables — comparison */
.prose table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose th,
.prose td,
.table th,
.table td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.prose thead th,
.table thead th {
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 0.9375rem;
}

.prose tbody tr:last-child td,
.table tbody tr:last-child td {
  border-bottom: 0;
}

.prose td:not(:first-child),
.table td:not(:first-child) {
  color: var(--text-2);
}

/* ---------- Code block ---------- */
.code-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
  margin-block: var(--sp-lg);
}

.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 0.375rem 0.5rem 0.375rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.code-block pre {
  margin: 0;
  padding: var(--sp-md) var(--sp-lg);
  overflow-x: auto;
  font-size: var(--fs-code);
  line-height: var(--lh-code);
  background: transparent !important;
  color: var(--code-text);
  tab-size: 2;
}

.code-block pre code {
  font-size: inherit;
  background: none;
  padding: 0;
  display: block;
  min-width: max-content;
}

.code-block[data-numbered] pre code {
  counter-reset: line;
}

.code-block[data-numbered] pre .line::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2.5ch;
  margin-right: 1.25rem;
  text-align: right;
  color: var(--text-2);
  opacity: 0.6;
  user-select: none;
}

/* Shiki dual theme — flip variables with the site theme (subtle, not rainbow) */
.code-block pre span {
  color: var(--shiki-light);
}
html.theme-dark .code-block pre span {
  color: var(--shiki-dark);
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  transition:
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.copy-btn:hover {
  color: var(--text);
  background: var(--pill-bg);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

.copy-btn .icon-check {
  display: none;
}

.copy-btn.is-copied .icon-copy {
  display: none;
}

.copy-btn.is-copied .icon-check {
  display: block;
  color: var(--ok);
}

html.no-js .copy-btn {
  display: none;
}

/* ---------- Prompt / Result blocks ---------- */
.block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-block: var(--sp-lg);
}

.block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 0.375rem 0.5rem 0.375rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.block__body {
  padding: var(--sp-md) var(--sp-lg);
}

.block__body > * + * {
  margin-top: 0.75em;
}

.block__body p {
  max-width: none;
}

.block--prompt {
  background: var(--prompt-bg);
}

.block--prompt .block__body {
  font-family: var(--font-mono);
  font-size: var(--fs-code);
  line-height: var(--lh-code);
  white-space: pre-wrap;
  color: var(--code-text);
}

.block--result {
  background: var(--result-bg);
}

.block--result .block__body {
  position: relative;
}

.block--result[data-collapsible] .block__body {
  max-height: 18rem;
  overflow: hidden;
}

.block--result[data-collapsible] .block__body::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 5rem;
  background: linear-gradient(to bottom, transparent, var(--result-bg));
  pointer-events: none;
}

.block--result[data-collapsible][data-expanded] .block__body {
  max-height: none;
}

.block--result[data-collapsible][data-expanded] .block__body::after {
  display: none;
}

.block__expand {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding-inline: 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--link);
}

.block__expand:hover {
  background: var(--pill-bg);
}

html.no-js .block__expand {
  display: none;
}

html.no-js .block--result[data-collapsible] .block__body {
  max-height: none;
}

html.no-js .block--result[data-collapsible] .block__body::after {
  display: none;
}

/* ---------- Callouts ---------- */
.callout {
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-block: var(--sp-lg);
}

.callout__label {
  display: block;
  margin-bottom: var(--sp-xs);
}

.callout > :not(.callout__label) + * {
  margin-top: 0.5em;
}

.callout p {
  max-width: none;
}

.callout--note,
.callout--tip {
  background: var(--callout-note);
}

.callout--warning {
  background: var(--callout-warning);
  border-color: var(--rose);
}

html.theme-dark .callout--warning {
  color: var(--text);
}

.callout--pitfall {
  background: var(--callout-pitfall);
  border-color: var(--bad);
}

.callout--pitfall .callout__label {
  color: var(--bad);
}

/* ---------- Rating ---------- */
.rating {
  margin-block: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.rating-table caption {
  text-align: left;
  padding-bottom: var(--sp-sm);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.rating-table td:nth-child(2) {
  white-space: nowrap;
  color: var(--text);
}

.rating-table .stars {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.star {
  width: 14px;
  height: 14px;
  color: var(--star-empty);
}

.star--full {
  color: var(--star-full);
}

.star--half {
  color: var(--star-full);
}

.rating-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--sp-sm) var(--sp-lg);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rating-summary__value {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.rating-total {
  font-size: 3rem;
  font-weight: 500;
  color: var(--text);
}

.rating-max {
  font-size: 1.125rem;
  color: var(--text-2);
}

.rating-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--star-empty);
  overflow: hidden;
}

.rating-fill {
  height: 100%;
  background: var(--rose);
  border-radius: inherit;
}

.rating-summary__label {
  grid-column: 1 / -1;
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

/* Aggregate score on tag pages */
.score-summary {
  display: grid;
  gap: var(--sp-lg);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (min-width: 640px) {
  .score-summary {
    grid-template-columns: auto 1fr;
    align-items: start;
  }
}

.score-summary__criteria {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  list-style: none;
  padding: 0;
}

.score-summary__criteria li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem var(--sp-md);
  font-size: var(--fs-body-sm);
}

.score-summary__criteria .rating-bar {
  grid-column: 1 / -1;
  height: 6px;
}

/* ---------- Tag cards ---------- */
.tag-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease);
}

.tag-card:hover {
  border-color: var(--border-hover);
}

.tag-card h3 {
  font-size: 1.25rem;
}

.tag-card__count {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.tag-card__latest {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  margin-top: var(--sp-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-card__latest time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.tag-card .link-arrow {
  margin-top: auto;
  min-height: 32px;
  font-size: var(--fs-body-sm);
}

/* Small tag tile (Testing now section) */
.tag-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  transition: border-color var(--dur) var(--ease);
}

.tag-tile:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.tag-tile__count {
  color: var(--text-2);
  font-size: 0.75rem;
}

/* ---------- Post footer ---------- */
.post-footer {
  margin-top: var(--sp-2xl);
  padding-top: var(--sp-xl);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

.share-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.share-row .overline {
  margin-right: var(--sp-xs);
}

.related-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.related-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
}

.related-item:last-child {
  border-bottom: 0;
}

.related-item a {
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1.125rem;
}

.related-item a:hover {
  color: var(--link);
}

.related-item time {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: var(--sp-lg);
  bottom: var(--sp-lg);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    visibility var(--dur);
  z-index: 40;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.back-to-top:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* ---------- Empty / 404 ---------- */
.empty {
  padding-block: var(--sp-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  align-items: flex-start;
}

/* ---------- Eyebrow ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-overline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: var(--sp-xs);
}

:lang(th) .eyebrow {
  letter-spacing: 0.04em;
}

/* ---------- Button variants ---------- */
.btn--text {
  border-color: transparent;
  background: transparent;
  color: var(--link);
}

.btn--text:hover {
  border-color: transparent;
  background: var(--pill-bg);
  color: var(--link-hover);
  text-decoration: underline;
}

.btn--outline {
  background: transparent;
}

/* ---------- Home page ---------- */
.home-page {
  padding-block: var(--sp-2xl) 0;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  padding-block: var(--sp-xl) var(--sp-2xl);
  max-width: var(--measure);
}

.hero h1 {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.hero h1 em {
  font-style: italic;
  color: var(--rose);
}

.hero__lede {
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: var(--text-2);
  max-width: 50ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
}

.posts-section {
  padding-block: var(--sp-xl);
  border-top: 1px solid var(--border);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-md);
  flex-wrap: wrap;
  margin-bottom: var(--sp-lg);
}

.section-heading h2 {
  font-size: var(--fs-h2);
}

.section-heading__count {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  font-family: var(--font-mono);
}

/* ---------- Filter bar (home) ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  padding-block: var(--sp-md);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 200px;
  min-width: 150px;
}

.filter-search input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  min-height: 36px;
}

.filter-search input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.filter-search span[aria-hidden] {
  position: absolute;
  right: 0.625rem;
  color: var(--text-2);
  pointer-events: none;
}

.filter-bar select {
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  min-height: 36px;
  cursor: pointer;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  transition:
    background-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.chip--active {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--text-on-brand);
}

/* ---------- Empty state ---------- */
.empty-state {
  padding-block: var(--sp-xl);
  color: var(--text-2);
  text-align: center;
}

/* ---------- Load more ---------- */
.load-more {
  margin-top: var(--sp-xl);
  display: flex;
  margin-inline: auto;
}

.load-more[hidden] {
  display: none;
}

/* ---------- Testing now section ---------- */
.testing-now {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  padding-block: var(--sp-2xl);
  border-top: 1px solid var(--border);
  max-width: var(--measure);
}

.testing-now h2 {
  font-size: var(--fs-h2);
}

.testing-now h2 em {
  font-style: italic;
  color: var(--rose);
}

.aggregate-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.aggregate-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) 0;
  border-bottom: 1px solid var(--border);
}

.aggregate-row:last-child {
  border-bottom: 0;
}

.model-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--model-color, var(--rose));
  flex-shrink: 0;
}

.aggregate-bar {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.aggregate-bar i {
  display: block;
  height: 100%;
  background: var(--rose);
  border-radius: inherit;
}

.aggregate-row b {
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
  min-width: 2.5rem;
  text-align: right;
}

/* ---------- Post page ---------- */
.post-page {
  padding-block: var(--sp-lg) 0;
}

.post-header__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-xs) var(--sp-sm);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.post-header__excerpt {
  font-size: var(--fs-body-lg);
  line-height: 1.6;
  color: var(--text-2);
  max-width: 60ch;
}

.post-header__model {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.post-header__model strong {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1rem;
}

.post-sidebar {
  /* TOC sticky column — only visible on desktop via .toc--sticky */
}

.markdown-body {
  max-width: var(--measure);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

.markdown-body > * + * {
  margin-top: 1em;
}

.markdown-body > h2 {
  margin-top: 2.25em;
  padding-top: var(--sp-sm);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.markdown-body > h3 {
  margin-top: 1.75em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.markdown-body > h4 {
  margin-top: 1.5em;
}

.markdown-body h2 + *,
.markdown-body h3 + *,
.markdown-body h4 + * {
  margin-top: 0.75em;
}

.markdown-body p,
.markdown-body li {
  max-width: 68ch;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em;
  display: flex;
  flex-direction: column;
  gap: 0.375em;
}

.markdown-body li::marker {
  color: var(--rose);
}

.markdown-body strong {
  font-weight: 700;
}

.markdown-body :not(pre) > code {
  font-size: 0.875em;
  padding: 0.125em 0.4em;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 4px;
}

.markdown-body blockquote {
  padding: var(--sp-md) var(--sp-lg);
  background: var(--callout-note);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-style: italic;
}

.markdown-body blockquote p {
  max-width: none;
}

.markdown-body figure {
  margin-block: var(--sp-lg);
}

.markdown-body figure img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.markdown-body figcaption {
  margin-top: var(--sp-xs);
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

.markdown-body img {
  border-radius: var(--radius);
}

.markdown-body a[data-external]::after {
  content: '';
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-left: 0.2em;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.markdown-body th,
.markdown-body td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.markdown-body thead th {
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-serif);
  font-weight: 500;
}

.markdown-body tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-body td:not(:first-child) {
  color: var(--text-2);
}

/* ---------- Related posts ---------- */
.related-posts {
  margin-top: var(--sp-2xl);
  padding-top: var(--sp-xl);
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: var(--fs-h3);
  margin-top: var(--sp-xs);
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--sp-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease);
}

.related-card:hover {
  border-color: var(--border-hover);
}

.related-card span {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  font-family: var(--font-mono);
}

.related-card strong {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  color: var(--text);
  font-weight: 500;
}

.related-card:hover strong {
  color: var(--link);
}

/* ---------- Archive / Tags page ---------- */
.archive-page {
  padding-block: var(--sp-2xl) 0;
}

.archive-page h1 {
  font-size: var(--fs-h1);
  margin-top: var(--sp-xs);
}

.archive-intro {
  font-size: var(--fs-body-lg);
  color: var(--text-2);
  max-width: 60ch;
  margin-top: var(--sp-sm);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  text-decoration: none;
  margin-bottom: var(--sp-lg);
}

.back-link:hover {
  color: var(--link);
}

.tag-stats {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  flex-wrap: wrap;
  margin-block: var(--sp-lg) var(--sp-xl);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tag-stats strong {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text);
}

.tag-stats span {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
}

/* ---------- Tag card (index) ---------- */
.tag-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease);
}

.tag-card:hover {
  border-color: var(--border-hover);
}

.tag-card__type {
  font-family: var(--font-mono);
  font-size: var(--fs-overline);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

.tag-card h2 {
  font-size: 1.25rem;
  margin-top: var(--sp-xs);
}

.tag-card p {
  font-size: var(--fs-body-sm);
  color: var(--text-2);
  flex: 1;
}

.tag-card strong {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  color: var(--text);
}

/* ---------- About page ---------- */
.about-page {
  padding-block: var(--sp-2xl) 0;
  max-width: var(--measure);
}

.about-page h1 {
  font-size: var(--fs-h1);
  margin-top: var(--sp-xs);
}

.about-page h1 em {
  font-style: italic;
  color: var(--rose);
}

/* ---------- 404 page ---------- */
.error-page {
  padding-block: var(--sp-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  align-items: flex-start;
  max-width: var(--measure);
}

.error-code {
  font-family: var(--font-serif);
  font-size: 4rem;
  font-weight: 500;
  color: var(--rose);
  line-height: 1;
}

.error-page h1 {
  font-size: var(--fs-h2);
}

.error-page p {
  color: var(--text-2);
}
