/* Dunquixote — a quiet, reading-first editorial theme */

:root {
  color-scheme: light;
  --paper: #f4f0e7;
  --paper-deep: #ece6da;
  --surface: #faf7f0;
  --surface-raised: #fffdf8;
  --ink: #252a26;
  --ink-soft: #484f49;
  --muted: #686f68;
  --accent: #536e58;
  --accent-strong: #3d5843;
  --accent-soft: #e1e7dc;
  --border: #d7d1c4;
  --border-strong: #b8b2a5;
  --header-bg: rgba(244, 240, 231, 0.92);
  --code-bg: #e8e4da;
  --pre-bg: #263029;
  --pre-ink: #edf1e9;
  --focus: #356b45;
  --selection: #cfddc9;
  --shadow: 0 16px 42px rgba(45, 48, 40, 0.08);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-heading: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --container: 72rem;
  --reading: 46rem;
  --radius: 0.45rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171b18;
  --paper-deep: #111512;
  --surface: #1d231f;
  --surface-raised: #242b26;
  --ink: #e9e6dc;
  --ink-soft: #c8cbc1;
  --muted: #a7aea4;
  --accent: #a7bba2;
  --accent-strong: #c3d2bb;
  --accent-soft: #2b382e;
  --border: #3a433b;
  --border-strong: #5a655a;
  --header-bg: rgba(23, 27, 24, 0.92);
  --code-bg: #29322b;
  --pre-bg: #101511;
  --pre-ink: #e8eee4;
  --focus: #b6d4ae;
  --selection: #3c5540;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #171b18;
    --paper-deep: #111512;
    --surface: #1d231f;
    --surface-raised: #242b26;
    --ink: #e9e6dc;
    --ink-soft: #c8cbc1;
    --muted: #a7aea4;
    --accent: #a7bba2;
    --accent-strong: #c3d2bb;
    --accent-soft: #2b382e;
    --border: #3a433b;
    --border-strong: #5a655a;
    --header-bg: rgba(23, 27, 24, 0.92);
    --code-bg: #29322b;
    --pre-bg: #101511;
    --pre-ink: #e8eee4;
    --focus: #b6d4ae;
    --selection: #3c5540;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  }
}

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

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

body {
  min-width: 18rem;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

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

.container {
  width: min(var(--container), calc(100% - 3rem));
  margin-inline: auto;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 1rem;
  transform: translateY(-180%);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.6;
  text-transform: uppercase;
}

.button {
  min-height: 2.85rem;
  padding: 0.7rem 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-strong);
  color: var(--surface-raised);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: var(--surface-raised);
  transform: translateY(-1px);
}

.button-secondary {
  background: transparent;
  color: var(--accent-strong);
}

.button-secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* Header and navigation */

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  min-height: 5rem;
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}

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

