/* The site theme: one stylesheet for the home, post, category and core pages (deliver/render.py).
   Colours, type and spacing are tokens; no reader-visible word lives here (theme/labels/ has them). */
:root {
  /* palette roles */
  --accent: #147D78;
  --accent-soft: #D7EBE7;
  --ink: #1F2D36;
  --muted: #4A5A62;
  --panel: #EEF4F1;
  --base-light: #F3E5CE;
  --bg: #FFFFFF;
  --line: color-mix(in srgb, var(--ink) 11%, var(--bg));
  --line-strong: color-mix(in srgb, var(--ink) 20%, var(--bg));
  --faint: color-mix(in srgb, var(--muted) 72%, var(--bg));

  /* type scale 14/16/18/20/24/30/36 (+48 display for the home hero only) */
  --font: 'Noto Sans TC', 'Noto Sans', system-ui, sans-serif;
  --fs-14: .875rem; --fs-16: 1rem; --fs-18: 1.125rem; --fs-20: 1.25rem;
  --fs-24: 1.5rem; --fs-30: 1.875rem; --fs-36: 2.25rem; --fs-display: 3rem;
  --lh-body: 1.8; --lh-head: 1.4;

  /* spacing 4/8/12/16/24/32/48/64 */
  --s-4: 4px; --s-8: 8px; --s-12: 12px; --s-16: 16px; --s-24: 24px; --s-32: 32px; --s-48: 48px; --s-64: 64px;
  --r-4: 4px; --r-8: 8px; --r-12: 12px;

  --content: 680px;       /* contentSize */
  --wide: 1200px;         /* wideSize */
  --page: 1360px;         /* three-column article shell */
  --gutter: 32px;
  --header-h: 72px;
  --shadow-hover: 0 6px 20px color-mix(in srgb, var(--ink) 10%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + var(--s-24)); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-16); line-height: 1.7;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: var(--lh-head); margin: 0; font-weight: 800; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-4); }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.tpl-post .header-inner, .tpl-post .footer-grid, .tpl-post .footer-bottom { width: min(100% - 2 * var(--gutter), var(--page)); }
.wrap-narrow { width: min(100% - 2 * var(--gutter), var(--content)); margin-inline: auto; }

/* ---------- shared bits ---------- */
.text-link { color: var(--accent); font-weight: 700; font-size: var(--fs-16); display: inline-flex; gap: var(--s-8); align-items: center; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-link--arrow::after { content: ""; width: 7px; height: 7px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.text-link--arrow:hover::after { transform: translateX(3px) rotate(45deg); }
.badge { display: inline-block; background: var(--accent); color: #fff; font-size: var(--fs-14); font-weight: 700; line-height: 1; padding: 6px 10px; border-radius: var(--r-4); letter-spacing: .02em; }
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 var(--s-24); border-radius: var(--r-8); font-weight: 700; font-size: var(--fs-16); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-8); }
.chip { display: inline-flex; align-items: center; gap: var(--s-8); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--fs-14); color: var(--muted); background: var(--bg); line-height: 1.4; transition: border-color .15s, color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 700; }
.chip-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chip.is-active .chip-count { color: var(--accent); }
.avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--panel); color: var(--accent); font-weight: 800; font-size: var(--fs-18); border: 1px solid var(--line); }
.tree-thumb { display: block; }
.avatar--mark svg { width: 70%; height: 70%; }

