/* ==========================================================================
   Strata — structural stylesheet.
   Reads ONLY neutral --s-* tokens supplied by brand-<theme>.css, which maps
   them onto the brand token file (jchimp-theme.css / championops-theme.css).
   Base element opinions (body, headings, links, code, tables, blockquote,
   buttons) come from the brand theme; this file adds layout and components.
   Grammar per BRAND.md: hairline separators; heavy 3px ink rule on masthead,
   table heads, and footer ONLY; 64px accent stub under heroes; labeled mono
   rules at section transitions; washes are the only color fields.
   No gradients, no shadows, no blur.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 15px; }
img { max-width: 100%; height: auto; display: block; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--s-surface); color: var(--s-text);
  border: 1px solid var(--s-border); padding: 8px 14px;
  font-family: var(--s-font-mono); font-size: 0.75rem;
}
.skip-link:focus { left: 8px; top: 8px; }

/* Reading progress — hairline-thin, solid accent. */
.progress {
  position: fixed; inset: 0 auto auto 0; z-index: 120;
  height: 2px; width: 100%;
  background: var(--s-accent);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ------------------------------------------------------------ masthead ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--s-bg);
  border-bottom: 1px solid var(--s-border);
}
.header-inner {
  display: flex; align-items: center; gap: 26px;
  height: 60px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--s-text);
}
.logo-mark {
  width: 26px; height: 26px;
  border-radius: var(--s-radius-sm);
}
.logo-text {
  font-family: var(--s-font-display);
  font-weight: 700; font-size: 1.02rem;
  letter-spacing: var(--s-tracking-display);
}
.site-nav { display: none; align-self: stretch; gap: 2px; }
.site-nav a {
  position: relative; display: inline-flex; align-items: center;
  font-family: var(--s-font-body);
  font-weight: 500; font-size: 0.92rem;
  text-decoration: none; color: var(--s-text-dim);
  padding: 0 11px;
}
.site-nav a:hover { color: var(--s-text); }
.site-nav a[aria-current="page"] { color: var(--s-accent); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute;
  left: 11px; right: 11px; bottom: -1px;
  height: 2px; background: var(--s-accent);
}
.header-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

/* Icon buttons override the theme's solid-accent button default. */
.icon-btn {
  background: transparent; color: var(--s-text-dim);
  border: none; border-radius: var(--s-radius-sm);
  width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--s-surface); color: var(--s-text); }
.icon-btn svg {
  width: 18px; height: 18px; fill: none;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
html[data-theme="dark"] .i-moon { display: none; }
html:not([data-theme="dark"]) .i-sun { display: none; }

/* ------------------------------------------------------------- drawer ---- */
.drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 160;
  width: min(300px, 84vw);
  background: var(--s-bg);
  border-left: 1px solid var(--s-border);
  transform: translateX(100%);
  transition: transform .2s ease;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 10px 20px;
  border-bottom: 1px solid var(--s-border);
  font-family: var(--s-font-mono); font-size: 0.7rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim);
}
.drawer-nav { display: flex; flex-direction: column; padding: 8px 0; }
.drawer-nav a {
  text-decoration: none; color: var(--s-text);
  font-family: var(--s-font-body); font-weight: 600; font-size: 0.95rem;
  padding: 11px 20px;
  border-bottom: 1px solid var(--s-border);
}
.drawer-nav a:last-child { border-bottom: none; }
.drawer-nav a:hover { background: var(--s-surface); color: var(--s-accent); }
.drawer-scrim {
  position: fixed; inset: 0; z-index: 150;
  background: rgb(0 0 0 / 0.35);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.drawer-scrim.is-open { opacity: 1; pointer-events: auto; }

/* ----------------------------------------------- drawer nested nav ---- */
.drawer-sub {
  width: 100%;
}
.drawer-sub > summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px;
  padding: 11px 20px;
  font-family: var(--s-font-body); font-weight: 600; font-size: 0.95rem;
  color: var(--s-text);
  border-bottom: 1px solid var(--s-border);
  cursor: pointer; list-style: none;
}
.drawer-sub > summary::-webkit-details-marker { display: none; }
.drawer-sub > summary::marker { content: ""; }
.drawer-sub > summary svg {
  width: 18px; height: 18px; flex-shrink: 0;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s ease;
}
.drawer-sub[open] > summary svg { transform: rotate(180deg); }
/* Nested folders are sub-groups of their parent section, not siblings of the
   top-level nav item: indent them and dim/lighten the label (same body font
   as the rest of the menu) so "Knowledge Base" reads as the header and the
   folders sit visibly beneath it. */
