/* JOE'S BLOG — Field Notes. System fonts, quiet surfaces, one accent. */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: Georgia, "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --container: 1184px;
  --header-h: 82px;
  --bg: #f8f7f4;
  --surface: #fffefc;
  --surface-soft: #f0efeb;
  --ink: #252931;
  --ink-soft: #4b505a;
  --muted: #666a73;
  --faint: #6e727c;
  --line: #e2e0da;
  --accent: #4263d5;
  --accent-hover: #304cb0;
  --accent-soft: #e9edfa;
  --paper: #e7eaf3;
  --paper-ink: #3e4b71;
  --header-bg: rgba(248, 247, 244, .94);
  --shadow: 0 12px 35px -25px rgba(34, 39, 48, .22);
  --code-bg: #f2f2f5;
  --code-head: #eaeaf0;
  --code-fg: #3b4050;
  --hl-comment: #69707e;
  --hl-keyword: #7859aa;
  --hl-string: #9a593c;
  --hl-number: #916024;
  --hl-title: #3a64bd;
  --hl-attr: #8f5c38;
  --hl-meta: #6a65a3;
  --hl-deletion: #a44848;
  color-scheme: light;
}
html[data-theme='dark'] {
  --bg: #18191d;
  --surface: #202126;
  --surface-soft: #27282e;
  --ink: #eeedf0;
  --ink-soft: #c4c5cc;
  --muted: #aaabb5;
  --faint: #a1a4af;
  --line: #393b45;
  --accent: #a5b5ff;
  --accent-hover: #c4cfff;
  --accent-soft: #2d3450;
  --paper: #30384e;
  --paper-ink: #dbe1ff;
  --header-bg: rgba(24, 25, 29, .94);
  --shadow: 0 12px 35px -25px rgba(0, 0, 0, .55);
  --code-bg: #15161b;
  --code-head: #23252e;
  --code-fg: #d4d7e4;
  --hl-comment: #9da3b5;
  --hl-keyword: #c5aff5;
  --hl-string: #e3ba9b;
  --hl-number: #e4c691;
  --hl-title: #b0c4ff;
  --hl-attr: #dfbba2;
  --hl-meta: #c6b5f1;
  --hl-deletion: #eea7a7;
  color-scheme: dark;
}

/* Foundation */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.75 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: none; text-underline-offset: 5px; transition: color .18s, background-color .18s, border-color .18s, transform .18s; }
a:hover { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
img { max-width: 100%; height: auto; }
svg { flex-shrink: 0; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin-top: 0; }
h1, h2, h3, h4 { color: var(--ink); }
.container { width: min(100%, var(--container)); margin-inline: auto; padding-inline: 40px; }
#main { min-height: 55vh; padding-top: 60px; padding-bottom: 80px; }
.page-home #main { padding-top: 0; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 200; padding: 12px 20px; background: var(--ink); color: var(--bg); border-radius: 6px; }
.skip-link:focus { top: 12px; }
.eyebrow, .section-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; color: var(--muted); font: 10px/1.6 var(--font-mono); letter-spacing: .14em; }
.eyebrow-dot { display: inline-block; flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 22px; min-height: 46px; padding: 10px 20px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 550; }
.button-primary { background: var(--ink); color: var(--bg); }
.button-primary:hover { background: var(--accent); color: var(--bg); transform: translateY(-2px); }
.button-ghost { color: var(--ink); }
.button-ghost:hover { background: var(--accent-soft); }
.text-link { display: inline-flex; align-items: center; gap: 16px; color: var(--accent); font-size: 12px; font-weight: 600; }
.text-link:hover { gap: 22px; }

/* Navigation */
.site-header { position: sticky; top: 0; z-index: 100; background: var(--header-bg); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: var(--header-h); }
.site-header.is-scrolled { box-shadow: var(--shadow); }
.site-brand, .footer-brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 40px; border-radius: 8px 8px 8px 2px; background: var(--ink); color: var(--bg); font: italic 28px/1 var(--font-serif); }
.brand-text, .footer-brand-text { display: flex; flex-direction: column; }
.site-title { font-size: 15px; font-weight: 750; letter-spacing: -.035em; line-height: 1.4; }
.site-subtitle { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.header-actions { display: flex; align-items: center; gap: 5px; }
.site-nav { display: flex; align-items: center; gap: 5px; margin-right: 18px; }
.nav-link { position: relative; padding: 9px 15px; border-radius: 5px; color: var(--muted); font-size: 13px; }
.nav-link:hover { background: var(--surface-soft); color: var(--ink); }
.nav-link.is-active { color: var(--ink); font-weight: 650; }
.nav-link.is-active::after { content: ''; position: absolute; bottom: 2px; left: calc(50% - 2px); width: 4px; height: 4px; background: var(--accent); border-radius: 50%; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); }
.icon-button:hover { background: var(--surface-soft); color: var(--ink); }
.icon-button svg, .search-field svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-sun, .menu-toggle { display: none; }
[data-theme='dark'] .icon-sun { display: block; }
[data-theme='dark'] .icon-moon { display: none; }
.menu-line { width: 18px; height: 1.5px; background: currentColor; transition: transform .2s; }