.brand-mark {
  width: 2.45rem;
  height: 2.45rem;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 0.35rem;
  background: var(--accent-strong);
  color: var(--surface-raised);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.site-nav {
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.site-nav a {
  position: relative;
  padding: 0.5rem 0.1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-decoration: none;
}

.site-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0.1rem;
  left: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: center;
  background: var(--accent);
  transition: transform 160ms ease;
}

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

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-button {
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.icon-button:hover,
.icon-button[aria-current="page"] {
  border-color: var(--border);
  background: var(--surface);
  color: var(--accent-strong);
}

.icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 0.28rem;
}

.nav-toggle span {
  width: 1.15rem;
  height: 1.5px;
  display: block;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

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

.theme-toggle .moon-icon {
  display: block;
}

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

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

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

  :root:not([data-theme]) .theme-toggle .moon-icon {
    display: none;
  }
}

/* Home hero */

.hero {
  padding-block: clamp(4.25rem, 9vw, 7.75rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 13rem;
  align-items: end;
  gap: clamp(3rem, 8vw, 7rem);
  border-bottom: 1px solid var(--border);
}

.hero-copy {
  max-width: 49rem;
}

.hero h1 {
  max-width: 46rem;
  margin-top: 1.15rem;
  font-size: clamp(2.65rem, 6.2vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.22;
}

.hero-description {
  max-width: 38rem;
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.13rem);
  line-height: 1.9;
}

.hero-actions {
  margin-top: 2.1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.35rem;
}

.hero-note {
  padding-left: 2rem;
  border-left: 1px solid var(--border-strong);
  color: var(--muted);
}

.note-rule {
  width: 2.25rem;
  height: 2px;
  margin-bottom: 1.4rem;
  display: block;
  background: var(--accent);
}

.hero-note p {
  font-size: 0.82rem;
}

.hero-note strong {
  margin-block: 0.25rem;
  display: block;
  color: var(--accent-strong);
  font-family: var(--font-heading);
  font-size: 4.8rem;
  font-weight: 400;
  line-height: 1.15;
}

.hero-years {
  margin-top: 1.2rem;
  display: block;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

/* Home content, cards, and sidebar */

.home-grid {
  padding-block: 4.25rem 6rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  align-items: start;
  gap: clamp(3rem, 7vw, 5.5rem);
}

.section-heading {
  min-height: 4.6rem;
  padding-bottom: 1.1rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border-strong);
}

.section-heading h2 {
  margin-top: 0.35rem;
  font-size: 1.8rem;
  font-weight: 500;
}

.post-card {
  position: relative;
  padding-block: 1.8rem;
  border-bottom: 1px solid var(--border);
}

.post-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.035em;
}

.post-card h3 {
  margin-top: 0.65rem;
  font-size: clamp(1.3rem, 2.5vw, 1.55rem);
  font-weight: 600;
  line-height: 1.5;
}

.post-card h3 a {
  color: var(--ink);
  text-decoration: none;
  transition: color 160ms ease;
}

.post-card:hover h3 a,
.post-card h3 a:hover {
  color: var(--accent-strong);
}

.post-excerpt {
  margin-top: 0.75rem;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.post-card-bottom {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.category-links,
.tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
}

.category-links a,
.category-links span {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
}

.category-links a:hover {
  text-decoration: underline;
}

.read-more {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
}

.read-more:hover {
  color: var(--accent-strong);
}

.sidebar {
  display: grid;
  gap: 1.25rem;
}

.side-block {
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.side-block h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.about-block {
  border-color: transparent;
  background: var(--accent-soft);
}

.about-block h2 {
  margin-top: 0.55rem;
  font-size: 1.45rem;
}

.about-block > p:not(.eyebrow) {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.9;
}

.signature {
  margin-top: 1.25rem;
  display: block;
  color: var(--accent-strong);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-style: italic;
}

.side-heading {
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.side-heading > a {
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
}

.side-heading > a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.category-list a {
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-decoration: none;
}

.category-list a:last-child {
  border-bottom: 0;
}

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

.category-list a span:last-child {
  min-width: 1.5rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-align: right;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag-cloud a {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.5;
  text-decoration: none;
}

.tag-cloud a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.tag-cloud sup {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.6rem;
}

/* Shared interior page headings */

.page-heading {
  max-width: 58rem;
  padding-block: clamp(4rem, 8vw, 6.25rem) clamp(2.75rem, 6vw, 4.25rem);
}

.page-heading h1 {
  margin-top: 0.85rem;
  font-size: clamp(2.35rem, 5vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.page-heading > p:last-child:not(.eyebrow) {
  max-width: 39rem;
  margin-top: 1.1rem;
  color: var(--muted);
  line-height: 1.9;
}

.compact-heading {
  padding-bottom: 2rem;
}

.listing-layout {
  max-width: 58rem;
  padding-bottom: 6rem;
}

.listing-layout .post-list {
  border-top: 1px solid var(--border-strong);
}

/* Archive */

.archive-list {
  max-width: 62rem;
  padding-bottom: 6rem;
}

.archive-year {
  padding-block: 2.25rem 2.75rem;
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 2.5rem;
  border-top: 1px solid var(--border-strong);
}

.archive-year-heading h2 {
  color: var(--accent-strong);
  font-size: 2.8rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.archive-year-heading span {
  margin-top: 0.3rem;
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.archive-month + .archive-month {
  margin-top: 1.75rem;
}

.archive-month h3 {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.archive-month ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-month li {
  padding-block: 0.55rem;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1rem;
}

.archive-month time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-variant-numeric: tabular-nums;
}

.archive-month li a {
  color: var(--ink-soft);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  line-height: 1.65;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.archive-month li a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Category and tag indexes */

.taxonomy-grid {
  padding-bottom: 6rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.term-card {
  min-height: 12.5rem;
  position: relative;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.term-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--surface-raised);
  color: var(--ink);
}

.term-symbol {
  margin-bottom: 1.25rem;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.65rem;
  line-height: 1;
}

.term-card h2 {
  padding-right: 1rem;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.term-card > span:not(.term-symbol, .term-arrow) {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.term-arrow {
  position: absolute;
  right: 1.35rem;
  bottom: 1.35rem;
  color: var(--accent-strong);
}

/* Post page and prose */

.post-shell {
  max-width: 62rem;
  padding-block: clamp(3rem, 7vw, 5.5rem) 6rem;
}

.post-header {
  max-width: 52rem;
  margin-inline: auto;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  color: var(--muted);
  font-size: 0.76rem;
}

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

.breadcrumbs a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.post-header h1 {
  margin-top: 1.35rem;
  font-size: clamp(2.25rem, 5.5vw, 3.65rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.post-meta {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 1.25rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.post-meta > span {
  position: relative;
}

.post-meta > span::before {
  content: "";
  width: 3px;
  height: 3px;
  position: absolute;
  top: 50%;
  left: -0.7rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.post-content,
.post-footer {
  max-width: var(--reading);
  margin-inline: auto;
}

.post-content {
  margin-top: clamp(2.75rem, 6vw, 4.25rem);
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 2;
  overflow-wrap: break-word;
  word-break: normal;
}

.post-content > :first-child {
  margin-top: 0 !important;
}

.post-content > :last-child {
  margin-bottom: 0 !important;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content dl,
.post-content blockquote,
.post-content pre,
.post-content table,
.post-content .table-wrapper,
.post-content .code-block,
.post-content figure,
.post-content hr {
  margin-block: 0 1.65rem;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  position: relative;
  margin: 3.1rem 0 1rem;
  scroll-margin-top: 7rem;
  color: var(--ink);
}

.post-content h2 {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.75rem;
  font-weight: 600;
}

.post-content h3 {
  font-size: 1.4rem;
}

.post-content h4 {
  font-size: 1.18rem;
}

.post-content h5,
.post-content h6 {
  font-family: var(--font-body);
  font-size: 1rem;
}

.post-content a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.post-content a:hover {
  text-decoration-color: currentColor;
}

.post-content strong {
  color: var(--ink);
  font-weight: 650;
}

.post-content ul,
.post-content ol {
  padding-left: 1.55rem;
}

.post-content li {
  padding-left: 0.2rem;
  margin-block: 0.35rem;
}

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

.post-content li > ul,
.post-content li > ol {
  margin-block: 0.35rem;
}

.post-content dt {
  color: var(--ink);
  font-weight: 650;
}

.post-content dd {
  margin: 0.25rem 0 1rem 1.25rem;
}

.heading-anchor {
  margin-left: 0.55rem;
  opacity: 0;
  color: var(--accent) !important;
  font-family: var(--font-body);
  font-size: 0.75em;
  font-weight: 400;
  text-decoration: none !important;
  transition: opacity 150ms ease;
}

.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor,
.post-content h5:hover .heading-anchor,
.post-content h6:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 1;
}

.post-content blockquote {
  padding: 0.35rem 0 0.35rem 1.35rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-family: var(--font-heading);
  font-size: 1.08rem;
  line-height: 1.9;
}

.post-content blockquote > :last-child {
  margin-bottom: 0;
}

.post-content blockquote blockquote {
  margin-top: 1rem;
}

.post-content hr {
  width: 100%;
  height: 1px;
  margin-block: 3rem;
  border: 0;
  background: var(--border);
}

.post-content img {
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: var(--radius);
}

.post-content figure {
  margin-inline: 0;
  text-align: center;
}

.post-content figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.7;
}

.post-content p > img:only-child {
  margin-block: 0.4rem;
}

.post-content code,
.post-content kbd,
.post-content samp {
  font-family: var(--font-mono);
}

.post-content :not(pre) > code {
  padding: 0.16em 0.35em;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--code-bg);
  color: var(--ink);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.post-content kbd {
  padding: 0.15em 0.4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8em;
}

.code-block {
  position: relative;
}

.post-content pre {
  max-width: 100%;
  padding: 1.35rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--pre-bg);
  color: var(--pre-ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.75;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
  -webkit-overflow-scrolling: touch;
}

.post-content .code-block pre {
  margin: 0;
  padding-top: 3.15rem;
}

.post-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
}

.code-copy {
  min-width: 3.4rem;
  min-height: 2rem;
  position: absolute;
  z-index: 1;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid #59655c;
  border-radius: 0.3rem;
  background: #323d35;
  color: #f0f3ec;
  font-family: var(--font-body);
  font-size: 0.7rem;
  line-height: 1.4;
}

.code-copy:hover {
  border-color: #a7bba2;
  background: #414e44;
}

.code-copy:focus-visible {
  outline-color: #d6e8ce;
  outline-offset: 2px;
}

.code-copy[data-state="success"] {
  border-color: #a7c69d;
  color: #dcefd4;
}

.code-copy[data-state="failure"] {
  border-color: #e4a89d;
  color: #ffd7ce;
}

.post-content table {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: auto;
  border-spacing: 0;
  border-collapse: collapse;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.post-content .table-wrapper table {
  min-width: 100%;
  display: table;
  margin: 0;
  overflow: visible;
  border: 0;
}

.post-content th,
.post-content td {
  min-width: 5rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.post-content th {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 650;
}

.post-content tr:nth-child(even) td {
  background: var(--surface);
}

.post-content .footnote {
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.8;
}

.post-content .footnote hr {
  width: 5rem;
  margin: 0 0 1.5rem;
  background: var(--border-strong);
}

.post-content .footnote-ref,
.post-content .footnote-backref {
  padding-inline: 0.15rem;
  font-family: var(--font-body);
  text-decoration: none;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  border-top: 1px solid var(--border);
}

.tag-list:empty {
  display: none;
}

.tag-list a {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  color: var(--muted);
  font-size: 0.74rem;
  text-decoration: none;
}

.tag-list a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.post-navigation {
  max-width: 52rem;
  margin: 3.5rem auto 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.post-nav-card {
  min-height: 8rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.post-nav-card:hover {
  border-color: var(--accent);
  background: var(--surface-raised);
  color: var(--ink);
}

.post-nav-card > span {
  color: var(--muted);
  font-size: 0.72rem;
}

.post-nav-card > strong {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.post-nav-card:last-child {
  text-align: right;
}

.post-nav-placeholder {
  min-height: 1px;
}

/* Search */

.search-heading {
  padding-bottom: 2rem;
}

.search-container {
  max-width: 58rem;
  padding-bottom: 6rem;
}

.search-label {
  margin-bottom: 0.55rem;
  display: inline-block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.search-box {
  position: relative;
}

.search-box svg {
  width: 1.3rem;
  height: 1.3rem;
  position: absolute;
  top: 50%;
  left: 1.1rem;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.6;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  min-height: 4rem;
  padding: 0.85rem 1.1rem 0.85rem 3.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}

.search-box input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search-box input:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.search-box input::-webkit-search-cancel-button {
  cursor: pointer;
}

.search-status {
  min-height: 1.7rem;
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-results {
  margin-top: 1.25rem;
}

.search-results .post-list {
  border-top: 1px solid var(--border-strong);
}

.search-empty {
  padding: clamp(2.5rem, 7vw, 4.5rem) 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
}

.search-empty h2 {
  font-size: 1.45rem;
}

.search-empty p {
  max-width: 28rem;
  margin: 0.75rem auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-empty .button {
  margin-top: 1.5rem;
}

.noscript-note {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

/* 404 */

.not-found {
  max-width: 48rem;
  min-height: 65vh;
  padding-block: clamp(5rem, 12vw, 9rem);
  text-align: center;
}

.error-code {
  margin-bottom: 1.5rem;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: clamp(6rem, 18vw, 10rem);
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 0.8;
}

.not-found h1 {
  margin-top: 0.8rem;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 500;
}

.not-found > p:not(.error-code, .eyebrow) {
  margin-top: 1rem;
  color: var(--muted);
}

.not-found .hero-actions {
  justify-content: center;
}

/* Footer */

.site-footer {
  flex: none;
  border-top: 1px solid var(--border);
  background: var(--paper-deep);
}

.footer-top {
  padding-block: 2.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.footer-brand .brand-mark {
  width: 2.15rem;
  height: 2.15rem;
  font-size: 1.3rem;
}

.footer-brand .brand-name {
  font-size: 1.1rem;
}

.footer-top > div > p {
  max-width: 31rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.85;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.5rem;
}

.footer-nav a {
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.footer-bottom {
  padding-block: 1.15rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
}

.footer-bottom .icp-link {
  color: inherit;
  text-decoration: none;
}

.footer-bottom .icp-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Responsive layout */

@media (max-width: 62rem) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr) 15.5rem;
    gap: 3rem;
  }

  .taxonomy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 52rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 10rem;
    gap: 2.5rem;
  }

  .hero-note {
    padding-left: 1.5rem;
  }

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

  .sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .about-block,
  .side-block {
    height: 100%;
  }
}

@media (max-width: 47.5rem) {
  html {
    scroll-padding-top: 6rem;
  }

  .site-header-inner {
    min-height: 4.35rem;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .brand {
    margin-right: auto;
  }

  .brand-mark {
    width: 2.15rem;
    height: 2.15rem;
    font-size: 1.3rem;
  }

  .brand-name {
    font-size: 1.08rem;
  }

  .header-actions {
    order: 2;
  }

  .nav-toggle {
    order: 3;
  }

  .js .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    width: 100%;
    margin: 0;
    padding: 0.75rem 0 1rem;
    order: 4;
    flex: 0 0 100%;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    border-top: 1px solid var(--border);
  }

  .js .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    left: 0;
    display: none;
    padding: 0.65rem;
    flex-direction: column;
    gap: 0.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-raised);
    box-shadow: var(--shadow);
  }

  .js .site-header.nav-open .site-nav {
    display: flex;
  }

  .js .site-nav a {
    padding: 0.65rem 0.75rem;
    border-radius: 0.25rem;
  }

  .js .site-nav a::after {
    display: none;
  }

  .js .site-nav a[aria-current="page"] {
    background: var(--accent-soft);
  }

  .site-header.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(0.39rem) rotate(45deg);
  }

  .site-header.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .site-header.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-0.39rem) rotate(-45deg);
  }

  .hero {
    padding-block: 4rem;
    grid-template-columns: 1fr;
    gap: 3rem;
  }

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

  .hero-note {
    padding: 1.5rem 0 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 0.75rem;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .note-rule {
    grid-column: 1 / -1;
    margin-bottom: 0.75rem;
  }

  .hero-note p:first-of-type {
    grid-column: 1 / -1;
  }

  .hero-note strong {
    margin: 0;
    font-size: 3.6rem;
  }

  .hero-note p:last-of-type {
    align-self: center;
  }

  .hero-years {
    grid-column: 1 / -1;
    margin-top: 0.35rem;
  }

  .home-grid {
    padding-block: 3.25rem 4.5rem;
  }

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

  .side-block {
    height: auto;
  }

  .archive-year {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .archive-year-heading {
    display: flex;
    align-items: baseline;
    gap: 1rem;
  }

  .archive-year-heading h2 {
    font-size: 2.25rem;
  }

  .post-content h2,
  .post-content h3,
  .post-content h4,
  .post-content h5,
  .post-content h6 {
    scroll-margin-top: 5.5rem;
  }

  .heading-anchor {
    opacity: 0.7;
  }

  .footer-top {
    flex-direction: column;
  }
}

@media (max-width: 35rem) {
  .container {
    width: min(var(--container), calc(100% - 2rem));
  }

  .site-header-inner {
    gap: 0.1rem;
  }

  .brand {
    gap: 0.5rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .icon-button {
    width: 2.45rem;
    height: 2.45rem;
  }

  .hero {
    padding-block: 3.25rem;
  }

  .hero h1 {
    letter-spacing: -0.025em;
  }

  .hero-actions {
    gap: 1rem;
  }

  .section-heading {
    align-items: center;
  }

  .section-heading .text-link {
    flex: none;
    font-size: 0.76rem;
  }

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

  .read-more {
    align-self: flex-end;
  }

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

  .term-card {
    min-height: 10.5rem;
  }

  .archive-month li {
    grid-template-columns: 2.9rem minmax(0, 1fr);
    gap: 0.65rem;
  }

  .post-header h1 {
    font-size: 2.25rem;
  }

  .post-content {
    font-size: 0.98rem;
    line-height: 1.95;
  }

  .post-content h2 {
    font-size: 1.55rem;
  }

  .post-content pre {
    padding: 1rem;
    font-size: 0.77rem;
  }

  .post-content .code-block pre {
    padding-top: 3rem;
  }

  .post-content th,
  .post-content td {
    padding: 0.6rem 0.7rem;
  }

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

  .post-nav-card {
    min-height: 6.75rem;
  }

  .post-nav-card:last-child {
    text-align: left;
  }

  .post-nav-placeholder {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-width: 22rem) {
  .brand-name {
    display: none;
  }
}

/* Motion and print preferences */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --paper: #fff;
    --paper-deep: #fff;
    --surface: #fff;
    --surface-raised: #fff;
    --ink: #111;
    --ink-soft: #222;
    --muted: #444;
    --accent: #333;
    --accent-strong: #111;
    --border: #bbb;
    --border-strong: #888;
  }

  .site-header,
  .site-footer,
  .post-navigation,
  .post-footer,
  .code-copy,
  .heading-anchor {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .post-shell {
    padding: 0;
  }

  .post-content {
    max-width: none;
    font-size: 11pt;
  }

  .post-content pre {
    overflow: visible;
    border-color: #aaa;
    background: #f5f5f5;
    color: #111;
    white-space: pre-wrap;
  }

  .post-content a {
    color: #111;
  }
}