.drawer-sub .drawer-sub > summary {
  min-height: 40px;
  padding: 9px 20px 9px 32px;
  font-weight: 500; font-size: 0.9rem;
  color: var(--s-text-dim);
}
.drawer-sub .drawer-sub .drawer-sub > summary { padding-left: 44px; }
.drawer-sub .drawer-sub > summary svg { width: 14px; height: 14px; }
.drawer-sub a {
  display: block; text-decoration: none;
  color: var(--s-text-dim); font-weight: 500; font-size: 0.9rem;
  padding: 9px 20px 9px 32px;
  border-bottom: 1px solid var(--s-border);
}
.drawer-sub .drawer-sub a { padding-left: 44px; }
.drawer-sub .drawer-sub .drawer-sub a { padding-left: 56px; }
.drawer-sub a:hover { background: var(--s-surface); color: var(--s-accent); }
.drawer-sub a[aria-current="page"] {
  color: var(--s-accent); background: var(--s-wash-green); font-weight: 600;
}
.drawer-sub-overview {
  font-weight: 600;
}

/* --------------------------------------------------------------- hero ---- */
.hero { padding-block: 56px 8px; }
.hero-eyebrow {
  font-family: var(--s-font-mono);
  font-size: 0.68rem; letter-spacing: var(--s-tracking-label);
  text-transform: uppercase; color: var(--s-accent);
  margin: 0 0 14px;
}
.hero-title {
  font-size: clamp(2rem, 6vw, 3.1rem);
  margin: 0 0 6px;
}
/* 64px accent stub — under heroes, never full width. */
.hero-title::after {
  content: ""; display: block;
  width: 64px; height: 3px;
  background: var(--s-accent);
  margin-top: 18px;
}
.hero-lead {
  color: var(--s-text-dim);
  font-size: 1.06rem;
  /* max-width: 58ch; */
  margin: 18px 0 0;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn { display: inline-block; text-decoration: none; line-height: 1.4; }
.btn-primary:hover { color: var(--s-on-accent); }

/* ---------------------------------------------- labeled section heads ---- */
/* Numbered section head: `02 —` in mono accent + display face. */
.site-main { counter-reset: strata-section; }
.section-heading {
  counter-increment: strata-section;
  display: flex; align-items: baseline; gap: 12px;
  font-size: 1.25rem; margin: 0 0 20px;
}
.section-heading::before {
  content: counter(strata-section, decimal-leading-zero) " —";
  font-family: var(--s-font-mono);
  font-weight: 500; font-size: 0.78rem;
  letter-spacing: 0.14em; color: var(--s-accent);
}
.home-intro, .home-sections, .home-featured, .home-recent { padding-block: 40px 8px; }
.home-recent { padding-block-end: 56px; }

/* --------------------------------------------------------------- cards ---- */
.card-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  position: relative; display: block;
  background: var(--s-surface);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  padding: 18px 18px 16px;
  text-decoration: none; color: var(--s-text);
}
.card:hover { border-color: var(--s-accent); }
.card h3, .prose .card h3 { margin: 6px 0 6px; font-size: 1.02rem; padding-bottom: 0; border-bottom: none; }
.card p, .prose .card p { margin: 0; color: var(--s-text-dim); font-size: 0.87rem; line-height: 1.55; }
.card-kicker {
  font-family: var(--s-font-mono);
  font-size: 0.64rem; letter-spacing: var(--s-tracking-label);
  text-transform: uppercase; color: var(--s-accent);
}
.card-arrow {
  position: absolute; top: 16px; right: 16px;
  color: var(--s-text-dim); font-size: 0.9rem;
}
.card:hover .card-arrow { color: var(--s-accent); }

