/* Charlestar — modern, dependency-free blog UI */
:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #edf3f0;
  --surface-raised: rgba(255, 255, 255, 0.82);
  --ink: #13201d;
  --ink-soft: #49615b;
  --ink-muted: #72827e;
  --line: #dbe5e1;
  --line-strong: #c7d6d1;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #d6f1eb;
  --lime: #b7e54a;
  --hero: #0d1d1a;
  --hero-ink: #effff9;
  --code-bg: #101b19;
  --code-ink: #d9ebe5;
  --shadow-sm: 0 1px 2px rgba(16, 44, 37, 0.05);
  --shadow-md: 0 18px 45px rgba(16, 44, 37, 0.09);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shell: 1180px;
  --narrow: 840px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1412;
  --surface: #121e1b;
  --surface-soft: #172723;
  --surface-raised: rgba(18, 30, 27, 0.84);
  --ink: #e5f1ed;
  --ink-soft: #adc0ba;
  --ink-muted: #7f948e;
  --line: #263a35;
  --line-strong: #344b45;
  --accent: #5fd1bf;
  --accent-strong: #85e2d3;
  --accent-soft: #173f38;
  --lime: #c3ef5b;
  --hero: #08110f;
  --hero-ink: #effff9;
  --code-bg: #07110f;
  --code-ink: #d8ebe5;
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.26);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 180ms ease, color 180ms ease;
}

body, button, input { font: inherit; }
button, input { color: inherit; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
img { display: block; max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--lime); color: #12201d; }

.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.narrow-shell { width: min(calc(100% - 40px), var(--narrow)); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; inset: 12px auto auto 12px; z-index: 200;
  translate: 0 -160%; padding: 10px 16px; border-radius: 8px;
  background: var(--ink); color: var(--bg); text-decoration: none;
}
.skip-link:focus { translate: 0; }

:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }

.reading-progress {
  position: fixed; inset: 0 auto auto 0; z-index: 150; width: 0; height: 3px;
  background: linear-gradient(90deg, var(--lime), var(--accent));
}

/* Navigation */
.site-header {
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.site-header.is-scrolled { border-color: var(--line); box-shadow: var(--shadow-sm); }
.nav-shell { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; aspect-ratio: 1;
  border-radius: 11px; background: var(--ink); color: var(--bg);
  font-weight: 850; letter-spacing: -0.04em;
}
.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-size: 15px; letter-spacing: -0.02em; }
.brand-copy small { margin-top: 5px; color: var(--ink-muted); font-size: 9px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav > a, .theme-toggle {
  display: grid; place-items: center; min-height: 40px; padding: 8px 13px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink-soft);
  font-size: 14px; font-weight: 650; text-decoration: none; cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.site-nav > a:hover, .site-nav > a[aria-current="page"], .theme-toggle:hover { background: var(--surface-soft); color: var(--ink); }
.site-nav > a[aria-current="page"] { color: var(--accent); }
.theme-toggle { width: 40px; padding: 0; margin-left: 4px; font-size: 19px; }
.nav-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; }
.nav-toggle span:not(.sr-only) { display: block; width: 18px; height: 2px; margin: 5px auto; background: var(--ink); transition: transform 180ms ease; }
.nav-toggle[aria-expanded="true"] span:nth-of-type(2) { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-of-type(3) { transform: translateY(-3.5px) rotate(-45deg); }

/* Shared elements */
.eyebrow {
  margin: 0 0 18px; color: var(--accent); font-size: 11px; font-weight: 800;
  letter-spacing: 0.16em; line-height: 1.4; text-transform: uppercase;
}
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 11px 20px; border: 1px solid transparent; border-radius: 12px;
  font-size: 14px; font-weight: 750; line-height: 1; text-decoration: none; cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 25%, transparent); }