.crumbs ol { display: flex; flex-wrap: wrap; gap: var(--s-4) 0; font-size: var(--fs-14); color: var(--muted); }
.crumbs li:not(:last-child)::after { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 10px 2px 8px; border-top: 1.5px solid var(--faint); border-right: 1.5px solid var(--faint); transform: rotate(45deg); }
.crumbs a:hover { color: var(--accent); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: var(--s-32); }
.brand { flex: none; display: block; }
.brand .logo { height: 40px; width: auto; }
.site-nav { margin-left: auto; min-width: 0; }
.site-nav ul { display: flex; gap: var(--s-4); }
.site-nav a { display: block; padding: var(--s-8) var(--s-12); border-radius: var(--r-8); font-size: var(--fs-16); font-weight: 500; color: var(--muted); white-space: nowrap; max-width: 15em; overflow: hidden; text-overflow: ellipsis; }
.site-nav a:hover { color: var(--ink); background: var(--panel); }
.site-nav a[aria-current] { color: var(--accent); font-weight: 700; }
.nav-toggle { display: none; margin-left: auto; align-items: center; gap: var(--s-8); background: none; border: 1px solid var(--line); border-radius: var(--r-8); padding: var(--s-8) var(--s-12); font-size: var(--fs-14); font-weight: 700; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; transition: transform .2s, background .2s; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; } .nav-toggle-bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-5px) rotate(-45deg); }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--s-64); border-top: 1px solid var(--line); background: var(--bg); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-48); padding: var(--s-64) 0 var(--s-48); }
.footer-brand .logo { height: 36px; width: auto; }
.footer-brand p { margin-top: var(--s-16); color: var(--muted); font-size: var(--fs-14); line-height: 1.8; max-width: 30em; }
.footer-title { font-size: var(--fs-14); font-weight: 700; color: var(--ink); margin-bottom: var(--s-12); }
.footer-title-gap { margin-top: var(--s-24); }
.footer-col li + li { margin-top: var(--s-8); }
.footer-col a { font-size: var(--fs-14); color: var(--muted); }
.footer-col a:hover { color: var(--accent); }
.footer-mail { font-size: var(--fs-14); color: var(--accent) !important; word-break: break-all; }
.footer-bottom { display: flex; justify-content: space-between; gap: var(--s-16); padding: var(--s-24) 0; border-top: 1px solid var(--line); font-size: var(--fs-14); color: var(--faint); }
.footer-bottom a:hover { color: var(--accent); }

/* ---------- cards ---------- */
.card { display: flex; flex-direction: column; gap: var(--s-16); min-width: 0; }
.card-media { display: block; aspect-ratio: 16 / 9; border-radius: var(--r-12); overflow: hidden; background: var(--panel); border: 1px solid var(--line); transition: box-shadow .2s; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .card-media { box-shadow: var(--shadow-hover); }
.card:hover .card-media img { transform: scale(1.03); }
.card-body { display: flex; flex-direction: column; gap: var(--s-8); min-width: 0; }
.card-cat { font-size: var(--fs-14); font-weight: 700; color: var(--accent); width: fit-content; }
.card-cat:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-title { font-size: var(--fs-20); font-weight: 700; line-height: var(--lh-head); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { font-size: var(--fs-16); color: var(--muted); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; gap: var(--s-8); font-size: var(--fs-14); color: var(--faint); }

.card-grid--grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-48) var(--s-32); }
.card-grid--list { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: var(--s-32) var(--s-48); }
.card-grid--list .card { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--s-24); align-items: center; }
.card-grid--list .card:only-child { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-48); }
.card-grid--list .card-title { font-size: var(--fs-20); }
.card-grid--list .card:only-child .card-title { font-size: var(--fs-24); }
.card-grid--list .card-excerpt { -webkit-line-clamp: 3; }

/* ---------- sections ---------- */
.section { padding: var(--s-64) 0 0; }
.section--tight { padding-top: var(--s-48); }
.section-head { margin-bottom: var(--s-32); }
.section-head--split { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-24); padding-bottom: var(--s-16); border-bottom: 1px solid var(--line); }
.section-kicker { font-size: var(--fs-14); font-weight: 700; color: var(--faint); margin-bottom: var(--s-4); }
.section-title { font-size: var(--fs-30); }
.section-title a:hover { color: var(--accent); }
.section-title--sm { font-size: var(--fs-20); }

/* ---------- home ---------- */
.hero { padding: var(--s-64) 0 var(--s-48); background:
  radial-gradient(60% 120% at 100% 0%, color-mix(in srgb, var(--base-light) 55%, transparent) 0, transparent 70%),
  linear-gradient(180deg, var(--panel) 0, var(--bg) 100%); }
.hero-inner { max-width: var(--wide); }
.hero-title { font-size: var(--fs-display); letter-spacing: -.01em; line-height: 1.2; }
.hero-desc { margin-top: var(--s-16); font-size: var(--fs-20); line-height: 1.75; color: var(--ink); max-width: 36em; }
.hero-audience { margin-top: var(--s-12); font-size: var(--fs-16); color: var(--muted); max-width: 40em; padding-left: var(--s-12); border-left: 3px solid var(--accent-soft); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-24) var(--s-32); margin-top: var(--s-32); }
.hero-stats { display: flex; gap: var(--s-24); color: var(--muted); font-size: var(--fs-14); }
.hero-stats b { font-size: var(--fs-24); color: var(--ink); font-weight: 800; margin-right: 2px; font-variant-numeric: tabular-nums; }