/* Tools directory: compact app cards with a small (48px) icon. */
.tools-category { margin-top: 1.6rem; }
.tools-category .card-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
/* Icon left, title + description stacked to its right, so cards stay wide and short. */
.tools-category .card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 30px 14px 14px;
}
.tools-card-body { display: block; min-width: 0; }
.tools-card-body h3 { margin-top: 0; }
.tools-icon { display: block; flex: none; color: var(--s-accent); }
.tools-icon svg {
  width: 40px; height: 40px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Tools filter / command bar: reuses .kb-search for the input shell. */
.tools-search { margin-bottom: 1.4rem; }
.card.is-hidden, .tools-category.is-hidden { display: none; }
.card.is-active { border-color: var(--s-accent); }

/* Chips: lowercase mono facts. */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-family: var(--s-font-mono); font-size: 0.66rem; text-transform: lowercase;
  background: var(--s-bg); color: var(--s-text-dim);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius-sm);
  padding: 2px 8px;
}
.chip-status {
  border: none; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--s-term-bg); color: var(--s-term);
}
.chip-status[data-status="active"]   { background: var(--s-ok-bg);   color: var(--s-ok); }
.chip-status[data-status="shipped"]  { background: var(--s-link-bg); color: var(--s-link); }
.chip-status[data-status="planning"] { background: var(--s-warn-bg); color: var(--s-warn); }
.chip-status[data-status="archived"] { background: var(--s-bg);      color: var(--s-text-dim); }
.chip-btn { cursor: pointer; }
.chip-btn:hover { border-color: var(--s-accent); color: var(--s-accent); background: var(--s-bg); }
.chip-btn.is-active {
  background: var(--s-wash-green); border-color: var(--s-accent); color: var(--s-accent);
}
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }

/* ----------------------------------------------------------- post list ---- */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: grid; grid-template-columns: 96px 1fr; gap: 4px 18px;
  align-items: baseline;
  padding: 13px 2px;
  border-bottom: 1px solid var(--s-border);
  text-decoration: none; color: var(--s-text);
}
.post-row:hover .post-row-title { color: var(--s-accent); }
.post-row time {
  font-family: var(--s-font-mono); font-size: 0.7rem;
  color: var(--s-text-dim); white-space: nowrap;
}
.post-row-title { font-weight: 600; font-size: 0.97rem; }
.post-row-desc {
  grid-column: 2; color: var(--s-text-dim); font-size: 0.85rem;
}

/* ----------------------------------------------------- section indexes ---- */
.index-head { padding-block: 44px 4px; }
/* h1 margin-bottom is the gap below the accent stub (::after sits flush at the
   h1's content-box bottom); keep it roomy so the lead/intro isn't tight. */
.index-head h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); margin: 0 0 18px; }
.index-head h1::after {
  content: ""; display: block; width: 64px; height: 3px;
  background: var(--s-accent); margin-top: 14px;
}
.index-intro { color: var(--s-text-dim); max-width: 62ch; }
.index-head + .wrap, .index-head ~ .wrap { padding-bottom: 48px; }

/* ------------------------------------------------------------- article ---- */
.article-wrap { padding-block: 44px 56px; }
.article-head { margin-bottom: 26px; }
/* Match the section-index/hero accent stub; h1 margin-bottom is the gap below
   the bar, kept roomy so the body/lead doesn't sit tight against it. */
.article-head h1 { font-size: clamp(1.7rem, 5vw, 2.35rem); margin: 0 0 18px; }
.article-head h1::after {
  content: ""; display: block; width: 64px; height: 3px;
  background: var(--s-accent); margin-top: 14px;
}
.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font-family: var(--s-font-mono); font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--s-text-dim);
}
.article-meta a { color: var(--s-term); text-decoration: none; }
.article-meta a:hover { text-decoration: underline; }
.article-lead { color: var(--s-text-dim); font-size: 1.04rem; }
.article-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }

