/* bench — Ghost theme for research.nairpaa.me */

/* fonts: self-hosted (Google Fonts, OFL), latin + latin-ext */
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/bricolage-grotesque-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/bricolage-grotesque-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-italic-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-italic-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(../fonts/jetbrains-mono-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(../fonts/jetbrains-mono-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #0e100f; --surface: #141715; --soft: #1a1e1b; --code: #080908; --code2: #0b0d0c;
  --line: #232824; --line2: #2c312d; --line3: #4a524c;
  --ink: #e7ebe6; --body: #c9d0ca; --muted: #9aa49c; --dim: #7d877f; --faint: #4f5751;
  --red: #ff4d5e; --red-d: #5a2128;
  --clay: #d4a37f; --teal: #86b3ad; --sage: #a9c08f; --wheat: #d9bf87; --slate: #9fb0cc; --moss: #5f6b62; --bone: #d9ceb4;
  /* --gh-font-* are set by Ghost when custom fonts are picked in Design settings */
  --sans: var(--gh-font-heading, 'Bricolage Grotesque', system-ui, sans-serif);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --text: var(--gh-font-body, var(--mono));
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; scroll-padding-top: 80px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line2); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--red); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 13px/1.6 var(--text); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; transition: color .15s; }
a:hover { color: var(--red); }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font: inherit; font-size: .82em; padding: 0 5px; color: var(--faint); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 3px; }
@keyframes blink { 50% { opacity: 0; } }
.cursor { color: var(--red); animation: blink 1.1s steps(1) infinite; }

.site { position: relative; min-height: 100vh; display: flex; flex-direction: column; }
.label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 11px; letter-spacing: .06em; color: var(--dim); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cmd { font-size: 12px; color: var(--dim); }
.cmd b { color: var(--ink); font-weight: 400; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12px; line-height: 1.4; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer;
  transition: transform .18s var(--ease), border-color .15s, background .15s, color .15s, box-shadow .18s; }
.btn:hover { border-color: var(--line3); background: var(--soft); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 0 -1px #050605; }
.btn:active { transform: none; box-shadow: none; }
.btn-strong { font-weight: 600; border-color: var(--line3); background: var(--soft); }
.btn-strong i { color: var(--red); font-size: 10px; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line2); border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px;
  transition: transform .18s var(--ease), border-color .15s, background .15s, box-shadow .18s; }
.icon-btn:hover { border-color: var(--line3); background: var(--soft); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 0 -1px #050605; }
.link { all: unset; cursor: pointer; color: var(--muted); border-bottom: 1px solid var(--line3); }
.link:hover { color: var(--ink); }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(14, 16, 15, .93); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 14px 40px; font-size: 12px; color: var(--dim); letter-spacing: .04em; }
.prompt { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prompt i { color: var(--red); font-size: 13px; }
.prompt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt b { color: var(--ink); font-weight: 400; }
.nav { display: flex; align-items: center; gap: 24px; }
.nav-link.is-current { color: var(--ink); }
/* site links sit before the search box, external ones (whoami ↗) after it */
.nav-site, .nav-ext { display: contents; }
.nav-site .is-ext, .nav-ext .nav-link:not(.is-ext) { display: none; }
.ext { color: var(--red); margin-left: 6px; }
.searchbox { display: flex; align-items: center; gap: 10px; min-width: 180px; padding: 6px 10px; border: 1px solid var(--line2); border-radius: 6px; background: var(--surface); color: var(--dim); cursor: pointer; transition: border-color .15s; }
.searchbox:hover { border-color: var(--line3); color: var(--ink); }
.searchbox span { flex: 1; text-align: left; }
.menu-btn { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink); cursor: pointer; font-size: 15px; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--red); }
.progress-pct { position: absolute; right: 12px; bottom: -18px; font-size: 10px; color: var(--faint); }