/* Opening spread */
.home-hero { position: relative; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 60px; padding: 68px 0 58px; }
.home-hero-copy { position: relative; z-index: 1; }
.home-title { margin: 26px 0 24px; font-size: clamp(44px, 5.2vw, 66px); line-height: 1.4; letter-spacing: -.05em; font-weight: 650; }
.home-title-accent { color: var(--accent); font-family: var(--font-serif); font-weight: 500; }
.home-desc { margin: 0; color: var(--muted); font-size: 13px; }
.home-desc .sep { margin: 0 10px; color: var(--faint); }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 30px; }
.hero-art { position: relative; display: grid; place-items: center; min-height: 340px; }
.hero-art-orbit { position: absolute; width: 340px; height: 290px; border: 1px dashed var(--line); border-radius: 50%; transform: rotate(-30deg); }
.hero-art-orbit::before, .hero-art-orbit::after { content: '✳'; position: absolute; color: var(--accent); background: var(--bg); font-size: 28px; line-height: 1; }
.hero-art-orbit::before { top: 28px; left: 0; }
.hero-art-orbit::after { bottom: 0; right: 28px; font-size: 17px; }
.journal-sheet { position: relative; display: flex; flex-direction: column; width: 256px; height: 290px; padding: 22px 24px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--paper)); border-radius: 3px 13px 13px 3px; background: var(--paper); color: var(--paper-ink); box-shadow: 10px 11px 0 -3px var(--bg), 10px 11px 0 -2px var(--line), 20px 25px 40px -22px rgba(39, 45, 65, .28); transform: rotate(-7deg); }
.journal-sheet::before { content: ''; position: absolute; inset: 0 auto 0 11px; border-right: 1px solid color-mix(in srgb, var(--paper-ink) 12%, transparent); }
.journal-sheet-top, .journal-sheet-bottom { display: flex; justify-content: space-between; gap: 10px; font: 8px/1.5 var(--font-mono); letter-spacing: .1em; }
.journal-sheet-top { padding-bottom: 13px; border-bottom: 1px solid color-mix(in srgb, var(--paper-ink) 22%, transparent); }
.journal-monogram { display: block; position: relative; margin-top: 12px; font: italic 122px/.98 var(--font-serif); text-align: center; }
.journal-monogram > span { position: absolute; top: 18px; right: 26px; font: 45px/1 var(--font-serif); }
.journal-script { font: italic 26px/1.3 var(--font-serif); text-align: center; }
.journal-sheet-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid color-mix(in srgb, var(--paper-ink) 22%, transparent); font-size: 6.5px; }
.journal-sticker { position: absolute; bottom: 0; right: 2px; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink-soft); font-size: 10px; transform: rotate(4deg); }
.home-overview { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0; border-block: 1px solid var(--line); }
.home-overview p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.home-overview p span { color: var(--muted); }
.overview-stats { display: flex; align-items: center; gap: 30px; }
.overview-stats > span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.overview-stats strong { margin-right: 6px; color: var(--ink); font: 21px/1 var(--font-serif); }