/* --------------------------------------------------------------- prose ---- */
/* .prose { max-width: 70ch; } */
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.35rem; margin: 2em 0 0.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--s-text); }
.prose h3 { font-size: 1.08rem; margin: 1.6em 0 0.5em; padding-bottom: 0.25em; border-bottom: 1px solid var(--s-text); }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose li { margin-bottom: 0.3em; }
.prose img {
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  margin: 1.4em 0;
  max-width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

/* Floated / aligned article images. The sp-* classes are emitted by the
   StrataPress Obsidian plugin from `![[img.png|right|300]]`-style embeds, via
   attr_list. Specificity here (0,2,1) beats the .prose img margin above. */
.prose img.sp-left  { float: left;  max-width: 45%; margin: 0.4em 1.6em 1em 0; }
.prose img.sp-right { float: right; max-width: 45%; margin: 0.4em 0 1em 1.6em; }
.prose img.sp-center { margin-left: auto; margin-right: auto; }

/* Keep a float from spilling past its section or out of the article body. */
.prose h2, .prose h3, .prose hr { clear: both; }
.prose::after { content: ""; display: table; clear: both; }

/* A 45% float is unreadable on a phone - drop back to a full-width block. */
@media (max-width: 640px) {
  .prose img.sp-left, .prose img.sp-right {
    float: none; max-width: 100%; margin: 1.4em 0;
  }
}

.prose hr { margin: 2em 0; }

/* Heading permalinks */
.prose .headerlink {
  color: var(--s-text-dim); text-decoration: none;
  margin-left: 8px; opacity: 0; font-family: var(--s-font-mono); font-size: 0.85em;
}
.prose h2:hover .headerlink, .prose h3:hover .headerlink,
.prose h4:hover .headerlink { opacity: 1; }
.prose .headerlink:hover { color: var(--s-accent); }

/* Task lists */
.prose .task-list-item { list-style: none; margin-left: -1.3em; }
.prose .task-list-item input {
  margin-right: 8px; accent-color: var(--s-accent);
}

/* Footnotes */
.prose .footnote {
  font-size: 0.85rem; color: var(--s-text-dim);
  border-top: 1px solid var(--s-border); margin-top: 2.5em; padding-top: 1em;
}

/* Admonitions: wash panels — the only sanctioned color fields.
   Wash bg, hairline border, 3px left bar in hue, mono-caps title in hue. */
.admonition {
  border: 1px solid var(--s-border);
  border-left: 3px solid var(--s-link);
  border-radius: 0 var(--s-radius-sm) var(--s-radius-sm) 0;
  background: var(--s-wash-blue);
  padding: 11px 15px;
  margin: 0 0 1.2em;
  font-size: 0.92rem;
}
.admonition > :last-child { margin-bottom: 0; }
.admonition-title {
  font-family: var(--s-font-mono);
  font-weight: 500; font-size: 0.68rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-link);
  margin: 0 0 6px;
}
.admonition.tip, .admonition.success, .admonition.hint {
  background: var(--s-wash-green); border-left-color: var(--s-accent);
}
.admonition.tip .admonition-title, .admonition.success .admonition-title,
.admonition.hint .admonition-title { color: var(--s-accent); }
.admonition.warning, .admonition.caution, .admonition.attention {
  background: var(--s-wash-brass); border-left-color: var(--s-warn);
}
.admonition.warning .admonition-title, .admonition.caution .admonition-title,
.admonition.attention .admonition-title { color: var(--s-warn); }
.admonition.danger, .admonition.error, .admonition.bug {
  background: var(--s-wash-danger); border-left-color: var(--s-error);
}
.admonition.danger .admonition-title, .admonition.error .admonition-title,
.admonition.bug .admonition-title { color: var(--s-error); }
.admonition.example, .admonition.abstract, .admonition.quote {
  background: var(--s-wash-plum); border-left-color: var(--s-term);
}
.admonition.example .admonition-title, .admonition.abstract .admonition-title,
.admonition.quote .admonition-title { color: var(--s-term); }

