/* Editorial blog theme: mobile first, no framework, system fonts. Dark mode follows the OS. */
:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1b1b1f;
  --muted: #5a5a66;
  --border: #e3e0d8;
  --accent: #a82f0d;
  --accent-ink: #ffffff;
  --tint: #f1eee7;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, "Times New Roman", serif;
  --radius: 12px;
  --gutter: 1rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --surface: #1a1a1f;
    --text: #ececf0;
    --muted: #a6a6b3;
    --border: #2d2d35;
    --accent: #ff9070;
    --accent-ink: #1b0a04;
    --tint: #202027;
  }
}
@media (min-width: 640px) { :root { --gutter: 1.5rem; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.6 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-block: 1.5rem 4rem; }
main:focus { outline: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
ul { padding: 0; }
figure { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--gutter); top: -4rem; background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: 0 0 8px 8px; z-index: 10; font-weight: 600; }
.skip-link:focus { top: 0; }

.wrap, .wrap-narrow { width: 100%; margin-inline: auto; padding-inline: var(--gutter); }
.wrap { max-width: calc(70rem + 2 * var(--gutter)); }
.wrap-narrow { max-width: calc(46rem + 2 * var(--gutter)); }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 0.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.brand-logo { width: 2rem; height: 2rem; object-fit: contain; border-radius: 6px; }
.site-nav { flex-basis: 100%; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.site-nav a { display: block; padding: 0.5rem 0; color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.35em; text-decoration-thickness: 2px; }
.nav-toggle { display: none; font: inherit; font-weight: 600; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.9rem; cursor: pointer; }
.js .nav-toggle { display: inline-block; }
.js .site-nav { display: none; }
.js .site-nav.open { display: block; }
@media (min-width: 700px) {
  .js .nav-toggle { display: none; }
  .site-nav, .js .site-nav { display: block; flex-basis: auto; }
  .site-nav ul { flex-direction: row; gap: 1.75rem; }
}

/* Buttons, chips, badges */
.button { display: inline-block; background: var(--accent); color: var(--accent-ink); padding: 0.7rem 1.4rem; border-radius: 999px; font-weight: 600; text-decoration: none; }
.button:hover { filter: brightness(1.08); }
.chips ul, .tags, .archive-list, .site-footer ul, .share ul { list-style: none; margin: 0; padding: 0; }
.chips ul, .tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { display: inline-block; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; text-decoration: none; color: var(--accent); }
.chips .chip { background: var(--tint); border: 1px solid var(--border); color: var(--text); text-transform: none; font-size: 0.9375rem; padding: 0.4rem 0.9rem; border-radius: 999px; }
.chips .chip:hover { border-color: var(--accent); color: var(--accent); }
.count { margin-left: 0.5rem; color: var(--muted); font-weight: 500; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--tint); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 0.4rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8125rem; font-weight: 700; color: var(--accent); margin-bottom: 0; }
.meta, .byline { color: var(--muted); font-size: 0.875rem; margin: 0 0 0.4rem; }
.byline { font-size: 0.95rem; }
.author { color: var(--text); font-weight: 600; }
.lede { font-size: 1.2rem; color: var(--muted); font-family: var(--serif); max-width: 40rem; }
.empty { color: var(--muted); text-align: center; padding: 4rem 0; }
.more { margin-top: 2.5rem; text-align: center; }

/* Home */
.hero-intro { padding-block: 1.5rem 1rem; }
.hero-intro h1 { font-size: clamp(2.25rem, 7vw, 4rem); margin: 0 0 0.25rem; letter-spacing: -0.03em; }
.hero-intro .lede { margin: 0; font-size: 1.35rem; }
.section-title { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin: 2.5rem 0 1.25rem; }
.page-head { padding-block: 1rem 0.5rem; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0.25rem 0; }

/* Cards */
.grid { display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgb(0 0 0 / 0.1); }
.card-media { display: block; aspect-ratio: 16 / 9; background: var(--tint); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1.1rem 1.25rem 1.4rem; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.card-title { font-size: 1.25rem; margin: 0.15rem 0 0.25rem; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card-excerpt { margin: 0; color: var(--muted); font-family: var(--serif); }
.card-feature .card-title { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -0.02em; }
.card-feature .card-excerpt { font-size: 1.1rem; }
@media (min-width: 900px) {
  .card-feature { flex-direction: row; }
  .card-feature .card-media { flex: 1.3; aspect-ratio: auto; min-height: 22rem; }
  .card-feature .card-body { flex: 1; justify-content: center; padding: 2rem; }
}
.card .chip { position: relative; z-index: 1; }

/* Article */
.article-header { padding-top: 1.5rem; }
.article-header h1 { font-size: clamp(2rem, 6vw, 3.25rem); margin: 0.5rem 0 1rem; letter-spacing: -0.025em; }
.hero { margin-block: 1.5rem 2rem; }
.hero img { width: 100%; border-radius: var(--radius); }
.prose { font-family: var(--serif); font-size: 1.1875rem; line-height: 1.75; overflow-wrap: break-word; }
.prose::after { content: ""; display: block; clear: both; }
.prose > * { margin-block: 0 1.25em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); margin-top: 2em; margin-bottom: 0.6em; }
.prose h2 { font-size: 1.65rem; }
.prose h3 { font-size: 1.3rem; }
.prose img { border-radius: 8px; margin-inline: auto; }
.prose blockquote { margin-inline: 0; padding: 0.25rem 0 0.25rem 1.25rem; border-left: 4px solid var(--accent); color: var(--muted); font-style: italic; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--tint); padding: 0.15em 0.35em; border-radius: 4px; }
.prose pre { background: var(--tint); border: 1px solid var(--border); padding: 1rem; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
.prose pre code { background: none; padding: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--sans); font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.prose th { background: var(--tint); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin-block: 2.5em; }
.fig { margin: 1.75rem auto; }
.fig img { margin-inline: auto; }
.fig figcaption { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); text-align: center; margin-top: 0.5rem; }
@media (min-width: 640px) {
  .fig-left { float: left; margin: 0.4rem 1.75rem 1rem 0; }
  .fig-right { float: right; margin: 0.4rem 0 1rem 1.75rem; }
}
.article-footer { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1.25rem; }
.tags a { display: inline-block; background: var(--tint); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.9rem; text-decoration: none; color: var(--text); }
.tags a:hover { color: var(--accent); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; font-size: 0.95rem; }
.share > span { font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8125rem; }
.share ul { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.share a { display: inline-block; padding: 0.3rem 0.85rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 500; }
.share a:hover { border-color: var(--accent); color: var(--accent); }

.pager { display: grid; gap: 1rem; margin-top: 3rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent); }
.pager span { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pager-next { text-align: right; grid-column: 2; }
@media (max-width: 639px) { .pager-next { grid-column: auto; } }

/* Archive & lists */
.archive-list li { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
.archive-list a { font-size: 1.15rem; font-weight: 600; color: var(--text); text-decoration: none; }
.archive-list a:hover { color: var(--accent); }
.archive-list .meta { margin: 0.15rem 0 0; }
.archive-list .chip { font-size: 0.75rem; }
.chips { margin-block: 1rem 0.5rem; }
.not-found { text-align: center; }
.not-found .archive-list { text-align: left; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--tint); padding-block: 2rem; color: var(--muted); font-size: 0.95rem; }
.site-footer .wrap { display: flex; flex-direction: column; gap: 1rem; }
.site-footer strong { color: var(--text); font-size: 1.1rem; }
.site-footer p { margin: 0.25rem 0 0; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer a { color: var(--text); }
@media (min-width: 700px) { .site-footer .wrap { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; } .copyright { flex-basis: 100%; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --border: #bbb; --tint: #f3f3f3; --accent: #000; }
  body { font-size: 11pt; display: block; }
  .site-header, .site-footer, .skip-link, .share, .pager, .related, .chips, .nav-toggle { display: none !important; }
  main { padding: 0; }
  .wrap, .wrap-narrow { max-width: none; padding: 0; }
  .prose { font-size: 11pt; line-height: 1.5; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
  .prose img, .fig { break-inside: avoid; }
  h1, h2, h3 { break-after: avoid; }
}

.align-center { text-align: center; }
.align-right { text-align: right; }