.tocbar { display: none; }
.tocbar-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--soft); font-size: 12px; color: var(--dim); }
.tocbar-btn .n { color: var(--red); }
.tocbar-btn .t { flex: 1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tocbar-btn i { font-size: 10px; transition: transform .2s; }
.tocbar.open .tocbar-btn i { transform: rotate(180deg); }
.tocbar-list { display: none; padding: 4px 16px 10px; border-top: 1px solid var(--soft); }
.tocbar.open .tocbar-list { display: flex; flex-direction: column; }
.tocbar-list a { min-height: 40px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.tocbar-list a.is-active { color: var(--ink); }
.tocbar-list a span { color: var(--faint); }
.tocbar-list a.is-active span { color: var(--red); }

/* drawer (mobile) */
.drawer { display: none; }
body.drawer-open .drawer { display: flex; flex-direction: column; gap: 24px; position: fixed; inset: 53px 0 0; z-index: 25; overflow-y: auto; padding: 8px 16px 32px; background: var(--bg); }
.drawer-nav { display: flex; flex-direction: column; }
.drawer-nav a { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--soft); font: 600 22px var(--sans); }
.drawer-nav .ext { font-size: 16px; }

/* hexdump */
/* behind the topbar and hero, fades down and out from the upper right */
.hexdump { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 1360px; height: 560px; z-index: 0; overflow: hidden; pointer-events: none; user-select: none; -webkit-user-select: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 35%, transparent 100%), radial-gradient(ellipse at 70% 30%, #000 30%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, #000 35%, transparent 100%), radial-gradient(ellipse at 70% 30%, #000 30%, transparent 85%);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
.hexdump-in { position: absolute; top: 18px; right: 40px; white-space: pre; font: 400 12px/1.75 var(--mono); color: #1a1e1b; }
.hexdump .asc { color: #1d211e; }
.hexdump .hot { color: #6a2730; }
/* the topbar is see-through over the hexdump until the page scrolls */
body:has([data-hexdump]) .topbar:not(.is-scrolled) { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* layout */
.layout { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 56px; padding: 40px; }
.sidebar { display: flex; flex-direction: column; gap: 28px; }
.main { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

.profile { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.profile-top { display: flex; align-items: center; gap: 14px; }
.avatar { position: relative; flex: none; width: 56px; height: 56px; padding: 4px; border: 1px solid var(--line2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .c1, .avatar .c2 { position: absolute; width: 9px; height: 9px; }
.avatar .c1 { top: -1px; left: -1px; border-top: 2px solid var(--red); border-left: 2px solid var(--red); }
.avatar .c2 { bottom: -1px; right: -1px; border-bottom: 2px solid var(--red); border-right: 2px solid var(--red); }
.who { display: flex; flex-direction: column; gap: 4px; }
.pname { font: 600 18px var(--sans); }
.prole { font-size: 11px; color: var(--red); font-weight: 600; }
.pbio { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.socials { display: flex; gap: 6px; }
.socials .icon-btn { width: 30px; height: 30px; }

.tindex { display: flex; flex-direction: column; gap: 4px; }
.tindex .label { margin-bottom: 6px; }
.topic-head { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 12px; gap: 8px; align-items: center; padding: 9px 0; color: var(--ink); }
.topic-head:hover { color: var(--red); }
.tn { font-size: 11px; color: var(--red); font-weight: 600; }
.tname { font: 600 15px var(--sans); }
.tcount { font-size: 10px; color: var(--faint); }
.topic-head i { font-size: 9px; color: var(--dim); transform: rotate(-90deg); transition: transform .2s; }
.topic.open .topic-head i { transform: none; }
.topic-posts { display: none; list-style: none; margin: 0 0 8px 11px; padding: 2px 0 2px 16px; border-left: 1px solid var(--line2); flex-direction: column; gap: 2px; }
.topic.open .topic-posts { display: flex; }
.topic-posts a { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 6px; padding: 5px 0; font-size: 12px; line-height: 1.45; color: var(--body); }
.topic-posts .pn { color: var(--faint); }
.topic-posts a.is-current { color: var(--red); }
.topic-posts a.is-read .pt::after { content: ' ✓'; color: var(--sage); }

.subscribe { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; }
.subscribe .label { border: 0; padding: 0; }
.subscribe p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.sub-row { display: flex; gap: 6px; }
.sub-row input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 6px; background: var(--code2); color: var(--ink); font: inherit; font-size: 12px; caret-color: var(--red); outline: none; }
.sub-row input:focus { border-color: var(--line3); }
.sub-msg { display: none; font-size: 12px; }
.sub-ok { color: var(--sage) !important; }
.sub-err { color: var(--red) !important; }
form.success .sub-row { display: none; }
form.success .sub-ok, form.error .sub-err { display: block; }
form.loading button[type=submit] { opacity: .6; pointer-events: none; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; }
.tags a { font-size: 11px; padding: 4px 8px; border: 1px solid var(--line2); border-radius: 4px; color: var(--muted); }
.tags a:hover { border-color: var(--red); color: var(--ink); }

/* home */
.hero { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.hero h1 { margin: 0; font: 800 88px/.85 var(--sans); letter-spacing: -.04em; }
.hero p { margin: 0; max-width: 560px; font-size: 13px; line-height: 1.7; color: var(--muted); text-wrap: pretty; }

.featured { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; color: var(--ink); transition: border-color .15s; }
.featured:hover { border-color: var(--red); color: var(--ink); }
.featured-img { min-height: 280px; border-right: 1px solid var(--line); background: repeating-linear-gradient(135deg, var(--surface) 0 10px, #171b18 10px 20px); }
.featured-img img { width: 100%; height: 100%; object-fit: cover; }
.featured-body { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.featured-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 11px; color: var(--dim); }
.badge { color: var(--red); border: 1px solid var(--red-d); padding: 1px 7px; border-radius: 3px; font-weight: 600; text-transform: uppercase; }
.sep { color: var(--faint); }
.featured h2 { margin: 0; font: 600 34px/1.05 var(--sans); letter-spacing: -.02em; text-wrap: pretty; }
.featured p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--muted); text-wrap: pretty; }
.featured-foot { margin-top: auto; display: flex; gap: 16px; font-size: 11px; color: var(--dim); }

.latest { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 170px; gap: 24px; align-items: baseline; padding: 20px 0; border-bottom: 1px solid var(--soft); color: var(--ink); }
.row-date { font-size: 11px; color: var(--dim); }
.row-main { display: flex; flex-direction: column; gap: 6px; }
.row-title { font: 600 20px/1.2 var(--sans); }
.row-ex { font-size: 12px; line-height: 1.55; color: var(--muted); }
.row-meta { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--dim); text-align: right; }
.row-topic { color: var(--body); }
.row:hover .row-ex, .row:hover .row-meta { color: var(--muted); }
.load-more { align-self: flex-start; margin-top: 20px; }
.load-more i { font-size: 10px; }
.load-more.loading { opacity: .6; pointer-events: none; }

/* mobile-only home blocks (hidden on desktop, where the sidebar has them) */
@media (min-width: 901px) { .m-only { display: none !important; } }
.continue-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.continue-card:hover { border-color: var(--red); color: var(--ink); }
.cc-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.cc-name { font: 600 18px/1.2 var(--sans); }
.continue-card .segs i { height: 3px; }
.cc-next { font-size: 12px; color: var(--muted); }
.cc-next b { color: var(--red); font-weight: 400; }
.tlist { display: flex; flex-direction: column; }
.tlist-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 52px; border-bottom: 1px solid var(--soft); color: var(--ink); }
.tlist-row .tname { font-size: 16px; }
.tlist-row .tcount { font-size: 11px; }

/* topic page */
.topic-hero { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.topic-title { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; }
.topic-num { font: 800 128px/.8 var(--sans); letter-spacing: -.05em; color: transparent; -webkit-text-stroke: 1.5px var(--red); }
.topic-num:empty { display: none; }
.topic-hero h1 { margin: 0; font: 800 64px/.9 var(--sans); letter-spacing: -.035em; text-wrap: balance; }
.topic-hero p { margin: 0; max-width: 620px; font-size: 13px; line-height: 1.7; color: var(--muted); text-wrap: pretty; }
.topic-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 11px; color: var(--dim); }
.topic-meta span:empty { display: none; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-tags a { padding: 2px 7px; border: 1px solid var(--line2); border-radius: 4px; }
.topic-tags a:hover { border-color: var(--red); color: var(--ink); }
.progress-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.pb-main { display: flex; flex-direction: column; gap: 10px; }
.pb-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.pb-label span:last-child { color: var(--ink); }
.pb-actions { display: flex; gap: 8px; }
.pb-actions .btn-strong:hover { border-color: var(--red); }
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.segs i { height: 4px; background: var(--line2); }
.segs i.on { background: var(--red); }
.start-only { align-self: flex-start; }
.parts { display: flex; flex-direction: column; }
.part { display: grid; grid-template-columns: 72px minmax(0, 1fr) 150px; gap: 24px; align-items: start; padding: 24px 0; border-bottom: 1px solid var(--soft); color: var(--ink); }
.part-n { font: 800 40px/.9 var(--sans); letter-spacing: -.04em; color: var(--ink); }
.part.is-read .part-n { color: var(--faint); }
.part.is-next .part-n { color: var(--red); }
.part-body { display: flex; flex-direction: column; gap: 8px; }
.part-title { font: 600 22px/1.2 var(--sans); }
.part-ex { font-size: 12px; line-height: 1.6; color: var(--muted); max-width: 560px; }
.part-meta { display: flex; gap: 16px; font-size: 11px; color: var(--dim); }
.chip { justify-self: end; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 4px; font-size: 11px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.chip:empty { display: none; }
.part.is-read .chip { color: var(--muted); border-color: var(--line2); }
.part.is-next .chip { color: var(--red); border-color: var(--red-d); }
.next-topic { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 22px; border: 1px dashed var(--line2); border-radius: 6px; color: var(--ink); }
.next-topic:hover { border-color: var(--red); color: var(--ink); }
.nt-label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 6px; }
.nt-name { font: 600 22px var(--sans); }
.nt-name b { color: var(--red); font: 600 13px var(--mono); margin-right: 10px; }
.nt-desc { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.nt-arrow { color: var(--red); font-size: 18px; }

/* post */
.post-layout { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: 220px minmax(0, 680px) 200px; justify-content: center; gap: 48px; padding: 48px 40px 0; }
.series-col, .toc-col { position: relative; }
.series, .toc { position: sticky; top: 96px; }
.series { display: flex; flex-direction: column; gap: 14px; }
.series summary { list-style: none; display: flex; flex-direction: column; gap: 14px; cursor: default; }
.series summary::-webkit-details-marker { display: none; }
.series summary .label i { display: none; }
.series-name { font: 600 18px/1.15 var(--sans); }
.series .segs i { height: 3px; }
.series-part { display: none; }
.series-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.series-list a { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; padding: 7px 0 7px 10px; font-size: 12px; line-height: 1.45; border-left: 2px solid var(--line); color: var(--dim); }
.series-list .pn { color: var(--faint); }
.series-list a.is-current { border-left-color: var(--red); color: var(--ink); }
.series-list a.is-read .pt::after { content: ' ✓'; color: var(--sage); }
.series-all { display: block; margin-top: 14px; font-size: 11px; color: var(--dim); }

.article { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.article-head { display: flex; flex-direction: column; gap: 22px; }
.kicker { display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--dim); }
.kicker a { color: var(--red); }
.article h1, .page h1 { margin: 0; font: 800 56px/.98 var(--sans); letter-spacing: -.03em; text-wrap: pretty; }
.lede { margin: 0; font-size: 15px; line-height: 1.7; color: var(--body); text-wrap: pretty; }
.byline { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 11px; color: var(--dim); }
.author { display: flex; align-items: center; gap: 8px; color: var(--body); }
.author img { width: 22px; height: 22px; object-fit: cover; border: 1px solid var(--line2); }
.read-flag { color: var(--bone); }
.byline-tags { margin-left: auto; display: flex; gap: 6px; }
.byline-tags a { padding: 3px 7px; border: 1px solid var(--line2); border-radius: 4px; }
.feature { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.feature img { width: 100%; border: 1px solid var(--line); border-radius: 6px; }
.feature figcaption { font-size: 11px; color: var(--dim); }

.toc { display: flex; flex-direction: column; gap: 10px; }
.toc nav { display: flex; flex-direction: column; gap: 4px; }
.toc nav a { display: flex; gap: 8px; font-size: 12px; line-height: 1.45; padding: 3px 0; color: var(--dim); }
.toc nav a span { color: var(--faint); }
.toc nav a.is-active { color: var(--ink); }
.toc nav a.is-active span { color: var(--red); }
.toc nav a.sub { padding-left: 26px; font-size: 11px; }
.totop { margin-top: 12px; font-size: 11px; color: var(--dim); display: flex; align-items: center; gap: 6px; }

.read-box { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--dim); }
.read-box span.rb-off, .read-box span.rb-on { flex: 1; display: inline-flex; align-items: center; gap: 6px; }
.read-box .rb-on { display: none !important; }
.read-box.is-read .rb-off { display: none !important; }
.read-box.is-read .rb-on { display: inline-flex !important; }
.read-box .rb-on i { color: var(--sage); }
.read-box b { color: var(--ink); font-weight: 600; }
.series-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.series-nav:empty { display: none; }
.series-nav a { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.series-nav a:hover { border-color: var(--red); color: var(--ink); }
.series-nav a.next { text-align: right; grid-column: 2; }
.series-nav small { font-size: 11px; color: var(--dim); }
.series-nav span { font: 600 17px/1.25 var(--sans); }
.subscribe-end { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: center; padding: 20px; margin-bottom: 64px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.se-text { display: flex; flex-direction: column; gap: 6px; }
.se-kicker { font-size: 11px; color: var(--dim); }
.se-title { font: 600 18px/1.25 var(--sans); }
.se-sub { font-size: 12px; color: var(--muted); }
.se-sub a { color: var(--ink); border-bottom: 1px solid var(--line3); }
.subscribe-end .sub-row input, .subscribe-end .sub-row button { height: 40px; }

.page { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 56px 40px 80px; display: flex; flex-direction: column; gap: 22px; }

/* content */
.gh-content { display: flex; flex-direction: column; gap: 22px; font-size: 14px; line-height: 1.85; color: var(--body); }
.gh-content > * { margin: 0; }
.gh-content p, .gh-content li { text-wrap: pretty; }
.gh-content a { color: var(--ink); border-bottom: 1px solid var(--line3); }
.gh-content a:hover { color: var(--red); border-color: var(--red); }
.gh-content strong { color: var(--ink); }
.gh-content h2 { margin-top: 18px; font: 600 28px/1.15 var(--sans); letter-spacing: -.02em; color: var(--ink); }
.gh-content h2::before { content: '#'; color: var(--red); font: 600 14px var(--mono); margin-right: 10px; vertical-align: 4px; }
.gh-content h3 { margin-top: 8px; font: 600 20px/1.2 var(--sans); color: var(--ink); }
.gh-content ul, .gh-content ol { padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.gh-content li::marker { color: var(--dim); }
.gh-content blockquote { padding: 2px 0 2px 18px; border-left: 2px solid var(--line3); color: var(--muted); font-style: italic; }
.gh-content hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.gh-content figure { margin: 0; }
.gh-content figcaption { margin-top: 8px; font-size: 11px; color: var(--dim); }
.gh-content .kg-image-card img, .gh-content .kg-gallery-image img { border: 1px solid var(--line); border-radius: 6px; }
.kg-width-wide { margin-left: -60px !important; margin-right: -60px !important; }
.kg-width-full { margin-left: -120px !important; margin-right: -120px !important; }
.kg-width-wide img, .kg-width-full img { width: 100%; }
.zoomable { cursor: zoom-in; }

/* inline code + kbd */
.gh-content :not(pre) > code { font-size: .88em; padding: 1px 5px; background: #171b18; border: 1px solid var(--line); border-radius: 3px; color: var(--bone); }
.gh-content kbd { font-size: .85em; color: var(--ink); background: var(--surface); }

/* tables (pinout, BOM) */
.gh-content table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: table; }
.gh-content th { padding: 9px 14px; text-align: left; background: var(--surface); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 400; }
.gh-content td { padding: 9px 14px; border-top: 1px solid var(--soft); color: var(--muted); }
.gh-content tr:nth-child(even) td { background: var(--code2); }
.gh-content td:first-child { color: var(--dim); }
.gh-content td strong { color: var(--ink); }
.table-wrap { overflow-x: auto; border-radius: 6px; }

/* embeds (YouTube, Vimeo …) */
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-embed-card iframe[src*="youtube"], .kg-embed-card iframe[src*="vimeo"] { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; }

/* callouts: grey/blue = [i], green = [+], red/yellow = [!] */
.kg-callout-card { display: grid !important; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 0 !important; background: none !important; border: 0 !important; font-size: 14px; line-height: 1.85; color: var(--body); }
.kg-callout-card::before,
.kg-callout-card-grey::before, .kg-callout-card-white::before, .kg-callout-card-blue::before,
.kg-callout-card-purple::before, .kg-callout-card-accent::before { content: '[i]'; color: var(--slate); font-weight: 600; }
.kg-callout-card-green::before { content: '[+]'; color: var(--sage); }
.kg-callout-card-red::before, .kg-callout-card-yellow::before, .kg-callout-card-pink::before { content: '[!]'; color: var(--red); }
.kg-callout-emoji { display: none; }
.kg-callout-text { color: inherit; }

/* scope snippet */
.scope { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 6px; font-size: 12px; line-height: 1.65; color: var(--muted); }
.scope::before { content: '\f24e'; font: 900 13px 'Font Awesome 6 Free'; color: var(--dim); margin-top: 3px; }
.scope strong { color: var(--ink); }

/* file card */
.kg-file-card { margin: 0; }
/* icon box | name + "caption · size" | download */
.kg-file-card-container { display: grid !important; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 14px !important; border: 1px solid var(--line2) !important; border-radius: 6px; background: var(--surface) !important; color: var(--ink) !important;
  transition: transform .18s var(--ease), border-color .15s, background .15s, box-shadow .18s; }
.kg-file-card-container:hover { border-color: var(--line3) !important; background: var(--soft) !important; transform: translateY(-2px); box-shadow: 0 4px 0 -1px #050605; }
.kg-file-card-container::before { content: '\f15b'; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line2); border-radius: 6px; background: var(--code2); color: var(--muted); font: 900 15px 'Font Awesome 6 Free'; }
.kg-file-card-container[data-icon="fingerprint"]::before { content: '\f577'; }
.kg-file-card-container[data-icon="code"]::before { content: '\f1c9'; }
.kg-file-card-container[data-icon="zip"]::before { content: '\f1c6'; }
.kg-file-card-container[data-icon="chip"]::before { content: '\f2db'; }
.kg-file-card-container[data-icon="pdf"]::before { content: '\f1c1'; }
.kg-file-card-contents { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 0; min-width: 0; }
.kg-file-card-title { flex-basis: 100%; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-file-card-caption, .kg-file-card-metadata { display: flex; font-size: 11px; color: var(--dim); }
.kg-file-card-filename { display: none; }
/* "caption · size" (Ghost 6 Lexical file cards carry no size class) */
.kg-file-card-caption + .kg-file-card-metadata .kg-file-card-filesize::before { content: ' · '; white-space: pre; }
.kg-file-card-medium .kg-file-card-caption { display: flex; }
.kg-file-card-small .kg-file-card-caption { display: none; }
.kg-file-card-icon { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--body); }
.kg-file-card-icon svg { display: none; }
.kg-file-card-icon::before { content: '\f019'; font: 900 11px 'Font Awesome 6 Free'; }
.kg-file-card-icon::after { content: 'download'; }

/* code: source */
.codebox, .term { border: 1px solid var(--line); border-radius: 6px; background: var(--code2); overflow: hidden; }
.term { border-color: var(--line2); background: var(--code); }
.code-head, .term-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--soft); font-size: 11px; color: var(--dim); }
.code-head { background: var(--surface); }
.term-head .th { color: var(--body); }
.term-head .sh { color: var(--faint); }
.copy { all: unset; cursor: pointer; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--line2); border-radius: 4px; color: var(--dim);
  transition: transform .18s var(--ease), border-color .15s, color .15s, box-shadow .18s; }
.copy:hover { border-color: var(--line3); color: var(--ink); transform: translateY(-2px); box-shadow: 0 4px 0 -1px #050605; }
.copy.ok { color: var(--sage); }
.code-body { display: flex; overflow-x: auto; }
.gutter { flex: none; padding: 16px 0; width: 44px; text-align: right; padding-right: 12px; border-right: 1px solid var(--soft); color: var(--faint); font: 400 13px/1.8 var(--mono); white-space: pre; user-select: none; -webkit-user-select: none; }
.gh-content pre { margin: 0; padding: 16px 18px; font: 400 13px/1.8 var(--mono); color: var(--body); background: none; overflow-x: auto; tab-size: 4; }
.gh-content > pre { border: 1px solid var(--line); border-radius: 6px; background: var(--code2); }
.code-body pre { flex: 1; padding-left: 14px; overflow: visible; }
.gh-content pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; }

/* syntax (Prism) — soft palette, no red */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--moss); font-style: italic; }
.token.keyword, .token.atrule, .token.important, .token.selector { color: var(--clay); }
.token.function, .token.url, .token.attr-name { color: var(--teal); }
.token.string, .token.char, .token.attr-value, .token.regex, .token.inserted { color: var(--sage); }
.token.number, .token.boolean, .token.constant, .token.symbol { color: var(--wheat); }
.token.class-name, .token.builtin, .token.parameter, .token.property, .token.tag, .token.namespace { color: var(--slate); }
.token.variable { color: var(--bone); }
.token.operator, .token.punctuation { color: var(--dim); }
.token.deleted { color: var(--clay); }

/* code: terminal */
.term-body { padding: 16px 18px; overflow-x: auto; font: 400 13px/1.8 var(--mono); }
.tl { white-space: pre; display: flex; }
.tp { flex: none; user-select: none; -webkit-user-select: none; }
.tp .u { color: var(--bone); font-weight: 600; }
.tp .d { color: var(--dim); }
.tp .p { color: var(--teal); }
.tp.ps { color: var(--bone); font-weight: 600; }
.tc { color: var(--ink); }
.tc .fl { color: var(--slate); }
.to { color: var(--dim); }
.blk { display: inline-block; width: 8px; height: 15px; margin-top: 4px; background: var(--body); animation: blink 1.1s steps(1) infinite; }

/* archive */
.archive-side { position: sticky; top: 96px; align-self: start; gap: 18px; }
.archive-side h1 { margin: 0; font: 800 72px/.85 var(--sans); letter-spacing: -.04em; }
.archive-total { font-size: 12px; color: var(--muted); }
.archive-years { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.archive-years a { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--soft); font-size: 12px; }
.archive-years a span { color: var(--faint); }
.ayear { display: flex; flex-direction: column; scroll-margin-top: 80px; }
.ayear-head { display: flex; align-items: baseline; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ayear-head b { font: 800 44px/1 var(--sans); letter-spacing: -.03em; }
.ayear-head span { font-size: 11px; color: var(--dim); }
.amonth { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 24px; padding-top: 16px; }
.amonth > span { font-size: 11px; letter-spacing: .08em; color: var(--red); padding-top: 4px; }
.amonth > div { display: flex; flex-direction: column; }
.arow { display: grid; grid-template-columns: 40px minmax(0, 1fr) 190px 60px; gap: 16px; align-items: baseline; padding: 8px 0 12px; border-bottom: 1px solid var(--soft); color: var(--ink); }
.arow-day, .arow-read { font-size: 11px; color: var(--dim); }
.arow-read { text-align: right; }
.arow-title { font: 600 18px/1.25 var(--sans); }
.arow-topic { font-size: 11px; color: var(--body); }
[data-archive] { gap: 40px; }

/* search */
.search { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 96px 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(7, 8, 7, .8); backdrop-filter: blur(3px); }
.search-box { position: relative; width: 100%; max-width: 680px; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 24px 60px -12px #000; overflow: hidden; }
.search-input { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
.search-prompt { color: var(--bone); white-space: nowrap; user-select: none; }
.search-input input { all: unset; flex: 1; min-width: 0; color: var(--ink); caret-color: var(--red); }
.search-input input::placeholder { color: var(--faint); }
.search-count { display: flex; justify-content: space-between; padding: 10px 18px 6px; font-size: 11px; color: var(--dim); }
.search-results { display: flex; flex-direction: column; max-height: 380px; overflow-y: auto; padding: 0 8px 8px; }
.sr { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 10px; border-radius: 5px; color: var(--ink); }
.sr:hover, .sr.is-sel { background: var(--surface); color: var(--ink); }
.sr-caret { color: var(--faint); font-size: 12px; }
.sr.is-sel .sr-caret { color: var(--red); }
.sr-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sr-title { font: 600 16px/1.25 var(--sans); }
.sr-meta { font-size: 11px; color: var(--dim); }
.sr-hint { font-size: 11px; color: var(--faint); visibility: hidden; }
.sr.is-sel .sr-hint { visibility: visible; }
.sr-empty { padding: 28px 10px; font-size: 13px; color: var(--dim); }
.sr-empty b { color: var(--ink); font-weight: 400; }
.search-foot, .lb-hint { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface); font-size: 11px; color: var(--dim); }
.search-foot b, .lb-hint b { color: var(--body); font-weight: 400; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: rgba(7, 8, 7, .95); }
.lb-bar { height: 56px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 24px; border-bottom: 1px solid var(--soft); font-size: 12px; color: var(--dim); }
.lb-cap { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-tools { display: flex; align-items: center; gap: 6px; }
.lb-z { width: 56px; text-align: center; color: var(--ink); }
.lb-stage { flex: 1; overflow: auto; display: flex; padding: 32px; cursor: grab; }
.lb-stage.drag { cursor: grabbing; }
.lb-stage img { margin: auto; max-width: none; border: 1px solid var(--line2); user-select: none; -webkit-user-drag: none; }
.lb-hint { justify-content: center; background: none; border: 0; color: var(--faint); }

/* 404 */
.nf { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 72px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 56px; align-items: center; }
.nf-left { display: flex; flex-direction: column; gap: 20px; }
.nf h1 { margin: 0; font: 800 180px/.8 var(--sans); letter-spacing: -.05em; }
.nf p { margin: 0; max-width: 480px; font-size: 14px; line-height: 1.7; color: var(--muted); text-wrap: pretty; }
.nf-actions { display: flex; gap: 8px; }
.nf-ls { white-space: normal; flex-wrap: wrap; gap: 0 16px; }
.nf .term-body { font-size: 12.5px; }

/* footer */
.foot { position: relative; z-index: 1; border-top: 1px solid var(--line); padding: 10px 40px; display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: var(--dim); }

/* ≤ 1100: drop TOC column */
@media (max-width: 1100px) {
  .post-layout { grid-template-columns: 200px minmax(0, 680px); }
  .toc-col { display: none; }
  .tocbar { display: block; }
  html { scroll-padding-top: 120px; }
  .progress-pct { display: none; }
  body.drawer-open .tocbar { display: none; }
}

/* ≤ 900: mobile */
@media (max-width: 900px) {
  .topbar-in { padding: 4px 8px 4px 16px; gap: 8px; }
  .nav { gap: 0; }
  .nav .nav-link, .searchbox span, .searchbox kbd { display: none; }
  .searchbox { min-width: 0; width: 44px; height: 44px; justify-content: center; border: 0; background: none; padding: 0; }
  .menu-btn { display: flex; }
  .hexdump { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 28px 16px; }
  .layout > .sidebar:not(.archive-side) { display: none; }
  .main { gap: 28px; }
  .archive-side { position: static; }
  .hero h1 { font-size: 60px; }
  .featured { grid-template-columns: 1fr; }
  .featured-img { min-height: 0; aspect-ratio: 16 / 10; border-right: 0; border-bottom: 1px solid var(--line); }
  .featured-body { padding: 18px; }
  .featured h2 { font-size: 26px; }
  .featured { display: none; }
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "topic date" "title title" "read read"; gap: 6px 12px; padding: 16px 0; }
  .row-main, .row-meta { display: contents; }
  .row-meta { text-align: left; }
  .row-topic { grid-area: topic; }
  .row-date { grid-area: date; text-align: right; }
  .row-title { grid-area: title; font-size: 19px; text-wrap: pretty; }
  .row-read { grid-area: read; font-size: 11px; color: var(--dim); }
  .row-ex { display: none; }
  .load-more { align-self: stretch; justify-content: center; min-height: 44px; margin: 18px 0 8px; }
  .topic-num { font-size: 88px; }
  .topic-hero h1 { font-size: 42px; }
  .progress-box { grid-template-columns: 1fr; padding: 16px; }
  .pb-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
  .part { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 18px 0; }
  .part-n { font-size: 30px; }
  .part-title { font-size: 18px; }
  .part-ex { display: none; }
  .part .chip { grid-column: 2; justify-self: start; }
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 24px 16px 0; }
  .series { position: static; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
  .series summary { cursor: pointer; gap: 10px; }
  .series summary .label { border: 0; padding: 0; }
  .series summary .label i { display: inline; font-size: 10px; transition: transform .2s; }
  .series[open] summary .label i { transform: rotate(180deg); }
  .series-name { display: none; }
  .series-part { display: block; font-size: 11px; color: var(--dim); }
  .series-list a { min-height: 40px; align-items: center; }
  .article h1, .page h1 { font-size: 38px; line-height: 1; }
  .byline-tags { margin-left: 0; }
  .kg-width-wide, .kg-width-full { margin-left: -16px !important; margin-right: -16px !important; }
  .kg-width-wide img, .kg-width-full img { border-radius: 0; border-left: 0; border-right: 0; }
  .series-nav { grid-template-columns: 1fr; }
  .series-nav a.next { grid-column: 1; }
  .subscribe-end { grid-template-columns: 1fr; }
  .gh-content pre, .term-body, .gutter { font-size: 12px; }
  .amonth { grid-template-columns: 1fr; gap: 6px; }
  .arow { grid-template-columns: 32px minmax(0, 1fr); }
  .arow-topic, .arow-read { display: none; }
  .nf { grid-template-columns: 1fr; padding: 40px 16px; }
  .nf h1 { font-size: 120px; }
  .foot { padding: 14px 16px; }
  .foot-ghost { display: none; }
  .search { padding-top: 16px; }
  .search-prompt { display: none; }
  .search-foot { display: none; }
  .page { padding: 32px 16px 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