/* Featured entry */
.section-block { margin-top: 45px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-head .section-eyebrow { order: 2; margin: 0 0 5px; font-size: 9px; }
.section-title-row { display: flex; align-items: center; gap: 12px; }
.section-title { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.035em; }
.section-count { display: inline-flex; align-items: center; justify-content: center; min-width: 25px; height: 23px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 10px/1 var(--font-mono); }
.featured-post { display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.featured-post:hover { border-color: var(--accent); transform: translateY(-3px); }
.featured-main { display: block; padding: 28px 32px; }
.featured-flag { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: .05em; }
.featured-flag-en { margin-left: 3px; color: var(--muted); font: 8px/1.5 var(--font-mono); letter-spacing: .1em; }
.featured-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font: 10px/1.6 var(--font-mono); }
.featured-title { display: block; margin: 10px 0 12px; font-size: clamp(23px, 3vw, 32px); font-weight: 650; letter-spacing: -.045em; line-height: 1.45; }
.featured-excerpt { display: -webkit-box; max-width: 67ch; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); font-size: 12px; line-height: 1.9; }
.featured-cta { display: inline-flex; align-items: center; gap: 22px; margin-top: 22px; color: var(--accent); font-size: 11px; font-weight: 600; }
.featured-art { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; overflow: hidden; margin: 12px; border-radius: 6px; background: var(--surface-soft); color: var(--accent); }
.featured-orbit { position: absolute; top: calc(50% - 86px); width: 168px; height: 168px; border: 1px solid var(--line); border-radius: 50%; }
.featured-orbit::before, .featured-orbit::after { content: ''; position: absolute; inset: 20px; border: 1px dashed var(--line); border-radius: 50%; }
.featured-orbit::after { inset: 40px; border-style: solid; }
.featured-symbol { z-index: 1; margin-top: 28px; font: 60px/1 var(--font-serif); letter-spacing: -.1em; }
.featured-art-label { z-index: 1; font: 7px/1.4 var(--font-mono); letter-spacing: .13em; }