.featured { margin-top: calc(-1 * var(--s-16)); }
.feature { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s-48); align-items: center; padding: var(--s-24); border: 1px solid var(--line); border-radius: var(--r-12); background: var(--bg); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent); }
.feature-media { display: block; aspect-ratio: 16 / 9; border-radius: var(--r-8); overflow: hidden; background: var(--panel); }
.feature-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.feature:hover .feature-media img { transform: scale(1.02); }
.feature-body { display: flex; flex-direction: column; gap: var(--s-16); padding-right: var(--s-24); }
.feature-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-12); }
.feature-title { font-size: var(--fs-30); line-height: 1.35; }
.feature-title a:hover { color: var(--accent); }
.feature-excerpt { font-size: var(--fs-18); color: var(--muted); line-height: 1.75; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s-32); }
.topic-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-12); overflow: hidden; background: var(--bg); transition: box-shadow .2s, border-color .2s; }
.topic-card:hover { box-shadow: var(--shadow-hover); border-color: var(--line-strong); }
.topic-media { display: block; aspect-ratio: 16 / 9; background: var(--panel); overflow: hidden; }
.topic-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.topic-card:hover .topic-media img { transform: scale(1.03); }
.topic-body { display: flex; flex-direction: column; gap: var(--s-8); padding: var(--s-24); flex: 1; }
.topic-count { font-size: var(--fs-14); color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums; }
.topic-name { font-size: var(--fs-20); }
.topic-name a:hover { color: var(--accent); }
.topic-desc { color: var(--muted); font-size: var(--fs-16); line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.topic-body .chips { margin-top: auto; padding-top: var(--s-12); }

.author-band { margin-top: var(--s-64); padding: var(--s-48) 0; background: var(--panel); }
.author-band-inner { display: grid; gap: var(--s-32); }
.author-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-24); align-items: start; max-width: 52em; }
.author-card .avatar { width: 72px; height: 72px; background: var(--bg); font-size: var(--fs-24); }
.author-card-name { font-size: var(--fs-24); font-weight: 800; margin-top: var(--s-4); }
.author-card-name a:hover { color: var(--accent); }
.author-card-bio { margin: var(--s-12) 0 var(--s-16); color: var(--muted); line-height: 1.8; }

/* ---------- post ---------- */
.post-layout { width: min(100% - 2 * var(--gutter), var(--page)); display: grid; grid-template-columns: 220px minmax(0, var(--content)) 280px; justify-content: space-between; gap: var(--s-48); padding-top: var(--s-32); }
.post { min-width: 0; }
.rail { position: sticky; top: calc(var(--header-h) + var(--s-32)); max-height: calc(100vh - var(--header-h) - var(--s-64)); overflow: auto; overscroll-behavior: contain; padding-right: var(--s-4); scrollbar-width: thin; }
.rail-title { font-size: var(--fs-14); font-weight: 700; color: var(--ink); margin-bottom: var(--s-12); }

.toc-list { border-left: 1px solid var(--line); }
.toc-item a { display: block; margin-left: -1px; padding: 6px 0 6px var(--s-12); border-left: 2px solid transparent; font-size: var(--fs-14); line-height: 1.5; color: var(--muted); }
.toc-item--sub a { padding-left: var(--s-24); font-size: 13px; color: var(--faint); }
.toc-item a:hover { color: var(--ink); }
.toc-item a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }

.post-head { margin-top: var(--s-24); }
.post-title { font-size: var(--fs-36); line-height: 1.35; letter-spacing: -.005em; }
.byline { display: flex; align-items: center; gap: var(--s-12); margin-top: var(--s-24); }
.byline-text { display: flex; flex-direction: column; min-width: 0; }
.byline-name { font-weight: 700; font-size: var(--fs-16); }
.byline-name:hover { color: var(--accent); }
.byline-meta { display: flex; flex-wrap: wrap; gap: 0 var(--s-8); font-size: var(--fs-14); color: var(--faint); }
.byline-meta a { color: var(--accent); }
.post-cover { margin: var(--s-32) 0 0; aspect-ratio: 16 / 9; border-radius: var(--r-12); overflow: hidden; background: var(--panel); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }

