/* Core */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { margin: 0; min-width: 320px; font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; font-size: 16px; line-height: 1.68; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; transition: color .2s ease, background .2s ease; }
body.nav-open, body.modal-open { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { color: var(--selection-text); background: var(--selection-bg); }

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5ef;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --surface-soft: #eceee7;
  --text: #17231e;
  --text-secondary: #53615a;
  --text-muted: #7c8982;
  --border: #d7ddd7;
  --border-strong: #bac5be;
  --accent: #126b4d;
  --accent-hover: #0b543b;
  --accent-soft: #dfece5;
  --warm: #c95c36;
  --warm-soft: #f2e3dc;
  --danger: #b83b3b;
  --success: #19704f;
  --nav-bg: rgba(245,245,239,.9);
  --shadow: 0 16px 44px rgba(25,45,35,.08);
  --shadow-small: 0 8px 24px rgba(25,45,35,.06);
  --selection-bg: #126b4d;
  --selection-text: #fff;
  --code-bg: #18231e;
  --code-text: #edf6f1;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1512;
  --surface: #121e19;
  --surface-strong: #17251f;
  --surface-soft: #1c2c25;
  --text: #e9f0ec;
  --text-secondary: #aab8b0;
  --text-muted: #7f9087;
  --border: #2b3c34;
  --border-strong: #40564b;
  --accent: #72caa5;
  --accent-hover: #9bddc0;
  --accent-soft: #19392d;
  --warm: #e98a66;
  --warm-soft: #3b261f;
  --danger: #ef8c8c;
  --success: #72caa5;
  --nav-bg: rgba(13,21,18,.9);
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --shadow-small: 0 8px 26px rgba(0,0,0,.22);
  --selection-bg: #72caa5;
  --selection-text: #0d1512;
  --code-bg: #080e0b;
  --code-text: #e8f1ec;
}