/* --------------------------------------------------------- code blocks ---- */
.codeblock {
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  background: var(--s-surface);
  margin: 0 0 1.2em;
  overflow: hidden;
}
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--s-border);
}
.codeblock-lang {
  font-family: var(--s-font-mono); font-size: 0.66rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim);
}
.codeblock-copy {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--s-text-dim);
  border: none; border-radius: var(--s-radius-sm);
  font-family: var(--s-font-mono); font-size: 0.66rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 8px; cursor: pointer;
}
.codeblock-copy:hover { background: var(--s-bg); color: var(--s-text); }
.codeblock-copy.is-copied { color: var(--s-ok); background: transparent; }
.codeblock-copy svg {
  width: 13px; height: 13px; fill: none;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.codeblock pre { border: none; border-radius: 0; margin: 0; }
.prose pre { margin: 0 0 1.2em; }

/* Pygments — colored with semantic tokens so the palette follows the brand.
   Accent = keywords · brass = strings · plum/term = names · link = numbers. */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .ch,
.highlight .cs { color: var(--s-text-dim); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr,
.highlight .kt, .highlight .kc, .highlight .ow { color: var(--s-accent); font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb,
.highlight .sd, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr { color: var(--s-warn); }
.highlight .nf, .highlight .fm, .highlight .nc, .highlight .nn,
.highlight .nd { color: var(--s-term); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh,
.highlight .mo, .highlight .il { color: var(--s-link); }
.highlight .nb, .highlight .bp, .highlight .nt { color: var(--s-link); }
.highlight .o, .highlight .p { color: var(--s-text); }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: var(--s-text); }
.highlight .gd { color: var(--s-error); }
.highlight .gi { color: var(--s-ok); }
.highlight .err { color: var(--s-error); }

/* ------------------------------------------------------------ toc pane ---- */
.toc-label {
  font-family: var(--s-font-mono); font-size: 0.66rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim); margin: 0 0 10px;
}
.toc-pane { display: none; }
.toc-pane .toc ul { list-style: none; margin: 0; padding: 0; }
.toc-pane .toc ul ul { padding-left: 14px; }
.toc-pane .toc a {
  display: block; text-decoration: none;
  color: var(--s-text-dim); font-size: 0.8rem;
  padding: 3px 0 3px 10px;
  border-left: 1px solid var(--s-border);
}
.toc-pane .toc a:hover { color: var(--s-text); }
.toc-pane .toc a.is-active {
  color: var(--s-accent); border-left: 2px solid var(--s-accent);
  padding-left: 9px;
}

/* --------------------------------------------------------------- pager ---- */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 44px; padding-top: 20px;
  border-top: 1px solid var(--s-border);
}
.pager-link {
  display: block; text-decoration: none;
  background: var(--s-surface);
  border: 1px solid var(--s-border); border-radius: var(--s-radius);
  padding: 12px 15px; color: var(--s-text);
}
.pager-link:hover { border-color: var(--s-accent); }
.pager-link span {
  display: block;
  font-family: var(--s-font-mono); font-size: 0.62rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim); margin-bottom: 4px;
}
.pager-link strong { font-size: 0.88rem; font-weight: 600; }
.pager-next { text-align: right; grid-column: 2; }
.pager-prev { grid-column: 1; }

/* Blog index pager: prev-link / page-count / next-link, three columns. */
.pager-blog { grid-template-columns: 1fr auto 1fr; align-items: center; }
.pager-count {
  font-family: var(--s-font-mono); font-size: 0.62rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim); white-space: nowrap;
}

/* -------------------------------------------------------------- backlinks -- */
.backlinks {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--s-border);
}
.backlinks-label {
  font-family: var(--s-font-mono); font-size: 0.66rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-text-dim); margin: 0 0 10px;
}
.backlinks ul { list-style: none; margin: 0; padding: 0; }
.backlinks li { margin: 0 0 6px; }
.backlinks a { color: var(--s-text); }

