/* ==========================================================================
   衡渊博的日常记录 — site stylesheet
   Swiss modernism 2.0 · paper editorial · no external fonts
   ========================================================================== */

/* ---------- design tokens ---------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, "Noto Serif SC",
    "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas,
    "Courier New", monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: clamp(1.75rem, 2.2vw, 2.25rem);
  --text-3xl: clamp(2.25rem, 4.5vw, 3.5rem);
  --text-display: clamp(2.6rem, 6.4vw, 4.6rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  --container: 1160px;
  --article: 720px;
  --gutter: 24px;
  --header-h: 68px;
  --radius: 2px;
  --radius-lg: 4px;

  --z-header: 100;
  --z-nav: 90;
  --z-progress: 200;

  /* light palette */
  --paper: #fbf9f4;
  --paper-soft: #f4f0e6;
  --ink: #171614;
  --ink-2: #3e3a33;
  --muted: #6e685c;
  --line: #e4ded2;
  --accent: #a33a29;
  --accent-soft: #f1e3dd;
  --on-accent: #ffffff;
  --code-bg: #1b1a17;
  --code-ink: #e9e3d6;

  /* feature cover (inverted block) */
  --cover-bg: #171614;
  --cover-ink: #f4f0e6;
  --cover-muted: #a79e8b;
  --cover-accent: #e98a73;

  /* footer */
  --footer-bg: #171614;
  --footer-bg-deep: #100f0d;
  --footer-ink: #ede7da;
  --footer-muted: #a79e8b;
  --footer-line: #332f27;
  --footer-accent: #e98a73;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --paper: #131311;
  --paper-soft: #1b1a17;
  --ink: #ede7da;
  --ink-2: #cfc8b9;
  --muted: #a19987;
  --line: #2c2a24;
  --accent: #e97f65;
  --accent-soft: #2b1d18;
  --on-accent: #1a0f0b;
  --code-bg: #0c0c0a;
  --code-ink: #e7e1d4;

  --cover-bg: #e8e1d2;
  --cover-ink: #171614;
  --cover-muted: #5c574c;
  --cover-accent: #a33a29;

  --footer-bg: #0c0c0a;
  --footer-bg-deep: #080807;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  transition: background-color 250ms ease, color 250ms ease;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 180ms ease;
}

button {
  font: inherit;
  color: inherit;
}

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

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

:target {
  scroll-margin-top: calc(var(--header-h) + 24px);
}

/* icon defaults */
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

/* hidden must win over component display rules (article filters) */
[hidden] {
  display: none !important;
}

/* ---------- layout helpers ---------- */
.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

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

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 300;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-sm);
  border-radius: var(--radius);
  transition: top 180ms ease;
}

.skip-link:focus {
  top: 12px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transition: background-color 250ms ease, border-color 250ms ease;
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 44px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1;
  border-radius: var(--radius);
  padding-top: 2px;
  transition: background-color 250ms ease, color 250ms ease;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-nav {
  margin-left: auto;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
}

.site-nav a:hover {
  color: var(--ink);
}

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

.site-nav a[aria-current="page"] {
  color: var(--ink);
}

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

.theme-toggle,
.nav-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease;
}

.theme-toggle:hover,
.nav-toggle:hover {
  background: var(--paper-soft);
  color: var(--ink);
  border-color: var(--muted);
}

.theme-toggle .icon-sun {
  display: none;
}

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

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