.sr-only { position: absolute !important; 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; top: 8px; left: 8px; z-index: 1000; padding: 10px 14px; color: #fff; background: var(--accent); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.container { width: min(100%, 1200px); margin: 0 auto; padding: 0 28px; }

/* Navigation */
.navbar { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); background: var(--nav-bg); backdrop-filter: blur(18px) saturate(150%); }
.nav-container { width: min(100%, 1200px); height: 68px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 22px; }
.nav-logo { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; color: var(--text); font-weight: 750; letter-spacing: -.025em; }
.nav-logo:hover { color: var(--text); }
.nav-logo-mark, .footer-mark { width: 34px; height: 34px; display: inline-grid; place-items: center; color: #fff; background: var(--accent); border-radius: 10px 3px 10px 3px; font-size: .9rem; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.nav-logo-text { white-space: nowrap; }
.nav-menu { display: flex; align-items: center; justify-content: center; flex: 1; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-menu a { position: relative; display: block; padding: 8px 11px; color: var(--text-secondary); border-radius: 8px; font-size: .89rem; font-weight: 550; }
.nav-menu a::after { content: ""; position: absolute; right: 11px; bottom: 3px; left: 11px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform .18s ease; }
.nav-menu a:hover, .nav-menu a.active { color: var(--text); background: var(--surface-soft); }
.nav-menu a.active::after { transform: scaleX(1); }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.nav-icon-btn { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; color: var(--text-secondary); background: transparent; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: color .18s, background .18s, border-color .18s; }
.nav-icon-btn:hover, .nav-icon-btn.active { color: var(--accent); background: var(--surface); border-color: var(--border); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.nav-toggle { display: none; width: 42px; height: 42px; margin-left: auto; padding: 10px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: transparent; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Buttons and labels */
.btn { min-height: 42px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); border-radius: 12px; font-weight: 650; font-size: .92rem; transition: transform .18s, color .18s, background .18s, border-color .18s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { color: #fff; background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { color: var(--text); background: var(--surface); }
.btn-quiet:hover { color: var(--accent); border-color: var(--accent); }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }

/* Home hero */
.hero { position: relative; isolation: isolate; min-height: 360px; margin: 30px 0 42px; padding: clamp(36px, 6vw, 64px); display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: end; gap: clamp(32px, 7vw, 90px); overflow: hidden; color: #f7fbf8; background: #173f31; border: 1px solid rgba(255,255,255,.1); border-radius: 28px 8px 28px 8px; box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; z-index: -1; width: 430px; height: 430px; top: -230px; right: -80px; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 54px rgba(255,255,255,.035), 0 0 0 108px rgba(255,255,255,.025); }
.hero::after { content: ""; position: absolute; z-index: -1; inset: 0; opacity: .12; background-image: linear-gradient(rgba(255,255,255,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.25) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(90deg, transparent 10%, #000 90%); }
.hero .eyebrow { color: #a9dbc5; }
.hero-title { max-width: 700px; margin: 0; font-size: clamp(2.55rem, 6vw, 5rem); line-height: 1.02; letter-spacing: -.065em; font-weight: 760; }
.hero-subtitle { max-width: 650px; margin: 20px 0 26px; color: rgba(247,251,248,.76); font-size: clamp(1rem, 2vw, 1.18rem); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn-primary { color: #173f31; background: #f5f5ef; border-color: #f5f5ef; }
.hero .btn-primary:hover { color: #173f31; background: #fff; border-color: #fff; }
.hero .btn-quiet { color: #fff; background: transparent; border-color: rgba(255,255,255,.34); }
.hero .btn-quiet:hover { border-color: rgba(255,255,255,.75); }
.hero-cats { margin-top: 25px; display: flex; flex-wrap: wrap; gap: 7px; }
.hero-cat-badge { padding: 5px 10px; color: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; font-size: .78rem; }
.hero-cat-badge:hover { color: #fff; border-color: rgba(255,255,255,.5); }
.hero-focus { position: relative; padding: 22px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13); border-radius: 18px 5px 18px 5px; backdrop-filter: blur(5px); }
.hero-focus-label { display: block; padding-bottom: 13px; color: #a9dbc5; border-bottom: 1px solid rgba(255,255,255,.16); font-size: .68rem; letter-spacing: .12em; font-weight: 750; }
.hero-focus ol { margin: 13px 0 0; padding: 0; list-style: none; }
.hero-focus li { padding: 10px 0; display: flex; gap: 11px; align-items: baseline; color: rgba(255,255,255,.9); font-size: .89rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.hero-focus li:last-child { border-bottom: 0; }
.hero-focus li span { color: #a9dbc5; font-size: .7rem; font-variant-numeric: tabular-nums; }

/* Sections and cards */
.section { padding: 38px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-header { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-title, .page-header h1 { margin: 0; color: var(--text); font-size: clamp(1.75rem, 4vw, 2.55rem); line-height: 1.14; letter-spacing: -.045em; }
.section-note { color: var(--text-muted); font-size: .86rem; }
.section-more { font-size: .88rem; font-weight: 700; white-space: nowrap; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 18px 5px 18px 5px; transition: transform .2s, border-color .2s, box-shadow .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-small); }
.card-featured { grid-column: auto; }
.card-cover { aspect-ratio: 16 / 9; display: block; overflow: hidden; background: var(--surface-soft); }
.card-cover img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-cover img { transform: scale(1.025); }
.card-placeholder { min-height: 150px; padding: 20px; display: flex; align-items: end; justify-content: space-between; color: #f3f7f5; background-color: #355e4c; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 25px 25px; }
.card-placeholder-project { background-color: #874f36; }
.card-placeholder:hover { color: #fff; }
.card-placeholder span { font-size: 2.5rem; line-height: 1; font-weight: 760; letter-spacing: -.05em; }
.card-placeholder small { font-size: .65rem; letter-spacing: .15em; }
.card-body { min-height: 224px; padding: 20px; display: flex; flex: 1; flex-direction: column; }
.card-type { width: fit-content; margin-bottom: 10px; padding: 3px 8px; display: inline-flex; color: var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: .7rem; line-height: 1.4; font-weight: 750; letter-spacing: .04em; }
.badge-project { color: var(--warm); background: var(--warm-soft); }
.badge-resource, .badge-gallery { color: #6d5d9b; background: #ece8f6; }
[data-theme="dark"] .badge-resource, [data-theme="dark"] .badge-gallery { color: #b7a9dd; background: #28233b; }
.card-title { margin: 0 0 9px; font-size: 1.08rem; line-height: 1.43; letter-spacing: -.015em; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--text-secondary); font-size: .9rem; line-height: 1.62; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; padding-top: 15px; display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-muted); font-size: .76rem; }
.card-meta a { font-weight: 650; }

/* Lists and collections */
.article-list { display: grid; gap: 10px; }
.article-row { position: relative; min-width: 0; padding: 22px 58px 22px 22px; display: flex; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px 4px 15px 4px; transition: border-color .2s, background .2s, transform .2s; }
.article-row:hover { transform: translateX(2px); border-color: var(--border-strong); background: var(--surface-strong); }
.article-row-cover { width: 176px; min-height: 118px; flex: 0 0 auto; overflow: hidden; border-radius: 10px 3px 10px 3px; background: var(--surface-soft); }
.article-row-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.article-row-body { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.article-row-topline { margin-bottom: 7px; display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: .76rem; }
.article-row-topline .card-type { margin-bottom: 0; }
.article-row-title { margin: 0 0 6px; font-size: clamp(1.02rem, 2vw, 1.18rem); line-height: 1.42; }
.article-row-title a { color: var(--text); }
.article-row-title a:hover { color: var(--accent); }
.article-row-excerpt { margin: 0; color: var(--text-secondary); font-size: .88rem; line-height: 1.58; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-row-arrow { position: absolute; top: 50%; right: 21px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--text-muted); border: 1px solid var(--border); border-radius: 50%; transform: translateY(-50%); }
.article-row:hover .article-row-arrow { color: var(--accent); border-color: var(--accent); }
.collection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.collection-panel { padding: 24px; color: #eaf5f0; background: #224c3c; border-radius: 20px 6px 20px 6px; }
.collection-panel-accent { color: #fff4ef; background: #73462f; }
.collection-heading { padding-bottom: 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.17); }
.collection-heading span { font-size: 1.25rem; font-weight: 750; }
.collection-heading a { color: rgba(255,255,255,.72); font-size: .78rem; }
.collection-heading a:hover { color: #fff; }
.collection-list { display: grid; }
.collection-list a { padding: 16px 0; display: grid; grid-template-columns: 34px 1fr; align-items: baseline; gap: 6px; color: inherit; border-bottom: 1px solid rgba(255,255,255,.12); }
.collection-list a:last-child { padding-bottom: 2px; border-bottom: 0; }
.collection-list a span { opacity: .55; font-size: .7rem; }
.collection-list a strong { font-size: .9rem; line-height: 1.45; }
.collection-list a:hover strong { text-decoration: underline; text-underline-offset: 3px; }

/* Interior pages */
.page-shell { padding: 64px 0 36px; }
.page-shell-narrow { width: min(100%, 920px); margin: 0 auto; }
.page-shell-prose { width: min(100%, 800px); margin: 0 auto; }
.page-header { max-width: 760px; margin-bottom: 34px; }
.page-header > p:last-child { max-width: 650px; margin: 13px 0 0; color: var(--text-secondary); }
.filter-bar { margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-badge, .cat-badge { min-height: 34px; padding: 6px 11px; display: inline-flex; align-items: center; gap: 7px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: .78rem; font-weight: 600; }
.tag-badge:hover, .cat-badge:hover, .cat-badge.active { color: var(--accent); border-color: var(--accent); }
.cat-badge.active { background: var(--accent-soft); }
.cat-badge span { color: var(--text-muted); font-size: .7rem; }
.tags-list, .cats-list { display: flex; flex-wrap: wrap; gap: 7px; }
.empty-state { margin: 28px 0; padding: 60px 24px; text-align: center; color: var(--text-secondary); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 18px 5px 18px 5px; }
.empty-state strong { display: block; color: var(--text); font-size: 1.15rem; }
.empty-state p { margin: 6px 0 0; }
.empty-inline { margin: 0; padding: 22px 0; color: var(--text-muted); }
.pagination { padding: 30px 0 0; display: flex; justify-content: center; gap: 7px; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 10px; display: grid; place-items: center; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; }
.pagination a:hover { color: var(--accent); border-color: var(--accent); }
.pagination .active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* Search */
.search-box { margin-bottom: 24px; display: flex; gap: 9px; }
.search-box input { min-width: 0; height: 52px; padding: 0 17px; flex: 1; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 13px; outline: 0; }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.search-box button { padding: 0 22px; color: #fff; background: var(--accent); border: 0; border-radius: 13px; cursor: pointer; font-weight: 700; }
.search-results-count { margin: 0 0 16px; color: var(--text-muted); font-size: .86rem; }
.search-suggestions { padding: 22px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 15px; }
.search-suggestions span { margin-right: 5px; }
.search-suggestions a { padding: 5px 10px; background: var(--accent-soft); border-radius: 999px; font-size: .82rem; font-weight: 650; }

/* Article */
.article-with-toc { padding-top: 48px; display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 42px; }
.article-without-toc { width: min(100%, 850px); margin: 0 auto; padding-top: 48px; }
.article-main-col { min-width: 0; }
.toc-sidebar { position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow-y: auto; padding: 19px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 15px 4px 15px 4px; scrollbar-width: thin; }
.toc-heading { margin-bottom: 12px; padding-bottom: 11px; display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--border); }
.toc-heading span { color: var(--text); font-weight: 750; }
.toc-heading small { color: var(--text-muted); font-size: .58rem; letter-spacing: .1em; }
.toc-sidebar ul { margin: 0; padding: 0; list-style: none; }
.toc-sidebar li { margin: 1px 0; }
.toc-sidebar a { padding: 5px 0; display: block; color: var(--text-secondary); font-size: .78rem; line-height: 1.45; }
.toc-sidebar .toc-h3 a { padding-left: 13px; color: var(--text-muted); }
.toc-sidebar a:hover { color: var(--accent); }
.toc-float-btn { display: none; }
.article-header { margin-bottom: 30px; }
.article-header h1 { max-width: 830px; margin: 4px 0 16px; font-size: clamp(2rem, 5vw, 3.35rem); line-height: 1.13; letter-spacing: -.05em; }
.article-deck { max-width: 760px; margin: 0 0 19px; color: var(--text-secondary); font-size: 1.02rem; line-height: 1.7; }
.article-header-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--text-muted); font-size: .78rem; }
.article-header-meta a { font-weight: 650; }
.article-tags { margin-top: 15px; }
.article-header-cover { margin: 0 0 34px; overflow: hidden; background: var(--surface-soft); border-radius: 22px 6px 22px 6px; }
.article-header-cover img { width: 100%; display: block; }
.article-body { color: var(--text); font-family: ui-serif, "Noto Serif SC", "Songti SC", Georgia, serif; font-size: 1.04rem; line-height: 1.86; }
.article-body > :first-child { margin-top: 0; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4 { font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; color: var(--text); line-height: 1.35; letter-spacing: -.025em; scroll-margin-top: 92px; }
.article-body h1 { margin: 2.2em 0 .8em; font-size: 1.9rem; }
.article-body h2 { margin: 2.3em 0 .9em; padding-bottom: 10px; font-size: 1.48rem; border-bottom: 1px solid var(--border); }
.article-body h2::before { content: ""; width: 26px; height: 3px; margin-right: 10px; display: inline-block; vertical-align: .28em; background: var(--accent); border-radius: 3px; }
.article-body h3 { margin: 1.9em 0 .7em; font-size: 1.2rem; }
.article-body p { margin: 0 0 1.25em; }
.article-body a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-body ul, .article-body ol { margin: 0 0 1.3em; padding-left: 1.5em; }
.article-body li { margin: .32em 0; padding-left: .18em; }
.article-body blockquote { margin: 1.55em 0; padding: 18px 21px; color: var(--text-secondary); background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body table { width: 100%; margin: 1.5em 0; border-collapse: collapse; display: block; overflow-x: auto; font-family: Inter, "Noto Sans SC", sans-serif; font-size: .88rem; }
.article-body th, .article-body td { min-width: 120px; padding: 10px 13px; text-align: left; border: 1px solid var(--border); }
.article-body th { background: var(--surface-soft); font-weight: 700; }
.article-body :not(pre) > code { padding: 2px 6px; color: var(--warm); background: var(--warm-soft); border-radius: 5px; font-family: "Cascadia Code", Consolas, monospace; font-size: .88em; }
.article-body iframe, .article-body video { max-width: 100%; border-radius: 12px; }
.article-img { margin: 1.8em 0; text-align: center; }
.article-img-button { width: 100%; padding: 0; display: block; background: none; border: 0; cursor: zoom-in; }
.article-img img { max-height: 720px; margin: 0 auto; display: block; border-radius: 15px 4px 15px 4px; }
.article-img figcaption { margin-top: 8px; color: var(--text-muted); font-family: Inter, sans-serif; font-size: .78rem; }
.code-block { margin: 1.55em 0; overflow: hidden; color: var(--code-text); background: var(--code-bg); border: 1px solid var(--border-strong); border-radius: 14px 4px 14px 4px; font-family: "Cascadia Code", "Fira Code", Consolas, monospace; }
.code-header { height: 42px; padding: 0 13px 0 16px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.045); border-bottom: 1px solid rgba(255,255,255,.1); font-family: Inter, sans-serif; }
.code-lang { color: #a8d9c3; font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.code-copy { padding: 4px 9px; color: rgba(255,255,255,.72); background: transparent; border: 1px solid rgba(255,255,255,.18); border-radius: 7px; cursor: pointer; font-size: .68rem; }
.code-copy:hover, .code-copy.copied { color: #fff; border-color: rgba(255,255,255,.5); }
.code-block pre { margin: 0; padding: 18px; overflow-x: auto; background: transparent !important; font-size: .84rem; line-height: 1.68; }
.code-block code { font-family: inherit; }
.reading-progress { position: fixed; z-index: 200; top: 0; left: 0; width: 100%; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left center; will-change: transform; }

/* Article footer and discussion */
.article-footer, .comments-section { margin-top: 42px; padding-top: 30px; border-top: 1px solid var(--border); }
.subsection-heading { margin-bottom: 18px; }
.subsection-heading p { margin: 0 0 4px; color: var(--accent); font-size: .64rem; font-weight: 800; letter-spacing: .15em; }
.subsection-heading h2 { margin: 0; font-size: 1.45rem; letter-spacing: -.03em; }
.article-actions { display: flex; }
.like-btn { min-height: 43px; padding: 9px 16px; display: inline-flex; align-items: center; gap: 8px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.like-btn:hover, .like-btn.liked { color: var(--danger); border-color: var(--danger); }
.like-btn:disabled { cursor: default; }
.like-count { min-width: 24px; padding: 1px 6px; background: var(--surface-soft); border-radius: 999px; font-size: .75rem; }
.prev-next { margin: 28px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prev-next-card { padding: 17px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 13px 4px 13px 4px; }
.prev-next-card:hover { color: var(--accent); border-color: var(--accent); }
.prev-next-card-next { text-align: right; }
.prev-next-label { margin-bottom: 4px; color: var(--text-muted); font-size: .7rem; }
.prev-next-title { font-weight: 700; font-size: .86rem; line-height: 1.45; }
.related-section { margin-top: 34px; }
.related-list { border-top: 1px solid var(--border); }
.related-list a { padding: 14px 0; display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: baseline; color: var(--text); border-bottom: 1px solid var(--border); }
.related-list a > span { color: var(--text-muted); font-size: .7rem; }
.related-list a strong { font-size: .88rem; }
.related-list a time { color: var(--text-muted); font-size: .7rem; }
.related-list a:hover strong { color: var(--accent); }
.comments-section { margin-bottom: 16px; }
.comment-form { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px 5px 16px 5px; }
.comment-form label { display: grid; gap: 6px; color: var(--text-secondary); font-size: .78rem; font-weight: 650; }
.comment-form label small { color: var(--text-muted); font-weight: 400; }
.comment-identity { margin-bottom: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comment-form input, .comment-form textarea { width: 100%; padding: 10px 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 9px; outline: 0; }
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.comment-form textarea { min-height: 130px; resize: vertical; }
.comment-submit-row { margin-top: 12px; display: flex; align-items: center; gap: 13px; }
.comment-submit-row button { min-height: 42px; padding: 0 17px; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; }
.comment-submit-row button:disabled { opacity: .65; }
.comment-submit-row p { margin: 0; color: var(--text-muted); font-size: .74rem; }
.form-status { min-height: 1.4em; margin: 10px 0 0; font-size: .8rem; }
.form-status.success { color: var(--success); }
.form-status.error { color: var(--danger); }
.comment-list { margin-top: 16px; display: grid; gap: 10px; }
.comment-item { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.comment-meta { margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; }
.comment-author { font-weight: 750; }
.comment-date { color: var(--text-muted); font-size: .72rem; }
.comment-body { color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.github-badge { padding: 2px 6px; color: var(--accent); background: var(--accent-soft); border-radius: 5px; font-size: .65rem; }

/* Resources and gallery */
.download-list { display: grid; gap: 10px; }
.download-card { padding: 17px; display: flex; align-items: center; gap: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px 4px 14px 4px; }
.download-filetype { width: 48px; height: 48px; display: grid; flex: 0 0 auto; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 12px 3px 12px 3px; font-size: .58rem; font-weight: 850; letter-spacing: .08em; }
.download-info { min-width: 0; flex: 1; }
.download-name { color: var(--text); font-weight: 750; overflow-wrap: anywhere; }
.download-description { margin: 3px 0 5px; color: var(--text-secondary); font-size: .84rem; }
.download-meta { color: var(--text-muted); font-size: .72rem; }
.download-btn { padding: 8px 13px; flex: 0 0 auto; color: #fff; background: var(--accent); border-radius: 9px; font-size: .8rem; font-weight: 700; }
.download-btn:hover { color: #fff; background: var(--accent-hover); }
.gallery-grid { columns: 3 260px; column-gap: 15px; }
.gallery-item { width: 100%; margin: 0 0 15px; padding: 0; display: inline-block; overflow: hidden; text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 15px 4px 15px 4px; cursor: zoom-in; break-inside: avoid; }
.gallery-item img { width: 100%; display: block; }
.gallery-item span { padding: 11px 13px; display: block; color: var(--text-secondary); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Content and utility pages */
.standalone-prose { padding: 25px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px 5px 18px 5px; }
.contact-strip { margin-top: 18px; padding: 17px 20px; display: flex; justify-content: space-between; gap: 16px; color: var(--text-secondary); background: var(--accent-soft); border-radius: 12px; }
.contact-strip a { font-weight: 700; }
.contact-card { padding: clamp(24px, 5vw, 42px); background: #173f31; color: #f5f5ef; border-radius: 22px 6px 22px 6px; }
.contact-card div { display: grid; gap: 8px; }
.contact-card span { color: #a9dbc5; font-size: .65rem; font-weight: 800; letter-spacing: .15em; }
.contact-card a { color: #fff; font-size: clamp(1.25rem, 4vw, 2.2rem); font-weight: 750; overflow-wrap: anywhere; }
.contact-card p { margin: 30px 0 0; padding-top: 18px; color: rgba(255,255,255,.7); border-top: 1px solid rgba(255,255,255,.16); }
.error-page { min-height: 60vh; padding: 80px 20px; display: flex; align-items: center; flex-direction: column; justify-content: center; text-align: center; }
.error-page h1 { margin: 0; color: var(--text); font-size: clamp(5rem, 18vw, 10rem); line-height: .85; letter-spacing: -.08em; }
.error-page > p:not(.section-kicker) { color: var(--text-secondary); }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.login-page { min-height: calc(100vh - 200px); padding: 64px 0; display: grid; place-items: center; }
.login-card { width: min(100%, 440px); padding: clamp(25px, 5vw, 38px); background: var(--surface); border: 1px solid var(--border); border-radius: 22px 6px 22px 6px; box-shadow: var(--shadow-small); }
.login-intro { margin-bottom: 25px; }
.login-intro h1 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.login-intro p { margin: 6px 0 0; color: var(--text-secondary); }
.login-form { display: grid; gap: 8px; }
.login-form label { margin-top: 7px; color: var(--text-secondary); font-size: .78rem; font-weight: 700; }
.login-form input { height: 46px; padding: 0 12px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; outline: 0; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.login-form .btn { margin-top: 13px; }
.form-alert { margin-bottom: 12px; padding: 10px 12px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); border-radius: 9px; font-size: .84rem; }
.login-back { margin-top: 18px; display: inline-block; color: var(--text-muted); font-size: .8rem; }

/* Footer and floating UI */
.footer { margin-top: 58px; border-top: 1px solid var(--border); }
.footer-container { width: min(100%, 1200px); min-height: 150px; margin: 0 auto; padding: 34px 28px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px 50px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand strong { display: block; }
.footer-brand p { margin: 1px 0 0; color: var(--text-muted); font-size: .78rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: var(--text-secondary); font-size: .82rem; }
.footer-links a:hover { color: var(--accent); }
.copyright { grid-column: 1 / -1; margin: 0; padding-top: 15px; color: var(--text-muted); border-top: 1px solid var(--border); font-size: .7rem; }
.back-to-top { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 90; width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--accent); border: 0; border-radius: 12px 3px 12px 3px; box-shadow: var(--shadow-small); opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .2s, transform .2s, visibility .2s; cursor: pointer; }
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.toast { position: fixed; z-index: 1200; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 10px 15px; color: #fff; background: #17231e; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translate(-50%, 12px); transition: .2s; font-size: .82rem; }
.toast.visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.zoom-overlay { position: fixed; z-index: 1500; inset: 0; padding: 50px; display: grid; place-items: center; background: rgba(4,10,7,.92); backdrop-filter: blur(10px); cursor: zoom-out; }
.zoom-overlay > img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }
.zoom-close { position: absolute; top: 18px; right: 22px; width: 42px; height: 42px; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 50%; cursor: pointer; font-size: 1.5rem; }

/* Responsive */
@media (max-width: 980px) {
  .nav-container { gap: 10px; }
  .nav-menu a { padding-inline: 8px; }
  .hero { grid-template-columns: minmax(0, 1fr) 250px; gap: 30px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-with-toc { grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 860px) {
  .container, .nav-container, .footer-container { padding-left: 18px; padding-right: 18px; }
  .nav-container { height: 64px; }
  .nav-toggle { display: flex; }
  .nav-actions { order: 4; }
  .nav-menu { position: fixed; top: 64px; right: 0; left: 0; max-height: calc(100vh - 64px); padding: 12px 18px 20px; display: grid; gap: 2px; overflow-y: auto; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-small); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .18s, visibility .18s, transform .18s; }
  .nav-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav-menu a { padding: 12px 10px; font-size: .95rem; }
  .nav-menu a::after { display: none; }
  .hero { min-height: 0; margin-top: 18px; padding: 36px 28px; grid-template-columns: 1fr; }
  .hero-focus { display: none; }
  .collection-grid { grid-template-columns: 1fr; }
  .article-with-toc, .article-without-toc { padding-top: 34px; display: block; width: 100%; }
  .toc-sidebar { position: fixed; z-index: 300; right: 16px; bottom: 78px; left: 16px; top: auto; max-height: 60vh; display: block; opacity: 0; visibility: hidden; transform: translateY(12px); transition: .18s; box-shadow: var(--shadow); }
  .toc-sidebar.mobile-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .toc-float-btn { position: fixed; z-index: 290; right: 18px; bottom: 22px; min-width: 48px; height: 44px; padding: 0 13px; display: block; color: #fff; background: var(--accent); border: 0; border-radius: 12px 3px 12px 3px; box-shadow: var(--shadow-small); font-size: .75rem; font-weight: 750; }
  .back-to-top { right: 74px; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .nav-logo-text { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
  .nav-icon-btn { width: 36px; height: 36px; }
  .hero { padding: 31px 22px; border-radius: 20px 5px 20px 5px; }
  .hero-title { font-size: clamp(2.35rem, 14vw, 3.55rem); }
  .hero-cats { display: none; }
  .section { padding: 30px 0; }
  .section-header { align-items: flex-start; }
  .section-note { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .card-placeholder { min-height: 125px; }
  .card-body { min-height: 0; }
  .article-row { padding: 17px 50px 17px 17px; gap: 13px; }
  .article-row-cover { width: 100px; min-height: 88px; }
  .article-row-excerpt { -webkit-line-clamp: 2; }
  .page-shell { padding-top: 42px; }
  .page-header { margin-bottom: 25px; }
  .article-header h1 { font-size: 2.1rem; }
  .article-body { font-size: 1rem; line-height: 1.78; }
  .article-body h2::before { width: 18px; }
  .prev-next { grid-template-columns: 1fr; }
  .prev-next-card-next { text-align: left; }
  .related-list a { grid-template-columns: 28px 1fr; }
  .related-list a time { display: none; }
  .comment-identity { grid-template-columns: 1fr; }
  .comment-submit-row { align-items: flex-start; flex-direction: column; }
  .download-card { align-items: flex-start; flex-wrap: wrap; }
  .download-info { flex-basis: calc(100% - 64px); }
  .download-btn { margin-left: 63px; }
  .search-box { flex-direction: column; }
  .search-box button { height: 46px; }
  .contact-strip { align-items: flex-start; flex-direction: column; }
  .footer-container { grid-template-columns: 1fr; }
  .copyright { grid-column: 1; }
  .zoom-overlay { padding: 50px 14px 14px; }
}

@media (max-width: 430px) {
  .nav-logo-mark { display: none; }
  .article-row-cover { display: none; }
  .article-row-arrow { right: 13px; }
  .article-row { padding-right: 48px; }
}

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