/* The journal and topic rail */
.writing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 58px; }
.writing-layout.without-sidebar { display: block; }
.post-list { border-top: 1px solid var(--line); }
.post-item { border-bottom: 1px solid var(--line); }
.post-item-link { display: flex; align-items: flex-start; gap: 18px; padding: 26px 0; }
.post-item-index { flex-shrink: 0; width: 22px; padding-top: 5px; color: var(--faint); font: 10px/1.6 var(--font-mono); }
.post-item-body { min-width: 0; flex: 1; }
.post-item-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.post-item-title { color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.025em; line-height: 1.6; }
.post-item-date { color: var(--muted); font: 9px/1.6 var(--font-mono); white-space: nowrap; }
.post-item-excerpt { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.post-item-meta { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.post-item-cats { color: var(--accent); }
.post-item-arrow { padding-top: 2px; color: var(--muted); font-size: 17px; transition: transform .2s; }
.post-item-link:hover .post-item-title { color: var(--accent); }
.post-item-link:hover .post-item-arrow { transform: translate(3px, -3px); color: var(--accent); }
.home-sidebar { min-width: 0; padding-top: 49px; }
.sidebar-section { padding-top: 2px; }
.sidebar-section .section-eyebrow { margin-bottom: 9px; font-size: 8px; }
.sidebar-title { margin-bottom: 18px; font-size: 16px; font-weight: 600; }
.topic-list { margin-bottom: 18px; border-top: 1px solid var(--line); }
.topic-list a { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--line); font-size: 12px; }
.topic-number { color: var(--faint); font: 8px/1.6 var(--font-mono); }
.topic-count { margin-left: auto; color: var(--muted); font: 9px/1.6 var(--font-mono); }
.topic-count > span { margin-left: 7px; }
.sidebar-note { position: relative; margin-top: 35px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.note-asterisk { display: block; margin-bottom: 26px; color: var(--accent); font-size: 33px; line-height: 1; }
.sidebar-note .section-eyebrow { margin-bottom: 13px; font-size: 7px; letter-spacing: .1em; }
.sidebar-note h2 { margin-bottom: 14px; font: 500 25px/1.6 var(--font-serif); }
.sidebar-note > p:not(.section-eyebrow) { margin-bottom: 23px; color: var(--muted); font-size: 11px; line-height: 1.9; }
.sidebar-note .text-link { font-size: 10px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 32px; }
.page-numbers { display: flex; flex-wrap: wrap; gap: 5px; }
.page-number { display: inline-grid; place-items: center; min-width: 30px; height: 32px; border-radius: 5px; color: var(--muted); font: 10px/1 var(--font-mono); }
.page-number:hover { background: var(--accent-soft); }
.page-number.is-current { background: var(--ink); color: var(--bg); }
.page-arrow { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 11px; }
.page-arrow.is-disabled { color: var(--faint); opacity: .5; }

/* Inner pages */
.page-header { margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.page-header.compact { margin-top: 50px; margin-bottom: 0; }
.page-title { margin: 12px 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.35; font-weight: 600; letter-spacing: -.04em; }
.page-subtitle { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; min-height: 30px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 11px; }
.pill:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.empty-state { margin: 35px 0; padding: 35px 20px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }

/* Reading room */
.post { max-width: 1040px; margin-inline: auto; }
.post-header { max-width: 850px; padding: 0 0 34px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.post-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; color: var(--muted); font: 11px/1.6 var(--font-mono); }
.post-categories { color: var(--accent); }
.meta-sep { color: var(--faint); }
.post-title { margin: 0 0 20px; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.45; font-weight: 650; letter-spacing: -.04em; overflow-wrap: anywhere; text-wrap: balance; }
.post-deck { color: var(--muted); font-size: 16px; line-height: 1.9; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.post-layout { display: grid; grid-template-columns: minmax(0, 740px) 210px; align-items: start; gap: 55px; }
.post-content { min-width: 0; max-width: 740px; color: var(--ink-soft); font-size: 16px; line-height: 1.95; overflow-wrap: anywhere; }
.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }
.page-single .post { max-width: 760px; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4, .post-content h5, .post-content h6 { color: var(--ink); line-height: 1.5; font-weight: 650; letter-spacing: -.025em; }
.post-content h1 { margin: 2em 0 .8em; font-size: 1.8em; }
.post-content h2 { margin: 2.3em 0 .9em; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 1.5em; }
.post-content h3 { margin: 2em 0 .7em; font-size: 1.22em; }
.post-content h4 { margin: 1.8em 0 .6em; font-size: 1.05em; }
.post-content p { margin: 1.2em 0; }
.post-content a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--line); }
.post-content a:hover { text-decoration-color: var(--accent); }
.heading-anchor { margin-left: 9px; opacity: 0; font-size: .7em; font-weight: 400; }
.post-content :is(h1, h2, h3, h4):hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.post-content strong { color: var(--ink); font-weight: 650; }
.post-content ul, .post-content ol { padding-left: 1.6em; margin-block: 1.2em; }
.post-content li { margin-block: .4em; }
.post-content li::marker { color: var(--accent); }
.post-content li > ul, .post-content li > ol { margin-block: .3em; }
.post-content input[type='checkbox'] { accent-color: var(--accent); }
.post-content blockquote { margin: 1.8em 0; padding: 15px 22px; border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; background: var(--surface-soft); color: var(--muted); }
.post-content blockquote p { margin: .4em 0; }
.post-content img { display: block; margin: 2em auto; border-radius: 6px; background: var(--surface); }
.post-content figure { margin: 2em 0; }
.post-content figcaption { margin-top: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.post-content code { padding: .15em .35em; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--accent); font: .85em/1.6 var(--font-mono); box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.post-content pre { max-width: 100%; padding: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--code-bg); color: var(--code-fg); font: 12.5px/1.8 var(--font-mono); tab-size: 4; }
.post-content pre code { padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font: inherit; overflow-wrap: normal; }
.post-content table { display: block; width: 100%; overflow-x: auto; margin: 2em 0; border-collapse: collapse; font-size: 13px; }
.post-content th, .post-content td { min-width: 90px; padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
.post-content th { background: var(--surface-soft); color: var(--ink); }
.post-content tr:nth-child(even) td { background: var(--surface); }
.post-content hr { margin: 3em 0; border: 0; border-top: 1px solid var(--line); }
.post-content .footnotes { margin-top: 3em; padding-top: 1em; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.post-aside { min-width: 0; align-self: stretch; }
.aside-sticky { position: sticky; top: calc(var(--header-h) + 30px); }
.toc { max-height: calc(100vh - var(--header-h) - 60px); overflow-y: auto; padding-left: 18px; border-left: 1px solid var(--line); scrollbar-width: thin; }
.toc-title { margin-bottom: 15px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; }
.toc-list { padding: 0; margin: 0; list-style: none; }
.toc-item a { display: block; padding: 6px 8px; border-radius: 4px; color: var(--muted); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.toc-item a:hover { background: var(--surface-soft); }
.toc-item a.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.toc-depth-3 { padding-left: 12px; }
.toc-depth-3 a { font-size: 10px; }
.code-frame { overflow: hidden; margin: 2em 0; border: 1px solid var(--line); border-radius: 7px; background: var(--code-bg); }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 14px; border-bottom: 1px solid var(--line); background: var(--code-head); }
.code-lang { color: var(--muted); font: 9px/1.5 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.copy-code { min-height: 32px; padding: 4px 9px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; }
.copy-code:hover { background: var(--accent-soft); color: var(--ink); }
.code-frame pre { margin: 0; border: 0; border-radius: 0; }
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type { color: var(--hl-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute { color: var(--hl-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable, .hljs-template-variable { color: var(--hl-number); }
.hljs-title, .hljs-section, .hljs-name { color: var(--hl-title); }
.hljs-attr, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id, .hljs-property { color: var(--hl-attr); }
.hljs-built_in, .hljs-class .hljs-title, .hljs-meta { color: var(--hl-meta); }
.hljs-deletion { color: var(--hl-deletion); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }
.hljs-link { text-decoration: underline; }
.post-footer { max-width: 740px; margin-top: 50px; }
.post-end { display: flex; align-items: center; gap: 20px; margin: 50px 0 35px; color: var(--accent); text-align: center; }
.post-end::before, .post-end::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.post-end span { font-size: 23px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.post-nav-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.post-nav-card:hover { border-color: var(--accent); }
.post-nav-card.is-next { text-align: right; }
.post-nav-label { color: var(--muted); font-size: 10px; }
.post-nav-title { font-size: 14px; line-height: 1.6; }
.reading-progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); }

/* Archive, collections, search */
.archive-jump { display: flex; flex-wrap: wrap; gap: 10px; margin: -10px 0 40px; }
.archive-jump a, .archive-back { display: inline-flex; align-items: center; min-height: 36px; padding: 5px 14px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 11px/1.5 var(--font-mono); }
.archive-jump a:hover, .archive-back:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.archive-back { margin-bottom: 30px; }
.archive-year { display: grid; grid-template-columns: 135px minmax(0, 1fr); gap: 40px; margin-bottom: 40px; }
.archive-year-title { margin-bottom: 4px; font: 38px/1.3 var(--font-serif); }
.archive-year-count { color: var(--muted); font: 10px/1.5 var(--font-mono); }
.archive-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.archive-list li { border-bottom: 1px solid var(--line); }
.archive-list a { display: flex; align-items: baseline; gap: 24px; padding: 16px 0; }
.archive-date { flex: 0 0 58px; color: var(--muted); font: 10px/1.7 var(--font-mono); }
.archive-title { font-size: 14px; }
.archive-arrow { margin-left: auto; color: var(--faint); }
.term-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.term-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 92px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.term-card:hover { background: var(--accent-soft); border-color: var(--accent); transform: translateY(-2px); }
.term-name { font-size: 16px; overflow-wrap: anywhere; }
.term-count { color: var(--muted); font: 12px/1.5 var(--font-mono); }
.search-panel { padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.search-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.search-field { display: flex; align-items: center; gap: 14px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.search-field:focus-within { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.search-field svg { color: var(--muted); }
.search-input { min-width: 0; flex: 1; height: 40px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search-input::placeholder { color: var(--faint); font-size: 13px; }
.search-field kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font: 10px/1.5 var(--font-mono); }
.search-status { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.search-results { margin-top: 25px; }
.search-result { border-bottom: 1px solid var(--line); }
.search-result-link { display: block; padding: 24px 0; }
.search-result-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font: 10px/1.6 var(--font-mono); }
.search-result-title { margin: 9px 0 10px; font-size: 21px; line-height: 1.6; }
.search-result-snippet { color: var(--muted); font-size: 13px; line-height: 1.9; overflow-wrap: anywhere; }
.search-result-tags { color: var(--accent); font-size: 10px; }
mark { padding: 0 2px; border-radius: 2px; background: var(--accent-soft); color: var(--ink); }
.error-page { position: relative; padding: 80px 0; text-align: center; }
.error-page .eyebrow { justify-content: center; }
.error-watermark { display: block; margin-bottom: 15px; color: var(--accent); font: italic clamp(95px, 15vw, 170px)/1 var(--font-serif); }
.error-title { font-size: 28px; font-weight: 600; }
.error-desc { color: var(--muted); font-size: 13px; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }

/* Colophon */
.site-footer { border-top: 1px solid var(--line); }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 35px 0; }
.footer-brand-text strong { font-size: 13px; letter-spacing: -.025em; }
.footer-brand-text > span { color: var(--muted); font-size: 10px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); font-size: 11px; }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.footer-bottom p { margin: 0; }
.footer-bottom p:last-child { font-family: var(--font-mono); font-size: 9px; }
.back-to-top { position: fixed; bottom: 24px; right: 24px; z-index: 50; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); color: var(--accent); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s, transform .2s, visibility .2s; }
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--accent); }

/* Smaller screens keep the same reading hierarchy. */
@media (min-width: 861px) {
  .nav-link { min-height: 42px; }
}
@media (max-width: 1040px) {
  .home-hero { gap: 25px; }
  .writing-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 35px; }
  .post-layout { grid-template-columns: minmax(0, 1fr) 180px; gap: 32px; }
  .site-nav { gap: 0; margin-right: 8px; }
  .nav-link { padding-inline: 12px; }
}
@media (max-width: 860px) {
  :root { --header-h: 72px; }
  .container { padding-inline: 28px; }
  #main { padding-top: 40px; padding-bottom: 55px; }
  .header-inner { gap: 12px; }
  .js .menu-toggle { display: flex; flex-direction: column; gap: 5px; }
  .js .site-nav { position: absolute; top: calc(100% + 8px); right: 28px; left: 28px; display: none; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
  .menu-open .site-nav { display: flex; flex-direction: column; align-items: stretch; }
  .js .nav-link { min-height: 44px; padding: 10px 16px; }
  .nav-link.is-active::after { display: none; }
  .menu-open .menu-line:first-child { transform: translateY(3.25px) rotate(45deg); }
  .menu-open .menu-line:last-child { transform: translateY(-3.25px) rotate(-45deg); }
  html:not(.js) .header-inner { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding-block: 12px; }
  html:not(.js) .header-actions { flex-wrap: wrap; }
  html:not(.js) .site-nav { flex-wrap: wrap; }
  .home-hero { padding: 45px 0; gap: 10px; }
  .home-title { font-size: 46px; }
  .home-desc { max-width: 260px; line-height: 1.9; }
  .home-desc .sep { display: block; height: 4px; overflow: hidden; }
  .hero-art { min-height: 300px; transform: scale(.88); transform-origin: right center; }
  .hero-art-orbit { width: min(280px, 100%); height: 240px; }
  .home-overview { gap: 12px; }
  .overview-stats { gap: 18px; }
  .writing-layout { grid-template-columns: minmax(0, 1fr) 195px; gap: 28px; }
  .featured-post { grid-template-columns: minmax(0, 1fr) 170px; }
  .featured-main { padding: 25px; }
  .featured-orbit { width: 135px; height: 135px; top: calc(50% - 70px); }
  .sidebar-note { padding: 18px; }
  .sidebar-note h2 { font-size: 23px; }
  .post-layout { display: flex; flex-direction: column; gap: 30px; }
  .post-aside { order: -1; width: 100%; }
  .aside-sticky { position: static; }
  .toc { max-height: 170px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
  .toc-title { margin-bottom: 8px; }
  .toc-list { display: flex; flex-wrap: wrap; gap: 3px 7px; }
  .toc-depth-3 { padding-left: 0; }
  .post-content, .post-header, .post-footer { max-width: 100%; }
  .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-year { grid-template-columns: 95px minmax(0, 1fr); gap: 25px; }
}
@media (max-width: 640px) {
  :root { --header-h: 66px; }
  .container { padding-inline: 22px; }
  .site-title { font-size: 13px; }
  .site-subtitle { font-size: 8px; }
  .brand-mark { width: 32px; height: 35px; font-size: 25px; }
  .site-brand { gap: 9px; }
  .header-actions { gap: 0; }
  .icon-button { width: 36px; min-height: 42px; }
  .js .site-nav { left: 22px; right: 22px; }
  .home-hero { grid-template-columns: 1fr; gap: 15px; padding: 42px 0 32px; }
  .home-title { margin: 20px 0 18px; font-size: clamp(40px, 10vw, 55px); line-height: 1.45; }
  .home-desc { max-width: none; font-size: 12px; }
  .home-desc .sep { display: inline; margin-inline: 7px; }
  .home-actions { margin-top: 25px; }
  .hero-art { min-height: 260px; width: 100%; transform: scale(.78); transform-origin: center center; margin-block: -12px -15px; }
  .journal-sticker { right: calc(50% - 170px); bottom: -6px; }
  .eyebrow { font-size: 8px; letter-spacing: .12em; }
  .home-overview { align-items: flex-start; flex-direction: column; gap: 16px; padding: 22px 0; }
  .home-overview p { font-size: 11px; }
  .overview-stats { width: 100%; justify-content: space-between; gap: 14px; }
  .overview-stats strong { font-size: 22px; }
  .section-block { margin-top: 30px; }
  .section-title { font-size: 20px; }
  .section-head .section-eyebrow { font-size: 8px; letter-spacing: .08em; }
  .featured-post { grid-template-columns: 1fr; }
  .featured-main { padding: 24px; }
  .featured-flag { margin-bottom: 22px; }
  .featured-title { font-size: 24px; }
  .featured-art { display: none; }
  .writing-layout { display: block; }
  .post-item-link { gap: 10px; padding-block: 23px; }
  .post-item-index { width: 18px; font-size: 9px; }
  .post-item-top { display: block; }
  .post-item-title { display: block; margin-bottom: 4px; font-size: 17px; }
  .post-item-date { font-size: 9px; }
  .post-item-excerpt { font-size: 12px; }
  .post-item-arrow { font-size: 16px; }
  .home-sidebar { display: grid; grid-template-columns: 1fr; gap: 25px; padding-top: 45px; }
  .sidebar-title { font-size: 18px; }
  .topic-list a { min-height: 48px; font-size: 13px; }
  .sidebar-note { margin: 0; padding: 24px; }
  .sidebar-note h2 br { display: none; }
  .note-asterisk { margin-bottom: 20px; }
  .sidebar-note .section-eyebrow { font-size: 8px; }
  .sidebar-note .text-link { font-size: 12px; }
  .pagination { gap: 4px; }
  .page-arrow span { display: none; }
  .page-arrow { min-width: 30px; justify-content: center; font-size: 16px; }
  .page-numbers { gap: 2px; }
  .page-number { min-width: 29px; height: 36px; }
  .page-header { margin-bottom: 28px; padding-bottom: 25px; }
  .page-subtitle { font-size: 12px; }
  .post-title { font-size: 30px; }
  .post-header { padding-bottom: 26px; margin-bottom: 28px; }
  .post-content { font-size: 15px; line-height: 1.95; }
  .post-content h2 { font-size: 1.4em; }
  .post-content blockquote { padding: 12px 17px; }
  .post-content pre { padding: 16px; font-size: 11.5px; }
  .post-nav { grid-template-columns: 1fr; gap: 10px; }
  .post-nav > span:empty { display: none; }
  .post-nav-card { padding: 18px; }
  .archive-year { grid-template-columns: 1fr; gap: 18px; }
  .archive-year-head { display: flex; align-items: baseline; gap: 14px; }
  .archive-year-title { font-size: 32px; margin: 0; }
  .archive-list a { gap: 12px; }
  .archive-title { font-size: 13px; }
  .archive-date { flex-basis: 49px; font-size: 9px; }
  .term-grid { gap: 10px; }
  .term-card { min-height: 82px; gap: 10px; padding: 16px; }
  .term-name { font-size: 14px; }
  .term-count { font-size: 10px; }
  .search-panel { padding: 20px; }
  .search-field { gap: 9px; padding-inline: 10px; }
  .search-field kbd { display: none; }
  .search-result-title { font-size: 19px; }
  .footer-top { align-items: flex-start; flex-direction: column; gap: 22px; padding-block: 28px; }
  .footer-nav { gap: 6px 25px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }
  .back-to-top { bottom: 18px; right: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  :root, html[data-theme='dark'] { --bg: #fff; --ink: #111; --ink-soft: #222; --muted: #555; --line: #ccc; --accent: #333; --surface-soft: #f5f5f5; --code-bg: #f5f5f5; --code-fg: #111; color-scheme: light; }
  .site-header, .site-footer, .post-aside, .post-nav, .post-tags, .reading-progress, .back-to-top, .copy-code, .skip-link, .heading-anchor { display: none !important; }
  .container { max-width: none; padding: 0; }
  #main { padding: 0; }
  .post-layout { display: block; }
  .post-content { max-width: none; font-size: 11pt; }
  .post-content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .post-content a { color: #222; }
  .post-content pre .hljs { --hl-comment: #555; --hl-keyword: #333; --hl-string: #333; --hl-number: #333; --hl-title: #333; --hl-attr: #333; --hl-meta: #333; --hl-deletion: #333; }
  .code-frame, .post-content img, .post-content blockquote { break-inside: avoid; }
}