.toc-inline, .tree-end { display: none; margin-top: var(--s-24); border: 1px solid var(--line); border-radius: var(--r-8); }
.toc-inline > summary, .tree-end > summary { list-style: none; cursor: pointer; padding: var(--s-12) var(--s-16); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.toc-inline > summary::-webkit-details-marker, .tree-end > summary::-webkit-details-marker { display: none; }
.toc-inline > summary::after, .tree-end > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.toc-inline[open] > summary::after, .tree-end[open] > summary::after { transform: rotate(-135deg); }
.toc-inline .toc-list { margin: 0 var(--s-16) var(--s-16); }
.tree-end .tree { padding: 0 var(--s-16) var(--s-16); }
.tree-end .rail-title { display: none; }

/* article body: WordPress block markup (wp-block-image / wp-block-table) */
.entry-content { margin-top: var(--s-32); font-size: var(--fs-18); line-height: var(--lh-body); overflow-wrap: anywhere; }
.entry-content > * + * { margin-top: 1em; }
.entry-content h2 { font-size: var(--fs-30); margin-top: 2.2em; padding-top: 1.1em; border-top: 1px solid var(--line); }
.entry-content h3 { font-size: var(--fs-20); margin-top: 1.8em; }
.entry-content > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.entry-content h2 + p, .entry-content h3 + p { margin-top: .6em; }
.entry-content a {
  color: var(--accent); font-weight: 700; text-decoration: none;
  background: linear-gradient(var(--accent-soft), var(--accent-soft)) 0 100% / 100% .45em no-repeat;
  transition: background-size .15s;
}
.entry-content a:hover { background-size: 100% 100%; }
.entry-content strong { font-weight: 700; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content ul { list-style: disc; } .entry-content ol { list-style: decimal; }
.entry-content li + li { margin-top: .4em; }
.entry-content li::marker { color: var(--accent); }
.entry-content blockquote { margin-left: 0; padding: var(--s-16) var(--s-24); border-left: 3px solid var(--accent); background: var(--panel); border-radius: 0 var(--r-8) var(--r-8) 0; color: var(--muted); }
.entry-content figure { margin: 2em 0; }
.wp-block-image img { width: 100%; height: auto; border-radius: var(--r-12); border: 1px solid var(--line); }
.wp-block-image figcaption { margin-top: var(--s-8); font-size: var(--fs-14); color: var(--faint); text-align: center; }
.wp-block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line-strong); border-radius: var(--r-12); max-width: none; box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent); }
.wp-block-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: var(--fs-16); line-height: 1.6; }
.wp-block-table th, .wp-block-table td { padding: var(--s-12) var(--s-16); text-align: left; vertical-align: top; }
.wp-block-table th + th, .wp-block-table td + td { border-left: 1px solid var(--line); }
.wp-block-table thead th { background: var(--accent-soft); font-size: var(--fs-14); font-weight: 700; color: var(--ink); white-space: nowrap; border-bottom: 2px solid var(--accent); }
.wp-block-table tbody tr + tr td { border-top: 1px solid var(--line); }
.wp-block-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); }
.wp-block-table tbody td { color: var(--muted); }
.wp-block-table tbody td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }
.entry-content--page h2 { font-size: var(--fs-24); border-top: 0; padding-top: 0; margin-top: 1.8em; }

/* Head-Term Links: horizontal scroller */
.related { margin-top: var(--s-64); padding-top: var(--s-32); border-top: 1px solid var(--line-strong); }
.related-head { display: flex; align-items: center; gap: var(--s-12); margin-bottom: var(--s-24); }
.related-title { font-size: var(--fs-24); }
.related-hint { font-size: var(--fs-14); color: var(--faint); display: inline-flex; align-items: center; gap: var(--s-8); }
.related-hint::after { content: ""; width: 18px; height: 1px; background: currentColor; box-shadow: 4px 0 0 0 transparent; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(5px); } }
.related-nav { margin-left: auto; display: flex; gap: var(--s-8); }
.scroll-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; display: grid; place-items: center; font-size: var(--fs-24); line-height: 1; color: var(--ink); transition: border-color .15s, color .15s, opacity .15s; }
.scroll-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.scroll-btn:disabled { opacity: .35; cursor: default; }
.scroller { position: relative; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding-bottom: var(--s-16); cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent); }
.scroller.is-end { -webkit-mask-image: none; mask-image: none; }
.scroller.is-dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
.scroller.is-dragging a { pointer-events: none; }
.scroller-track { display: grid; grid-auto-flow: column; grid-auto-columns: 260px; gap: var(--s-24); }
.scroller-item { scroll-snap-align: start; }
.scroller .card { gap: var(--s-12); }
.scroller .card-title { font-size: var(--fs-16); -webkit-line-clamp: 3; }
.scroller .card-excerpt, .scroller .card-meta { display: none; }
.scroller img { -webkit-user-drag: none; user-select: none; }