/* ------------------------------------------------------------------ kb ---- */
.kb-wrap { display: block; padding-block: 36px 56px; }
.kb-sidebar-toggle { margin-bottom: 16px; }
.kb-sidebar { display: none; margin-bottom: 26px; }
.kb-sidebar.is-open { display: block; }
.kb-tree { font-size: 0.86rem; }
.kb-tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.kb-tree > ul { padding-left: 0; }
.kb-group { padding-left: 12px; }
.kb-tree a {
  display: block; text-decoration: none;
  color: var(--s-text-dim); padding: 4px 8px;
  border-radius: var(--s-radius-sm);
}
.kb-tree a:hover { color: var(--s-text); background: var(--s-surface); }
.kb-tree a[aria-current="page"] {
  color: var(--s-accent); background: var(--s-wash-green); font-weight: 600;
}
.kb-tree details > summary {
  font-family: var(--s-font-mono); font-size: 0.66rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--s-text-dim);
  padding: 8px 8px 4px; cursor: pointer; list-style: none;
}
.kb-tree details > summary::-webkit-details-marker { display: none; }
.kb-tree details > summary::marker { content: ""; }
.kb-tree details > summary::before { content: "+ "; color: var(--s-accent); }
.kb-tree details[open] > summary::before { content: "\2212\a0"; }

/* ------------------------------------------------------------- gallery ---- */
.gallery-grid-cards {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.album-card {
  display: block; text-decoration: none; color: var(--s-text);
  background: var(--s-surface);
  border: 1px solid var(--s-border); border-radius: var(--s-radius);
  overflow: hidden;
}
.album-card:hover { border-color: var(--s-accent); }
.album-cover { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.album-card h3 { margin: 10px 14px 2px; font-size: 0.95rem; }
.album-card p {
  margin: 0 14px 12px;
  font-family: var(--s-font-mono); font-size: 0.68rem;
  color: var(--s-text-dim);
}
.gallery-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  margin-top: 24px;
}
.gallery-item {
  padding: 0; border: 1px solid var(--s-border);
  border-radius: var(--s-radius); overflow: hidden;
  background: var(--s-surface); cursor: zoom-in;
}
.gallery-item:hover { border-color: var(--s-accent); background: var(--s-surface); }
.gallery-thumb { aspect-ratio: 1; object-fit: cover; width: 100%; }

.lightbox {
  position: fixed; inset: 0; z-index: 180;
  background: rgb(0 0 0 / 0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(1200px, 92vw); max-height: 84vh;
  border-radius: var(--s-radius-sm);
}
.lightbox figcaption {
  position: absolute; left: 0; right: 0; bottom: 14px;
  text-align: center; color: #D5D8DE;
  font-family: var(--s-font-mono); font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 1;
  background: transparent; color: #D5D8DE;
  border: 1px solid rgb(213 216 222 / 0.35);
  border-radius: var(--s-radius-sm);
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgb(213 216 222 / 0.12);
}
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-close svg, .lb-prev svg, .lb-next svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* -------------------------------------------------------------- search ---- */
.search-modal {
  position: fixed; inset: 0; z-index: 190;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.search-modal[hidden] { display: none; }
.search-scrim { position: absolute; inset: 0; background: rgb(0 0 0 / 0.4); }
.search-panel {
  position: relative; width: min(620px, 100%);
  background: var(--s-bg);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  overflow: hidden;
}
.search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--s-border);
}
.search-input-row svg {
  width: 16px; height: 16px; fill: none; stroke: var(--s-text-dim);
  stroke-width: 1.8; stroke-linecap: round;
}
.search-input-row input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--s-text); font-family: var(--s-font-body); font-size: 0.98rem;
}
.search-close-btn { width: 24px; height: 24px; flex-shrink: 0; }
.search-close-btn svg { width: 14px; height: 14px; }
.search-hint {
  font-family: var(--s-font-mono); font-size: 0.62rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--s-text-dim);
  border: 1px solid var(--s-border); border-radius: var(--s-radius-sm);
  padding: 2px 6px;
}
.search-results, .kb-search-results { max-height: 52vh; overflow-y: auto; }
.search-results a, .kb-search-results a {
  display: block; padding: 11px 16px;
  text-decoration: none; color: var(--s-text);
  border-bottom: 1px solid var(--s-border);
}
.search-results a:last-child, .kb-search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.is-active,
.kb-search-results a:hover, .kb-search-results a.is-active { background: var(--s-surface); }
.search-result-section {
  font-family: var(--s-font-mono); font-size: 0.62rem;
  letter-spacing: var(--s-tracking-label); text-transform: uppercase;
  color: var(--s-term); margin-right: 8px;
}
.search-result-title { display: block; font-weight: 600; font-size: 0.92rem; }
.search-result-meta { display: block; margin-top: 2px; }
.search-result-excerpt {
  color: var(--s-text-dim); font-size: 0.8rem;
}
.search-results mark, .kb-search-results mark {
  background: var(--s-wash-brass); color: var(--s-warn);
  border-radius: 2px; padding: 0 1px;
}
.search-empty {
  padding: 18px 16px; color: var(--s-text-dim);
  font-family: var(--s-font-mono); font-size: 0.75rem;
}

