:root {
  --paper: #f3efe7;
  --ink: #28251f;
  --muted: #716a5f;
  --accent: #a3482d;
  --line: #cfc7b8;
  --soft-line: #dcd5c8;
  --code: #22201c;
  --code-ink: #f7f1e7;
  --shell: 1120px;
  --reading: 760px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: .22em; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
.site-shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { font-family: ui-serif, Georgia, "Noto Serif SC", "Songti SC", serif; font-weight: 700; text-decoration: none; letter-spacing: .03em; }
.site-nav { display: flex; align-items: center; gap: 24px; font-size: .9rem; }
.site-nav > a { text-decoration: none; }
.nav-search input { width: 118px; border: 0; border-bottom: 1px solid var(--line); padding: 5px 2px; background: transparent; color: var(--ink); outline: none; }
.nav-search input:focus { border-color: var(--accent); }
.nav-toggle { display: none; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 10px; }

.hero { padding-block: clamp(76px, 12vw, 150px) clamp(64px, 9vw, 112px); }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: .74rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.hero h1, .page-header h1, .article-header h1, .error-page h1 {
  max-width: 820px;
  margin: 0;
  font-family: ui-serif, Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -.045em;
}
.hero-name { margin: 34px 0 0; font-family: ui-serif, Georgia, "Noto Serif SC", serif; font-size: 1.15rem; }
.hero-bio { max-width: 590px; margin: 8px 0 0; color: var(--muted); }

.home-section { padding-block: 38px 74px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 24px; }
.section-heading h2, .discovery h2 { margin: 0; font-size: .78rem; letter-spacing: .13em; text-transform: uppercase; }
.section-heading > a { font-size: .88rem; }
.article-list { border-bottom: 1px solid var(--soft-line); }
.article-card { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 28px; padding: 29px 0 32px; border-top: 1px solid var(--soft-line); }
.article-card-cover, .article-card-cover-placeholder { display: block; aspect-ratio: 16 / 9; overflow: hidden; text-decoration: none; }
.article-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.article-card-cover:hover img, .article-card-cover:focus-visible img { transform: scale(1.03); }
.article-card-cover-placeholder { background: var(--soft-line); border: 1px solid var(--line); }
.article-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .78rem; }
.article-card h2 { margin: 10px 0 8px; font-family: ui-serif, Georgia, "Noto Serif SC", serif; font-size: clamp(1.45rem, 3vw, 2.15rem); line-height: 1.24; font-weight: 500; }
.article-card h2 a { text-decoration: none; }
.article-card p { max-width: 720px; margin: 0; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; font-size: .78rem; }
.tag-row a { color: var(--accent); text-decoration: none; }
.empty-state { padding: 34px 0; color: var(--muted); }

.discovery { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; padding-block: 58px 90px; border-top: 1px solid var(--line); }
.link-cloud { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.link-cloud a { border-bottom: 1px solid var(--line); padding: 4px 0; text-decoration: none; }
.link-cloud span { color: var(--muted); font-size: .76rem; }

.page-header { padding-block: 78px 58px; }
.page-header h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); }
.page-header > p:last-child { max-width: 650px; margin: 20px 0 0; color: var(--muted); }
.pagination { display: flex; justify-content: space-between; padding-top: 28px; }

.article-detail { width: min(calc(100% - 40px), var(--reading)); padding-block: 76px 110px; }
.article-header { padding-bottom: 42px; border-bottom: 1px solid var(--line); }
.article-header h1 { margin-top: 16px; font-size: clamp(2.45rem, 7vw, 4.6rem); }
.article-deck { margin: 22px 0 0; color: var(--muted); font-size: 1.08rem; }
.prose { padding-top: 42px; font-family: ui-serif, Georgia, "Noto Serif SC", "Songti SC", serif; font-size: 1.08rem; }
.prose h1 { display: none; }
.prose h2, .prose h3 { margin: 2.1em 0 .7em; line-height: 1.25; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin-block: 1.25em; }
.prose img { max-width: 100%; height: auto; }
.article-detail .prose img { cursor: zoom-in; }
.article-detail .prose img:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.prose blockquote { margin-inline: 0; border-left: 3px solid var(--accent); padding-left: 20px; color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .92rem; }
.prose th, .prose td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
.prose pre { overflow-x: auto; border-radius: 4px; padding: 20px; background: var(--code) !important; color: var(--code-ink); font-family: "Cascadia Code", Consolas, monospace; font-size: .9rem; line-height: 1.55; }
.prose :not(pre) > code { border-radius: 3px; background: rgba(163, 72, 45, .1); padding: .12em .35em; color: var(--accent); }

body.lightbox-open { overflow: hidden; }
.image-lightbox { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; max-height: none; margin: 0; border: 0; padding: 48px; background: transparent; overflow: hidden; }
.image-lightbox[open] { display: grid; place-items: center; }
.image-lightbox::backdrop { background: rgba(20, 18, 15, .92); }
.image-lightbox img { max-width: 100%; max-height: calc(100vh - 96px); object-fit: contain; }
.image-lightbox-close { position: fixed; top: 18px; right: 20px; z-index: 1; width: 42px; height: 42px; border: 1px solid rgba(255, 255, 255, .55); border-radius: 50%; background: rgba(20, 18, 15, .7); color: #fff; cursor: pointer; font-size: 1.7rem; line-height: 1; }
.image-lightbox-close:hover, .image-lightbox-close:focus-visible { border-color: #fff; outline: 2px solid #fff; outline-offset: 2px; }

.error-page { min-height: 65vh; padding-block: 100px; }
.error-page h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.error-page > p:not(.eyebrow) { color: var(--muted); }
.text-link { display: inline-block; margin-top: 20px; }

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 28px; color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; gap: 18px; }

@media (max-width: 768px) {
  .site-shell, .article-detail { width: min(calc(100% - 28px), var(--shell)); }
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; inset: 68px 14px auto; z-index: 10; border: 1px solid var(--line); background: var(--paper); padding: 18px; flex-direction: column; align-items: stretch; }
  .site-nav.is-open { display: flex; }
  .nav-search input { width: 100%; }
  .hero { padding-block: 72px 66px; }
  .discovery { grid-template-columns: 1fr; gap: 44px; }
  .article-card { grid-template-columns: 1fr; gap: 18px; }
  .article-detail { padding-block: 58px 82px; }
  .image-lightbox { padding: 20px; }
  .image-lightbox img { max-height: calc(100vh - 40px); }
  .footer-inner { align-items: flex-start; flex-direction: column; padding-block: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .article-card-cover img { transition: none; }
}