.author-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-16); margin-top: var(--s-48); padding: var(--s-24) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.author-box-label { font-size: var(--fs-14); color: var(--faint); font-weight: 700; }
.author-box-name { font-size: var(--fs-18); font-weight: 800; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s-12); }
.author-box-name a:hover { color: var(--accent); }
.author-box-bio { margin: var(--s-8) 0 var(--s-12); color: var(--muted); font-size: var(--fs-16); line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* category tree: quieter than the TOC */
.tree { font-size: var(--fs-14); }
.tree summary { list-style: none; cursor: pointer; display: grid; align-items: center; gap: var(--s-8); border-radius: var(--r-8); }
.tree summary::-webkit-details-marker { display: none; }
.tree summary:hover { background: var(--panel); }
.tree-parent + .tree-parent { margin-top: var(--s-4); }
.tree-parent > details > summary { grid-template-columns: 40px minmax(0, 1fr) auto; padding: var(--s-8); font-weight: 700; color: var(--ink); }
.tree-parent > details > summary img, .tree-parent > details > summary .tree-thumb { width: 40px; height: 40px; border-radius: var(--r-8); object-fit: cover; background: var(--panel); }
.tree-name { line-height: 1.45; min-width: 0; }
.tree-count { font-size: 12px; color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }
.tree-children { margin: var(--s-4) 0 var(--s-8) 28px; padding-left: var(--s-12); border-left: 1px solid var(--line); }
.tree-children summary { grid-template-columns: minmax(0, 1fr) auto; padding: 6px var(--s-8); color: var(--muted); font-weight: 500; }
.tree-children details[open] > summary { color: var(--ink); font-weight: 700; }
.tree-posts { margin: 2px 0 var(--s-8); }
.tree-posts a { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s-8); align-items: center; padding: 6px var(--s-8); border-radius: var(--r-8); color: var(--muted); line-height: 1.45; }
.tree-posts a span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
.tree-posts img, .tree-posts .tree-thumb { width: 48px; aspect-ratio: 16 / 9; border-radius: var(--r-4); object-fit: cover; background: var(--panel); }
.tree-posts a:hover { background: var(--panel); color: var(--ink); }
.tree-posts a.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tree-more a { display: block; grid-template-columns: none; padding: 4px var(--s-8); font-size: 13px; color: var(--accent); font-weight: 500; }
.rail--quiet .rail-title { color: var(--faint); }

/* ---------- category ---------- */
.cat-hero { padding: var(--s-32) 0 var(--s-48); background: linear-gradient(180deg, var(--panel) 0, var(--bg) 100%); border-bottom: 1px solid var(--line); }
.cat-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-48); align-items: center; margin-top: var(--s-24); }
.cat-title { font-size: var(--fs-36); }
.cat-desc { margin-top: var(--s-16); font-size: var(--fs-18); color: var(--muted); line-height: 1.8; max-width: 36em; }
.cat-count { margin-top: var(--s-16); font-size: var(--fs-14); font-weight: 700; color: var(--faint); }
.cat-mosaic { position: relative; width: 400px; height: 240px; }
.cat-mosaic img { position: absolute; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-12); border: 4px solid var(--bg); box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 12%, transparent); background: var(--panel); }
.cat-mosaic img:nth-child(1) { width: 78%; right: 0; top: 0; z-index: 2; }
.cat-mosaic img:nth-child(2) { width: 52%; left: 0; bottom: 0; z-index: 3; }
.chips--lg { margin-top: var(--s-32); }
.chips--lg .chip { font-size: var(--fs-16); padding: var(--s-8) var(--s-16); }
.subcat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-16); }
.subcat { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s-16); align-items: center; padding: var(--s-12); border: 1px solid var(--line); border-radius: var(--r-12); transition: border-color .15s, box-shadow .15s; }
.subcat:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); }
.subcat img, .subcat .tree-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-8); background: var(--panel); }
.subcat-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.subcat-name { font-weight: 700; line-height: 1.45; }
.subcat-count { font-size: var(--fs-14); color: var(--faint); }