/* ---------------------------------------------------------- kb search ---- */
.kb-search {
  display: flex; align-items: center; gap: 10px;
  width: 100%; box-sizing: border-box;
  margin: 2em 0 0;
  background: var(--s-bg);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
  padding: 12px 14px;
  transition: border-color .15s ease;
}
.kb-search:focus-within { border-color: var(--s-accent); }
.kb-search svg {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: var(--s-text-dim);
  stroke-width: 1.8; stroke-linecap: round;
}
.kb-search:focus-within svg { stroke: var(--s-accent); }
.kb-search input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--s-text); font-family: var(--s-font-body); font-size: 0.98rem;
}
.kb-search input::placeholder { color: var(--s-text-dim); }
.kb-search input::-webkit-search-cancel-button,
.kb-search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.kb-search-results {
  margin-top: 8px;
  background: var(--s-bg);
  border: 1px solid var(--s-border);
  border-radius: var(--s-radius);
}
.kb-card-grid { margin-top: 2em; }

/* -------------------------------------------------------------- footer ---- */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--s-border);
  background: var(--s-bg);
}
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 22px 20px 26px;
}
.footer-brand {
  font-family: var(--s-font-display); font-weight: 700; font-size: 0.95rem;
}
.footer-tagline { color: var(--s-text-dim); font-size: 0.82rem; }
.footer-end {
  margin-left: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.footer-meta {
  font-family: var(--s-font-mono); font-size: 0.64rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--s-text-dim);
}
.footer-meta a { color: var(--s-text-dim); text-decoration: none; }
.footer-meta a:hover { color: var(--s-accent); }

.footer-social { display: flex; gap: 2px; }
@media (max-width: 640px) { .footer-end { margin-left: 0; align-items: flex-start; } }

.header-title {
  display: block; max-width: 0; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; opacity: 0;
  font-family: var(--s-font-display); font-weight: 700; font-size: 0.95rem;
  transition: opacity .2s ease, max-width .2s ease;
}
.site-header.is-title-visible .header-title { max-width: 200px; opacity: 1; }

.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: 38px; height: 38px; padding: 0;
  background: var(--s-surface); color: var(--s-text-dim);
  border: 1px solid var(--s-border); border-radius: var(--s-radius-sm);
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.to-top.is-active { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--s-accent); border-color: var(--s-accent); background: var(--s-surface); }
.to-top svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------ notfound ---- */
.notfound { padding-block: 96px; text-align: left; }
.notfound h1 { font-size: clamp(2.4rem, 9vw, 4rem); margin: 0 0 8px; }
.notfound h1::after {
  content: ""; display: block; width: 64px; height: 3px;
  background: var(--s-accent); margin-top: 16px;
}