.nav-toggle {
  display: none;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

/* ---------- buttons & links ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease, transform 150ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-thickness 180ms ease;
}

.text-link:hover {
  text-decoration-thickness: 2px;
}

.text-link .icon {
  transition: transform 200ms var(--ease-out);
}

.text-link:hover .icon {
  transform: translateX(4px);
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(56px, 8vw, 104px) 0 clamp(48px, 7vw, 88px);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-6);
  align-items: start;
}

.hero-copy {
  grid-column: 1 / span 7;
}

.hero h1 {
  margin-top: var(--space-5);
  font-family: var(--font-serif);
  font-size: var(--text-display);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.hero h1 .accent-mark {
  color: var(--accent);
  font-style: normal;
}

.hero-lede {
  margin-top: var(--space-5);
  max-width: 34em;
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.hero-note {
  margin-top: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hero-latest {
  grid-column: 9 / span 4;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-head a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
  min-height: 24px;
  display: inline-flex;
  align-items: center;
}

.panel-head a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.latest-list li + li {
  border-top: 1px solid var(--line);
}

.latest-list a {
  display: block;
  padding: 16px 20px;
  transition: background-color 180ms ease;
}

.latest-list a:hover {
  background: var(--paper-soft);
}

.latest-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.latest-title {
  display: block;
  margin-top: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
}

.latest-list a:hover .latest-title {
  color: var(--accent);
}

/* ---------- sections ---------- */
.section {
  padding: clamp(56px, 7vw, 88px) 0;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  line-height: 1.3;
}

.section-head p {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ---------- featured post ---------- */
.feature {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}

.feature-cover {
  grid-column: 1 / span 5;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 32px;
  min-height: 340px;
  background: var(--cover-bg);
  color: var(--cover-ink);
  transition: background-color 250ms ease, color 250ms ease;
}

.feature-cover-middle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.feature-cover-index {
  font-family: var(--font-serif);
  font-size: 104px;
  line-height: 0.8;
  letter-spacing: -0.02em;
  color: var(--cover-ink);
  opacity: 0.92;
}

.feature-cover-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cover-accent);
}

.feature-cover-word {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  color: var(--cover-ink);
}

.feature-cover-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid color-mix(in srgb, var(--cover-ink) 22%, transparent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--cover-muted);
}

.feature-body {
  grid-column: 6 / span 7;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
  padding: clamp(28px, 4vw, 48px);
  min-width: 0;
}

.feature-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.feature-meta .cat {
  color: var(--accent);
}

.feature h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

.feature h3 a:hover {
  color: var(--accent);
}

.feature-excerpt {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------- post rows ---------- */
.post-list {
  margin-top: var(--space-6);
  border-top: 1px solid var(--line);
}

.post-row {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: var(--space-5);
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.post-row::before {
  content: "";
  position: absolute;
  inset: 0 -12px;
  z-index: -1;
  background: var(--paper-soft);
  opacity: 0;
  border-radius: var(--radius);
  transition: opacity 180ms ease;
}

.post-row:hover::before {
  opacity: 1;
}

.post-row-date {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}

.post-row-main {
  min-width: 0;
}

.post-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-row-meta .cat {
  color: var(--accent);
}

.post-row h3 {
  margin-top: 8px;
  font-family: var(--font-serif);
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1.45;
}

.post-row h3 a:hover {
  color: var(--accent);
}

.post-row-excerpt {
  margin-top: 8px;
  max-width: 62ch;
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- category cards ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 190px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: background-color 200ms ease, border-color 200ms ease,
    box-shadow 200ms ease;
}

.category-card:hover {
  background: var(--paper-soft);
  border-color: var(--muted);
  box-shadow: 0 18px 40px -28px rgba(23, 22, 20, 0.35);
}

.category-card-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.category-card h3 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.4;
}

.category-card p {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--muted);
}

.category-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.category-card-foot .icon {
  transition: transform 200ms var(--ease-out);
}

.category-card:hover .category-card-foot .icon {
  transform: translateX(4px);
  color: var(--accent);
}

/* ---------- about strip ---------- */
.about-strip {
  display: block;
}

.about-strip-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-5);
}

.about-strip blockquote {
  grid-column: 1 / span 8;
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  line-height: 1.65;
  padding-left: var(--space-5);
  border-left: 2px solid var(--accent);
  text-wrap: balance;
}

.about-strip-copy {
  grid-column: 9 / span 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--ink-2);
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: var(--space-9);
  background: var(--footer-bg);
  color: var(--footer-ink);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.7fr 1.2fr;
  gap: var(--space-7);
  padding: clamp(48px, 6vw, 72px) 0 0;
}

.footer-brand .brand {
  color: var(--footer-ink);
}

.footer-brand .brand-mark {
  background: var(--footer-accent);
  color: var(--footer-bg);
}

.footer-brand .brand-text {
  color: var(--footer-ink);
}

.footer-brand p {
  margin-top: var(--space-4);
  max-width: 30em;
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--footer-muted);
}

.footer-brand .footer-meta {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  line-height: 1.8;
  color: var(--footer-muted);
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--footer-muted);
  margin-bottom: var(--space-4);
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: var(--text-sm);
  color: var(--footer-ink);
  opacity: 0.85;
}

.footer-nav a:hover {
  color: var(--footer-accent);
  opacity: 1;
}