.button-primary:hover { background: var(--accent-strong); }
.button-ghost, .button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.button-ghost:hover, .button-secondary:hover { border-color: var(--accent); color: var(--accent); }
.hero-summary { max-width: 680px; margin: 0; color: var(--ink-soft); font-size: clamp(17px, 2vw, 20px); line-height: 1.75; }

/* Home */
.home-hero { position: relative; overflow: hidden; padding: clamp(72px, 9vw, 128px) 0 88px; background: var(--hero); color: var(--hero-ink); }
.hero-grid-pattern {
  position: absolute; inset: 0; opacity: 0.34; pointer-events: none;
  background-image: linear-gradient(rgba(110, 231, 183, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(110, 231, 183, 0.07) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to right, transparent 2%, #000 45%, transparent 95%);
}
.home-hero::before {
  content: ""; position: absolute; width: 640px; aspect-ratio: 1; right: -220px; top: -310px;
  border-radius: 50%; background: radial-gradient(circle, rgba(95, 209, 191, 0.17), transparent 68%); pointer-events: none;
}
.home-hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr); align-items: center; gap: clamp(48px, 8vw, 112px); }
.home-hero .eyebrow { display: flex; align-items: center; gap: 10px; color: #8ee5d7; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(183, 229, 74, 0.12); }
.home-hero h1 {
  max-width: 760px; margin: 0 0 26px; font-size: clamp(45px, 6.3vw, 78px);
  font-weight: 830; letter-spacing: -0.065em; line-height: 1.03;
}
.home-hero h1 em { color: #90e1d4; font-style: normal; }
.home-hero .hero-summary { color: #a9beb8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.home-hero .button-ghost { border-color: #36514a; background: rgba(255,255,255,0.035); color: #e2f1ec; }
.home-hero .button-ghost:hover { border-color: #74cbbb; }
.hero-console { overflow: hidden; border: 1px solid #29463f; border-radius: 18px; background: rgba(7, 20, 17, 0.76); box-shadow: 0 28px 70px rgba(0,0,0,.32); transform: rotate(1deg); }
.console-bar { display: flex; align-items: center; gap: 7px; padding: 14px 16px; border-bottom: 1px solid #243d37; background: rgba(255,255,255,.025); }
.console-bar > span { width: 8px; height: 8px; border-radius: 50%; background: #46625b; }
.console-bar > span:first-child { background: #ef765d; }
.console-bar > span:nth-child(2) { background: #e7c35c; }
.console-bar > span:nth-child(3) { background: #6bc98a; }
.console-bar code { margin-left: auto; color: #66827b; font: 10px var(--font-mono); }
.console-body { min-height: 285px; padding: 26px 28px; color: #aac2bc; font: 13px/1.9 var(--font-mono); }
.console-body p { margin: 0 0 8px; }
.prompt { color: var(--lime); }
.console-output { padding-left: 19px; color: #7f9992; }
.console-output::before { content: "↳ "; color: #49665f; }
.console-body strong { color: #c3ef5b; }
.console-cursor { display: inline-block; width: 8px; height: 15px; background: #74d9c9; animation: cursor-blink 1.05s steps(1) infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }

.home-stats { border-bottom: 1px solid var(--line); background: var(--surface); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats-grid div { display: flex; align-items: baseline; gap: 10px; padding: 23px 24px; border-right: 1px solid var(--line); }
.stats-grid div:first-child { padding-left: 0; }
.stats-grid div:last-child { border-right: 0; }
.stats-grid strong { color: var(--accent); font-size: 20px; letter-spacing: -0.03em; }
.stats-grid span { color: var(--ink-muted); font-size: 12px; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 70px; padding-block: 82px 108px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.045em; line-height: 1.15; }
.section-heading > span, .section-heading > a { color: var(--ink-muted); font-size: 12px; text-decoration: none; }
.post-list { display: grid; gap: 16px; }
.post-card {
  padding: clamp(24px, 4vw, 34px); border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); box-shadow: var(--shadow-sm); content-visibility: auto; contain-intrinsic-size: 280px;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.post-card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.post-card-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; color: var(--ink-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.post-card-meta a { padding-left: 10px; border-left: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.post-card h3 { margin: 0; font-size: clamp(22px, 3vw, 28px); letter-spacing: -0.04em; line-height: 1.3; }
.post-card h3 a { text-decoration: none; }
.post-card h3 a:hover { color: var(--accent); }
.post-card > p { margin: 13px 0 22px; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.post-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid var(--line); }
.mini-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-tags span { padding: 4px 8px; border-radius: 6px; background: var(--surface-soft); color: var(--ink-muted); font-size: 10px; font-weight: 650; }
.read-link { flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 750; text-decoration: none; }
.read-link span { display: inline-block; transition: transform 150ms ease; }
.read-link:hover span { transform: translateX(3px); }
.pagination { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; }
.pagination a { padding: 10px 0; color: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; }

.home-sidebar { position: sticky; top: 104px; display: grid; gap: 16px; }
.sidebar-card { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.search-card { z-index: 4; }
.search-card > label, .sidebar-heading { display: flex; justify-content: space-between; margin-bottom: 13px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.sidebar-heading a { color: var(--accent); font-size: 10px; text-decoration: none; }
.search-field { display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.search-field > span { color: var(--ink-muted); font-size: 20px; }
.search-field input { width: 100%; min-width: 0; padding: 11px 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-field input::placeholder { color: var(--ink-muted); }
.search-field kbd { padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink-muted); font: 9px var(--font-mono); }
.search-results { position: absolute; top: calc(100% - 10px); left: 12px; right: 12px; overflow: auto; max-height: 420px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); }
.search-result { display: grid; gap: 3px; padding: 11px; border-radius: 8px; text-decoration: none; }
.search-result:hover, .search-result[aria-selected="true"] { background: var(--surface-soft); }
.search-result strong { font-size: 12px; line-height: 1.5; }
.search-result span { color: var(--ink-muted); font-size: 10px; }
.search-empty { margin: 0; padding: 16px 10px; color: var(--ink-muted); font-size: 12px; text-align: center; }
.topic-list { display: grid; }
.topic-list a { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; text-decoration: none; }
.topic-list a:last-child { border-bottom: 0; padding-bottom: 0; }
.topic-list a:hover span { color: var(--accent); }
.topic-list small { color: var(--ink-muted); }
.profile-card { display: grid; grid-template-columns: 48px 1fr; gap: 12px; background: var(--hero); color: var(--hero-ink); }
.profile-card img { width: 48px; aspect-ratio: 1; border-radius: 13px; object-fit: cover; }
.profile-card > div { display: grid; align-content: center; line-height: 1.3; }
.profile-card strong { font-size: 13px; }
.profile-card span { color: #829b94; font-size: 10px; }
.profile-card p, .profile-card > a { grid-column: 1 / -1; }
.profile-card p { margin: 5px 0 0; color: #9fb4ae; font-size: 11px; line-height: 1.7; }
.profile-card > a { color: #8de1d4; font-size: 11px; font-weight: 700; text-decoration: none; }

/* Page and post heroes */
.page-hero { padding: clamp(72px, 10vw, 124px) 0; border-bottom: 1px solid var(--line); background: var(--surface); }
.page-hero h1 { margin: 0 0 18px; font-size: clamp(46px, 8vw, 78px); letter-spacing: -0.065em; line-height: 1; }
.page-content { padding-block: 72px 108px; }
.post-hero { position: relative; overflow: hidden; padding: 54px 0 clamp(76px, 10vw, 128px); background: var(--hero); color: var(--hero-ink); }
.post-hero::after { content: ""; position: absolute; inset: auto 0 0; height: 1px; background: linear-gradient(90deg, transparent, #2c5148, transparent); }
.post-hero-inner { position: relative; z-index: 2; max-width: 980px; }
.back-link { display: inline-block; margin-bottom: clamp(54px, 8vw, 90px); color: #8fa9a2; font-size: 12px; font-weight: 650; text-decoration: none; }
.back-link:hover { color: #fff; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tag-chip { padding: 6px 10px; border: 1px solid #315149; border-radius: 999px; color: #9dded2; font-size: 10px; font-weight: 750; text-decoration: none; }
.tag-chip:hover { border-color: #69cdbc; color: #fff; }
.post-hero h1 { max-width: 980px; margin: 0; font-size: clamp(38px, 6.2vw, 70px); letter-spacing: -0.06em; line-height: 1.08; text-wrap: balance; }
.post-deck { max-width: 770px; margin: 24px 0 0; color: #9db3ad; font-size: clamp(17px, 2vw, 21px); line-height: 1.65; }
.post-byline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 34px; color: #7e9790; font-size: 11px; font-weight: 650; letter-spacing: .02em; }
.hero-orbit { position: absolute; border: 1px solid rgba(111, 211, 193, .13); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 470px; aspect-ratio: 1; right: -120px; top: -170px; }
.orbit-two { width: 710px; aspect-ratio: 1; right: -245px; top: -290px; }

.article-grid { display: grid; grid-template-columns: minmax(0, 780px) 220px; justify-content: center; align-items: start; gap: 78px; padding-block: clamp(62px, 8vw, 96px) 110px; }
.article-column { min-width: 0; }
.desktop-toc { min-width: 0; }
.toc-sticky { position: sticky; top: 112px; max-height: calc(100vh - 140px); overflow: auto; padding-left: 18px; border-left: 1px solid var(--line); }
.toc-title { margin: 0 0 13px; color: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.toc-list { display: grid; gap: 3px; }
.toc-list a { padding: 5px 0; color: var(--ink-muted); font-size: 11px; line-height: 1.45; text-decoration: none; transition: color 150ms ease; }
.toc-list a.toc-level-3 { padding-left: 12px; font-size: 10px; }
.toc-list a:hover, .toc-list a.is-active { color: var(--accent); }
.mobile-toc { display: none; margin-bottom: 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.mobile-toc summary { padding: 13px 16px; font-size: 12px; font-weight: 750; cursor: pointer; }
.mobile-toc .toc-list { padding: 0 16px 16px; }

/* Rich article content */
.prose { color: var(--ink-soft); font-size: 16px; line-height: 1.86; }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); font-weight: 780; letter-spacing: -0.035em; line-height: 1.3; scroll-margin-top: 98px; }
.prose h2 { margin: 2.7em 0 .8em; padding-top: .35em; font-size: clamp(26px, 4vw, 33px); }
.prose h3 { margin: 2.1em 0 .7em; font-size: 22px; }
.prose h4 { margin: 1.8em 0 .6em; font-size: 18px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.35em; }
.prose li + li { margin-top: .42em; }
.prose strong { color: var(--ink); font-weight: 720; }
.prose a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.prose a:hover { text-decoration-color: currentColor; }
.prose blockquote { margin: 2em 0; padding: 18px 22px; border: 0; border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-soft); color: var(--ink-soft); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { height: auto; margin: 2.2em auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.prose hr { height: 1px; margin: 3.2em 0; border: 0; background: var(--line); }
.prose table { width: 100%; margin: 2em 0; border-collapse: collapse; font-size: 13px; }
.prose th, .prose td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--surface-soft); color: var(--ink); font-weight: 750; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-soft) 55%, transparent); }
.prose code { padding: .16em .38em; border-radius: 5px; background: var(--accent-soft); color: var(--accent-strong); font: .88em/1.5 var(--font-mono); overflow-wrap: anywhere; }
.prose pre { position: relative; overflow: auto; margin: 2em 0; padding: 24px; border: 1px solid #253c36; border-radius: 14px; background: var(--code-bg); color: var(--code-ink); box-shadow: var(--shadow-sm); tab-size: 2; }
.prose pre code { display: block; padding: 0; background: transparent; color: inherit; font-size: 12px; line-height: 1.72; overflow-wrap: normal; }
.code-tools { position: absolute; top: 9px; right: 9px; display: flex; align-items: center; gap: 6px; }
.code-language, .code-copy { padding: 4px 7px; border: 1px solid #304943; border-radius: 6px; background: #142420; color: #89a29b; font: 9px var(--font-mono); }
.code-copy { cursor: pointer; }
.code-copy:hover { border-color: #5fb7a7; color: #c9efe7; }
.code-copy.is-copied { color: var(--lime); }
.highlight { margin: 0; }
.highlight pre { margin: 2em 0; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cp { color: #77938b; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #77d5c5; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .se, .highlight .sr { color: #c3e88d; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh { color: #f2c775; }
.highlight .na, .highlight .nb, .highlight .nc, .highlight .nf { color: #82aaff; }
.highlight .o, .highlight .ow { color: #e89bca; }
.MathJax { overflow-x: auto; overflow-y: hidden; }

.article-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 68px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.article-actions p { margin: 2px 0 0; color: var(--ink-muted); font-size: 12px; }
.article-actions .action-label { color: var(--ink); font-size: 15px; font-weight: 750; }
.action-buttons { display: flex; gap: 9px; }
.article-actions .button { min-height: 42px; padding-inline: 15px; font-size: 11px; }
.post-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 24px; }
.post-pager > a { display: grid; gap: 5px; min-height: 105px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); text-decoration: none; transition: border-color 150ms ease, transform 150ms ease; }
.post-pager > a:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-pager .next { text-align: right; }
.post-pager small { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.post-pager span { color: var(--ink); font-size: 12px; font-weight: 680; line-height: 1.55; }
.related-section { margin-top: 70px; }
.compact-heading { align-items: center; margin-bottom: 20px; }
.compact-heading h2 { font-size: 27px; }
.compact-heading > a { color: var(--accent); }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.related-card { display: flex; min-height: 180px; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); text-decoration: none; }
.related-card:hover { border-color: var(--accent); }
.related-card time { color: var(--ink-muted); font-size: 9px; }
.related-card strong { margin-top: 13px; color: var(--ink); font-size: 12px; line-height: 1.55; }
.related-card span { margin-top: auto; padding-top: 18px; color: var(--accent); font-size: 10px; font-weight: 700; }
.comments { margin-top: 70px; padding-top: 34px; border-top: 1px solid var(--line); }

/* Tags */
.topic-hero { background: radial-gradient(circle at 82% 20%, var(--accent-soft), transparent 25%), var(--surface); }
.topics-page { padding-block: 60px 110px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 9px; padding-bottom: 54px; border-bottom: 1px solid var(--line); }
.tag-cloud a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; text-decoration: none; }
.tag-cloud a:hover { border-color: var(--accent); color: var(--accent); }
.tag-cloud small { color: var(--ink-muted); font-size: 9px; }
.topic-groups { display: grid; gap: 70px; padding-top: 64px; }
.topic-group { scroll-margin-top: 100px; }
.topic-group-heading { display: flex; align-items: baseline; gap: 13px; margin-bottom: 13px; }
.topic-group-heading h2 { margin: 0; font-size: 28px; letter-spacing: -0.04em; }
.topic-group-heading span { color: var(--ink-muted); font-size: 11px; }
.topic-posts { border-top: 1px solid var(--line-strong); }
.topic-posts a { display: grid; grid-template-columns: 88px 1fr auto; gap: 18px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.topic-posts a:hover span, .topic-posts a:hover b { color: var(--accent); }
.topic-posts time { color: var(--ink-muted); font: 10px var(--font-mono); }
.topic-posts span { font-size: 13px; font-weight: 650; transition: color 150ms ease; }
.topic-posts b { color: var(--ink-muted); font-weight: 500; transition: color 150ms ease; }

/* About */
.about-hero { overflow: hidden; padding: clamp(76px, 10vw, 132px) 0; border-bottom: 1px solid #294039; background: var(--hero); color: var(--hero-ink); }
.about-hero-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: center; gap: clamp(50px, 9vw, 120px); max-width: 980px; }
.about-portrait-wrap { position: relative; width: min(100%, 270px); }
.about-portrait { position: relative; z-index: 1; width: 238px; aspect-ratio: 1; margin: auto; border: 1px solid #45665e; border-radius: 34% 66% 58% 42% / 44% 43% 57% 56%; object-fit: cover; filter: saturate(.83) contrast(1.04); }
.portrait-ring { position: absolute; inset: -24px 0 0 22px; width: 250px; aspect-ratio: 1; border: 1px solid #35564e; border-radius: 50%; }
.about-hero .eyebrow { color: #80d8ca; }
.about-hero h1 { margin: 0 0 22px; font-size: clamp(46px, 7vw, 74px); letter-spacing: -.065em; line-height: 1; }
.about-lead { max-width: 610px; margin: 0; color: #a8bdb7; font-size: clamp(17px, 2vw, 21px); line-height: 1.75; }
.about-links { display: flex; gap: 11px; margin-top: 30px; }
.about-hero .button-ghost { border-color: #36544c; background: transparent; color: #e9f5f1; }
.about-content { padding-block: 80px 110px; }
.content-panel { padding: 54px 0; border-bottom: 1px solid var(--line); }
.section-index { margin: 0; color: var(--accent); font: 700 10px/1.4 var(--font-mono); letter-spacing: .12em; }
.about-intro { display: grid; grid-template-columns: 160px 1fr; gap: 45px; padding-top: 0; }
.about-intro h2, .panel-heading h2 { margin: 0 0 24px; color: var(--ink); font-size: clamp(28px, 4vw, 40px); letter-spacing: -.045em; line-height: 1.25; }
.about-intro p:not(.section-index) { color: var(--ink-soft); font-size: 16px; line-height: 1.85; }
.panel-heading { margin-bottom: 30px; }
.panel-heading h2 { margin-top: 8px; }
.stack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack-grid > div { min-height: 155px; padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.stack-grid span { color: var(--accent); font: 700 9px var(--font-mono); }
.stack-grid h3 { margin: 15px 0 8px; font-size: 17px; }
.stack-grid p { margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 1.6; }
.experience-row { display: grid; grid-template-columns: 160px 1fr; gap: 45px; }
.experience-row time { color: var(--ink-muted); font: 10px var(--font-mono); }
.experience-row h3 { margin: 0 0 7px; font-size: 18px; }
.experience-row p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.about-cta { margin-top: 75px; padding: clamp(32px, 6vw, 55px); border-radius: var(--radius-lg); background: var(--accent-soft); }
.about-cta h2 { max-width: 610px; margin: 0 0 27px; font-size: clamp(27px, 4vw, 40px); letter-spacing: -.045em; line-height: 1.3; }
.about-cta > div { display: flex; flex-wrap: wrap; gap: 20px; }
.about-cta a { color: var(--accent-strong); font-size: 12px; font-weight: 750; }

/* Error */
.error-page { position: relative; overflow: hidden; min-height: calc(100vh - 76px); display: grid; place-content: center; justify-items: center; padding: 80px 20px; text-align: center; }
.error-page h1 { max-width: 760px; margin: 0 0 17px; font-size: clamp(42px, 7vw, 72px); letter-spacing: -.06em; line-height: 1.08; }
.error-page > p:not(.eyebrow) { margin: 0; color: var(--ink-soft); font-size: 16px; }
.error-actions { display: flex; gap: 11px; margin-top: 28px; }
.error-code { position: absolute; z-index: -1; color: color-mix(in srgb, var(--accent) 7%, transparent); font-size: min(38vw, 480px); font-weight: 900; letter-spacing: -.1em; }
.error-glow { position: absolute; z-index: -1; width: 520px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 66%); }

/* Footer */
.site-footer { padding: 64px 0 24px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; padding-bottom: 42px; }
.footer-brand { font-size: 18px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
.footer-grid p { max-width: 470px; margin: 8px 0 0; color: var(--ink-muted); font-size: 12px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--ink-soft); font-size: 12px; font-weight: 650; text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-meta { display: flex; justify-content: space-between; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 10px; }

@media (max-width: 960px) {
  .home-hero-grid { grid-template-columns: 1fr; }
  .hero-console { max-width: 610px; transform: none; }
  .home-layout { grid-template-columns: 1fr; gap: 50px; }
  .home-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .search-card { grid-column: 1 / -1; }
  .article-grid { grid-template-columns: minmax(0, 760px); }
  .desktop-toc { display: none; }
  .mobile-toc { display: block; }
}

@media (max-width: 720px) {
  .shell, .narrow-shell { width: min(calc(100% - 28px), var(--shell)); }
  .nav-shell { min-height: 68px; }
  .brand-copy small { display: none; }
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: calc(100% + 1px); left: 14px; right: 14px;
    display: none; align-items: stretch; flex-direction: column; gap: 3px; padding: 10px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md);
  }
  .site-nav.is-open { display: flex; }
  .site-nav > a { justify-content: start; }
  .theme-toggle { width: 100%; margin: 0; }
  .home-hero { padding: 65px 0 68px; }
  .home-hero h1 { font-size: clamp(42px, 13vw, 58px); }
  .hero-console { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid div { padding: 17px 12px; border-bottom: 1px solid var(--line); }
  .stats-grid div:first-child { padding-left: 12px; }
  .stats-grid div:nth-child(2) { border-right: 0; }
  .stats-grid div:nth-child(3), .stats-grid div:nth-child(4) { border-bottom: 0; }
  .home-layout { padding-block: 58px 76px; }
  .post-card-footer { align-items: end; }
  .mini-tags { gap: 4px; }
  .mini-tags span:nth-child(n+3) { display: none; }
  .home-sidebar { grid-template-columns: 1fr; }
  .search-card { grid-column: auto; }
  .post-hero { padding-top: 34px; }
  .back-link { margin-bottom: 48px; }
  .article-grid { padding-block: 40px 76px; }
  .prose { font-size: 15px; line-height: 1.82; }
  .prose table { display: block; overflow-x: auto; white-space: nowrap; }
  .prose pre { margin-inline: -4px; padding: 20px 16px; }
  .article-actions { align-items: stretch; flex-direction: column; }
  .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .related-card { min-height: 130px; }
  .topic-posts a { grid-template-columns: 1fr auto; gap: 8px; }
  .topic-posts time { grid-column: 1 / -1; }
  .about-hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .about-portrait-wrap { width: 190px; }
  .about-portrait { width: 174px; }
  .portrait-ring { inset: -16px 0 0 15px; width: 184px; }
  .about-intro, .experience-row { grid-template-columns: 1fr; gap: 24px; }
  .stack-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-links { flex-wrap: wrap; }
  .footer-meta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 440px) {
  .post-card { padding: 22px 19px; }
  .post-pager { grid-template-columns: 1fr; }
  .post-pager > span:empty { display: none; }
  .post-pager .next { text-align: left; }
  .article-actions .action-buttons { grid-template-columns: 1fr; }
  .footer-links { display: grid; grid-template-columns: 1fr 1fr; }
}

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

@media print {
  .site-header, .site-footer, .reading-progress, .desktop-toc, .mobile-toc,
  .article-actions, .comments { display: none !important; }
  body { background: #fff; color: #000; }
  .post-hero { padding: 32px 0; background: #fff; color: #000; }
  .post-hero h1, .post-deck, .post-byline { color: #000; }
  .article-grid { display: block; padding: 30px 0; }
  .prose { color: #111; }
}