/* -------------------------------------------------------------- reveal ---- */
.reveal { opacity: 0; transform: translateY(6px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity .3s ease, transform .3s ease;
}

/* --------------------------------------------------------- breadcrumb ---- */
.breadcrumb {
  display: flex; align-items: center; gap: 0;
  flex-wrap: nowrap; overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  font-family: var(--s-font-mono); font-size: 0.8rem;
  color: var(--s-text-dim);
  margin-bottom: 10px;
}
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb a {
  color: var(--s-text-dim); text-decoration: none;
}
.breadcrumb a:hover { color: var(--s-accent); }
.breadcrumb [aria-current="page"] {
  color: var(--s-text);
  overflow: hidden; text-overflow: ellipsis;
  min-width: 0; max-width: 45vw;
}
.breadcrumb > :not(:first-child)::before {
  content: "›"; margin: 0 6px;
  color: var(--s-text-dim); opacity: .6;
}

/* --------------------------------------------------------- breakpoints ---- */
@media (min-width: 760px) {
  body { font-size: 16px; }
  .site-nav { display: flex; }
  .nav-burger { display: none; }
  .kb-wrap {
    display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 44px;
  }
  .kb-sidebar { display: block; position: sticky; top: 76px; align-self: start; margin: 0; }
  .kb-sidebar-toggle { display: none; }
  .header-title { display: none; }
}

@media (min-width: 1240px) {
  .article-wrap.has-toc {
    display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 56px;
  }
  .toc-pane { display: block; position: sticky; top: 76px; align-self: start; }
  .kb-wrap.has-toc {
    grid-template-columns: 230px minmax(0, 1fr) 200px;
  }
}

/* ----------------------------------------- breadcrumb desktop reset ---- */
@media (min-width: 760px) {
  .breadcrumb {
    flex-wrap: wrap; overflow: visible; white-space: normal;
  }
  .breadcrumb [aria-current="page"] {
    max-width: none;
  }
}

/* ------------------------------------------------------ reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Mobile KB index toggle: ghost, full-width */
.kb-sidebar-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: var(--s-surface); color: var(--s-text);
  border: 1px solid var(--s-border); border-radius: var(--s-radius-sm);
  font-family: var(--s-font-mono); font-size: 0.7rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 10px 12px;
}
.kb-sidebar-toggle:hover { background: var(--s-surface); border-color: var(--s-accent); }
.kb-sidebar-toggle svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
@media (min-width: 760px) { .kb-sidebar-toggle { display: none; } }

.post-row.is-hidden { display: none; }
.search-result { display: block; }
.search-results .search-hint, .kb-search-results .search-hint {
  display: block; border: none; padding: 14px 16px;
}

/* Post-row tag chips share the content column, inline after the excerpt */
.post-row .chip-row {
  grid-column: 2; margin-top: 6px;
}
.post-row .chip-row .chip { font-size: 0.62rem; }

/* --------------------------------------------------------- links page ---- */
.linktree {
  max-width: 34rem;
}
.linktree-header {
  text-align: center;
  padding: 2.5rem 0 1.25rem;
}
.linktree-title {
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
}
.linktree-lead {
  color: var(--s-text-dim);
  margin: 0;
  font-size: 0.95rem;
}
.linktree-section {
  margin-top: 2rem;
}
.linktree-section-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-family: var(--s-font-mono);
  color: var(--s-text-dim);
  margin: 0 0 0.65rem;
  border: none;
}
.linktree-items {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.linktree-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  text-align: center;
  min-height: 3rem;
  box-sizing: border-box;
}
.linktree-btn-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.linktree-btn-icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------- print ---- */
@media print {
  /* Drop interactive chrome; keep the article. */
  .site-header, .site-footer, .drawer, .drawer-scrim, .to-top, .progress,
  .toc-pane, .kb-sidebar, .search-modal, .lightbox, .pager, .breadcrumb,
  .nav-burger, .header-actions, .hero-actions { display: none !important; }

  html { font-size: 12pt; }
  body { background: #fff; color: #000; }
  .wrap, .article-wrap, .kb-wrap { max-width: none; margin: 0; padding: 0; display: block; }
  .prose { max-width: none; }

  /* Reveal-on-scroll content must be visible when printed. */
  .reveal { opacity: 1 !important; transform: none !important; }

  /* Print URLs after links so references survive on paper. */
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }

  .prose pre, .prose blockquote, .prose table, figure, img { page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
}