.icp-card {
  border: 1px solid var(--footer-line);
  border-top: 2px solid var(--footer-accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--footer-bg-deep);
}

.icp-card .footer-heading {
  color: var(--footer-accent);
  margin-bottom: var(--space-3);
}

.icp-number {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--footer-ink);
}

.icp-number a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.icp-number a:hover {
  color: var(--footer-accent);
  text-decoration-thickness: 2px;
}

.icp-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--footer-muted);
}

.icp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--footer-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.icp-link:hover {
  text-decoration-thickness: 2px;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-top: clamp(40px, 5vw, 56px);
  padding: 20px 0;
  border-top: 1px solid var(--footer-line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--footer-muted);
}

.footer-bottom a {
  color: var(--footer-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.footer-bottom a:hover {
  color: var(--footer-accent);
}

/* ---------- inner page header ---------- */
.page-head {
  padding: clamp(48px, 6vw, 76px) 0 clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin-top: var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.page-lede {
  margin-top: var(--space-4);
  max-width: 46em;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--ink-2);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- article index / filters ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--line);
}

.chip {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease;
}

.chip:hover {
  background: var(--paper-soft);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.post-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.article-index {
  padding: var(--space-4) 0 var(--space-9);
}

.article-index .post-list {
  margin-top: 0;
}

.empty-state {
  padding: var(--space-8) 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
  text-align: center;
}

/* ---------- archive ---------- */
.archive {
  padding: var(--space-6) 0 var(--space-9);
}

.archive-year + .archive-year {
  margin-top: var(--space-8);
}

.archive-year-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.archive-year-head h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
}

.archive-year-head span {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.archive-list li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: var(--space-5);
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.archive-list time {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.archive-list a {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
}

.archive-list a:hover {
  color: var(--accent);
}

.archive-list .cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-left: 10px;
  font-weight: 400;
}

/* ---------- about page ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(40px, 6vw, 72px);
  padding: var(--space-7) 0 var(--space-9);
  align-items: start;
}

.facts {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--paper);
}

.facts h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.facts dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.facts dd {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--ink-2);
}

.facts .facts-divider {
  height: 1px;
  background: var(--line);
}

/* ---------- prose (article + about) ---------- */
.prose {
  font-size: 1.0625rem;
  line-height: 1.95;
  color: var(--ink);
  overflow-wrap: break-word;
}

.prose > * + * {
  margin-top: 1.25em;
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 2.4em;
  letter-spacing: 0.01em;
}

.prose h2::before {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--accent);
  margin-bottom: 18px;
}

.prose h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 2em;
}

.prose p {
  color: var(--ink-2);
}

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

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-thickness: 2px;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li {
  margin: 0.45em 0;
  padding-left: 0.2em;
}

.prose li::marker {
  color: var(--accent);
}

.prose blockquote {
  margin: 2em 0;
  padding: 20px 24px;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--ink);
}

.prose blockquote p {
  color: var(--ink);
}

.prose blockquote p + p {
  margin-top: 0.8em;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.14em 0.42em;
  border-radius: 2px;
  white-space: nowrap;
}

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

.prose img {
  border-radius: var(--radius);
  height: auto;
}

/* code blocks (built by JS around pre) */
.code-block {
  margin: 2em 0;
  background: var(--code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--code-ink) 12%, transparent);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--code-ink) 12%, transparent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--code-ink) 62%, transparent);
}

.copy-btn {
  min-height: 28px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--code-ink) 24%, transparent);
  border-radius: 2px;
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.copy-btn:hover {
  background: color-mix(in srgb, var(--code-ink) 12%, transparent);
  border-color: color-mix(in srgb, var(--code-ink) 40%, transparent);
}

.copy-btn.is-done {
  border-color: var(--cover-accent);
  color: var(--cover-accent);
}

.code-block pre {
  margin: 0;
  padding: 20px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--code-ink);
  tab-size: 2;
}

.code-block pre code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  color: inherit;
  padding: 0;
  white-space: pre;
}

/* ---------- article ---------- */
.article-main {
  padding-bottom: var(--space-8);
}

.article-header {
  padding-top: clamp(40px, 5vw, 64px);
}

.article-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.article-kicker a {
  color: var(--accent);
}