/* ---------- page ---------- */
.page { padding-top: var(--s-32); }
.page-head { margin: var(--s-32) 0 0; padding-bottom: var(--s-24); border-bottom: 1px solid var(--line); }
.page-title { font-size: var(--fs-36); }
.profile-head { display: flex; align-items: center; gap: var(--s-24); margin-top: var(--s-32); }
.profile-head .avatar { width: 88px; height: 88px; font-size: var(--fs-30); }
.profile-bio { margin-top: var(--s-24); padding: var(--s-24); background: var(--panel); border-radius: var(--r-12); color: var(--ink); line-height: 1.8; font-size: var(--fs-18); }

/* the menu folds behind the toggle when its items do not fit on one line, or below 1024 (theme.js sets .nav-compact) */
.nav-compact .header-inner { gap: var(--s-16); }
.nav-compact .nav-toggle { display: inline-flex; }
.nav-compact .site-nav { position: absolute; left: 0; right: 0; top: 100%; margin: 0; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px color-mix(in srgb, var(--ink) 8%, transparent); display: none; }
.nav-compact .site-nav.is-open { display: block; }
.nav-compact .site-nav ul { flex-direction: column; gap: 0; width: min(100% - 2 * var(--gutter), var(--wide)); margin: 0 auto; padding: var(--s-8) 0 var(--s-16); }
.nav-compact .site-nav a { white-space: normal; max-width: none; padding: var(--s-12) 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.nav-compact .site-nav li:last-child a { border-bottom: 0; }
.nav-compact .site-nav a:hover { background: none; }
/* ---------- responsive ---------- */
/* 1024–1279: TOC stays as the left rail; the category tree moves to the end */
@media (max-width: 1279px) {
  .post-layout { grid-template-columns: 200px minmax(0, var(--content)); justify-content: center; }
  .post-tree { display: none; }
  .tree-end { display: block; }
}
/* < 1024: one column; TOC under the cover, collapsible, not sticky */
@media (max-width: 1023px) {
  .post-layout { grid-template-columns: minmax(0, var(--content)); }
  .post-toc { display: none; }
  .toc-inline { display: block; }
  .card-grid--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid--list { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: var(--s-24); }
  .feature-body { padding: 0 var(--s-8) var(--s-8); }
  .cat-head { grid-template-columns: 1fr; }
  .cat-mosaic { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 639px) {
  :root { --gutter: 20px; --header-h: 60px; }
  .brand .logo { height: 32px; }
  .nav-toggle-text { display: none; }
  .hero { padding: var(--s-48) 0 var(--s-32); }
  .hero-title { font-size: var(--fs-36); }
  .hero-desc { font-size: var(--fs-18); }
  .featured { margin-top: 0; }
  .feature { padding: var(--s-12); }
  .feature-title { font-size: var(--fs-24); }
  .feature-excerpt { font-size: var(--fs-16); }
  .section { padding-top: var(--s-48); }
  .section-title { font-size: var(--fs-24); }
  .card-grid--grid, .card-grid--list { grid-template-columns: 1fr; gap: var(--s-32); }
  .card-grid--list .card, .card-grid--list .card:only-child { grid-template-columns: 1fr; gap: var(--s-16); }
  .card-grid--list .card-title { font-size: var(--fs-20); }
  .topic-grid { grid-template-columns: 1fr; gap: var(--s-24); }
  .section-head--split .text-link { white-space: nowrap; }
  .section--topic .card-grid .card, .section--topic .card-grid .card:only-child { grid-template-columns: 120px minmax(0, 1fr); gap: var(--s-16); align-items: start; display: grid; }
  .section--topic .card-grid { gap: var(--s-24); }
  .section--topic .card-grid .card .card-title { font-size: var(--fs-16); }
  .section--topic .card-meta span { display: none; }
  .section--topic .card-excerpt { display: none; }
  .section--topic .card-body { gap: var(--s-4); }
  .post-title { font-size: var(--fs-30); }
  .entry-content { font-size: 17px; }
  .entry-content h2 { font-size: var(--fs-24); }
  .entry-content h3 { font-size: var(--fs-18); }
  .post-cover { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; }
  .related-nav { display: none; }
  .scroller { margin-right: calc(-1 * var(--gutter)); }
  .scroller-track { grid-auto-columns: 72%; padding-right: var(--gutter); gap: var(--s-16); }
  .cat-title, .page-title { font-size: var(--fs-30); }
  .author-card { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-32); padding-top: var(--s-48); }
  .footer-bottom { flex-direction: column; }
  .subcat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
