:root {
  color-scheme: light dark;
  --paper: #f7f6f2;
  --surface: #fffefa;
  --ink: #19211e;
  --muted: #65706b;
  --line: #d9ddd8;
  --accent: #176b54;
  --accent-strong: #0d4e3c;
  --code: #e9eee9;
  --shadow: 0 18px 50px rgba(24, 39, 33, .08);
  --measure: 72rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); line-height: 1.7; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { color: var(--accent-strong); }
img, video, canvas, svg { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; }
:focus-visible { outline: .2rem solid #e29a22; outline-offset: .2rem; }

.skip-link { position: fixed; z-index: 100; top: .5rem; left: .5rem; padding: .6rem 1rem; color: #fff; background: #111; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.visually-hidden { 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; }

.site-header { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(14px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; width: min(calc(100% - 2rem), var(--measure)); margin: auto; min-height: 4.2rem; }
.brand { color: var(--ink); font-family: ui-serif, Georgia, serif; font-size: 1.3rem; font-weight: 750; text-decoration: none; letter-spacing: -.02em; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .45rem 1.15rem; }
.site-header nav a { color: var(--muted); font-size: .92rem; font-weight: 650; text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }

#main-content { min-height: calc(100vh - 11rem); }
.page-shell, .article, .standalone-page { width: min(calc(100% - 2rem), var(--measure)); margin: 0 auto; padding: clamp(3rem, 8vw, 7rem) 0; }
.article { width: min(calc(100% - 2rem), 50rem); }
.eyebrow { margin: 0 0 .5rem; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: ui-serif, Georgia, "Noto Serif", serif; line-height: 1.18; letter-spacing: -.025em; text-wrap: balance; }
h1 { margin: 0 0 1.5rem; font-size: clamp(2.25rem, 8vw, 5.25rem); }
h2 { margin-top: 2.4rem; font-size: clamp(1.45rem, 4vw, 2.25rem); }
h3 { margin-top: 2rem; font-size: 1.25rem; }
.article-header { padding-bottom: 2.4rem; border-bottom: 1px solid var(--line); }
.article-meta, .entry-date { color: var(--muted); font-size: .9rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.tag { display: inline-flex; padding: .18rem .7rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; text-decoration: none; }

.prose { font-family: ui-serif, Georgia, "Noto Serif", serif; font-size: clamp(1.04rem, 2vw, 1.16rem); }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 1.35em 0; }
.prose blockquote { margin-left: 0; padding: .3rem 0 .3rem 1.4rem; border-left: .25rem solid var(--accent); color: var(--muted); }
.prose pre { overflow-x: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--code); font-size: .9rem; line-height: 1.55; }
.prose code { padding: .1em .3em; border-radius: .25rem; background: var(--code); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.prose pre code { padding: 0; background: none; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { padding: .65rem; border: 1px solid var(--line); text-align: left; }
.prose hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--line); }

.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.entry-card { min-height: 13rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); box-shadow: var(--shadow); }
.entry-card h2 { margin: .35rem 0 .75rem; font-size: 1.5rem; }
.entry-card h2 a { color: var(--ink); text-decoration: none; }
.entry-card p:last-child { color: var(--muted); }
.taxonomy-list { max-width: 42rem; padding: 0; list-style: none; }
.taxonomy-list li { display: flex; justify-content: space-between; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.pager { display: flex; gap: .5rem; justify-content: center; margin-top: 3rem; }
.pager a, .pager strong { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; }
.article-relations { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.related { margin-top: 3rem; padding: 1.5rem; border-radius: .65rem; background: var(--surface); }
.related h2 { margin-top: 0; font-size: 1.3rem; }

.search-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; max-width: 42rem; }
.search-form label { grid-column: 1 / -1; font-weight: 700; }
.search-form input { min-width: 0; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .4rem; color: var(--ink); background: var(--surface); }
.search-form button { padding: .75rem 1.2rem; border: 0; border-radius: .4rem; color: #fff; background: var(--accent); cursor: pointer; }
#search-results { max-width: 46rem; margin-top: 2rem; }
.search-result { padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.search-result h2 { margin: 0; font-size: 1.35rem; }

.app-frame-wrap { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: .75rem; background: #000; aspect-ratio: 16 / 10; }
.app-frame { width: 100%; height: 100%; border: 0; }
.lede { max-width: 50rem; color: var(--muted); font-size: 1.15rem; }
.site-footer { width: min(calc(100% - 2rem), var(--measure)); margin: auto; padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

@media (max-width: 42rem) {
  .header-inner { align-items: flex-start; flex-direction: column; gap: .25rem; padding: .65rem 0; }
  .site-header { position: static; }
  .article-relations { flex-direction: column; }
  .search-form { grid-template-columns: 1fr; }
  h1 { font-size: 2.5rem; }
}

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

@media (prefers-color-scheme: dark) {
  :root { --paper: #121714; --surface: #19211d; --ink: #edf2ee; --muted: #a5b0aa; --line: #35413b; --accent: #79d5b2; --accent-strong: #a7ebd1; --code: #202b25; --shadow: none; }
}

@media print {
  .site-header, .site-footer, .article-relations, .related { display: none; }
  :root { color-scheme: light; --paper: #fff; --ink: #000; }
  .article { width: 100%; padding: 0; }
  a { color: inherit; text-decoration: none; }
}