.article-kicker a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-header h1 {
  margin-top: var(--space-4);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.875rem);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.article-lede {
  margin-top: var(--space-4);
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--ink-2);
}

.article-body {
  margin-top: var(--space-7);
}

.article-footer {
  margin-top: var(--space-8);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.author-note {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  margin-top: var(--space-5);
  padding: 20px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.author-note .brand-mark {
  width: 40px;
  height: 40px;
  font-size: 20px;
  flex-shrink: 0;
}

.author-note p {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--ink-2);
}

.author-note strong {
  color: var(--ink);
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.post-nav a {
  display: block;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.post-nav a:hover {
  background: var(--paper-soft);
  border-color: var(--muted);
}

.post-nav > :only-child {
  grid-column: 1 / -1;
}

.post-nav .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.post-nav .title {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.5;
}

.post-nav .next {
  text-align: right;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-6);
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* reading progress */
.reading-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: var(--z-progress);
  pointer-events: none;
}

.reading-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- 404 ---------- */
.notfound {
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  min-height: 62vh;
  padding: var(--space-9) var(--space-5);
}

.notfound-code {
  font-family: var(--font-serif);
  font-size: clamp(6rem, 18vw, 11rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.02em;
}

.notfound-code .accent-mark {
  color: var(--accent);
  font-style: normal;
}

.notfound h1 {
  margin-top: var(--space-5);
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.125rem);
  font-weight: 600;
}

.notfound p {
  margin-top: var(--space-3);
  max-width: 32em;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.8;
}

.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
  justify-content: center;
}

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.reveal.is-visible,
.reveal:focus-within {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .footer-grid {
    grid-template-columns: 1.4fr 0.8fr 0.8fr;
  }

  .icp-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .hero-copy {
    grid-column: 1 / -1;
  }

  .hero-latest {
    grid-column: 1 / -1;
    margin-top: var(--space-4);
  }

  .latest-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .latest-list li + li {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .feature {
    grid-template-columns: 1fr;
  }

  .feature-cover {
    grid-column: 1 / -1;
    min-height: 240px;
    padding: 28px;
  }

  .feature-cover-index {
    font-size: 72px;
  }

  .feature-body {
    grid-column: 1 / -1;
  }

  .about-strip blockquote {
    grid-column: 1 / -1;
  }

  .about-strip-copy {
    grid-column: 1 / -1;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .facts {
    position: static;
  }
}

@media (max-width: 860px) {
  :root {
    --header-h: 60px;
    --gutter: 20px;
  }

  .nav-toggle {
    display: grid;
  }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: var(--z-nav);
    margin-left: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 200ms ease, transform 200ms var(--ease-out),
      visibility 200ms;
    box-shadow: 0 30px 40px -34px rgba(0, 0, 0, 0.5);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }

  .nav-open .site-nav {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-nav a {
    height: 52px;
    padding: 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--line);
  }

  .site-nav li:last-child a {
    border-bottom: 0;
  }

  .site-nav a::after {
    left: 0;
    right: auto;
    width: 24px;
    bottom: 10px;
  }

  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .post-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 22px 0;
  }

  .post-row-date {
    padding-top: 0;
  }

  .post-row h3 {
    font-size: 1.1875rem;
  }

  .archive-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav .next {
    text-align: left;
  }
}

@media (max-width: 680px) {
  .latest-list {
    grid-template-columns: 1fr;
  }

  .latest-list li + li {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

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

  .icp-card {
    grid-column: auto;
  }

  .feature-cover {
    min-height: 210px;
    gap: var(--space-3);
  }

  .feature-cover-index {
    font-size: 56px;
  }

  .feature-cover-word {
    font-size: 1.4rem;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .article-header h1 {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
  }

  .prose {
    font-size: 1rem;
    line-height: 1.9;
  }

  .prose h2 {
    font-size: 1.375rem;
  }

  .prose blockquote {
    padding: 16px 18px;
    font-size: 1.0625rem;
  }
}

@media (max-width: 420px) {
  .brand-text {
    font-size: 1rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 10vw, 2.6rem);
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- reduced motion ---------- */
@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;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- print ---------- */
@media print {
  .site-header,
  .site-footer,
  .reading-progress,
  .post-nav,
  .back-link,
  .skip-link,
  .theme-toggle,
  .copy-btn {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .container-narrow {
    width: 100%;
  }

  .prose a {
    color: #000;
    text-decoration: underline;
  }
}