/* ============================================================
   Rekuperacja - design system "POWIETRZE I CIEPŁO"
   Paleta: ink #0f1e29 / panel #172936 / paper #f5f1e8
           air #2e7fa8 (powietrze) / heat #e09a2f (odzyskane ciepło)
   Typografia: Space Grotesk (display) + Hanken Grotesk (body)
   ============================================================ */

:root {
  /* core palette */
  --ink: #0f1e29;
  --panel: #172936;
  --panel-2: #1d3140;
  --paper: #f5f1e8;
  --air: #2e7fa8;
  --air-strong: #1d5d80;
  --air-deep: #14496a;
  --heat: #e09a2f;
  --heat-bright: #f0b054;
  --heat-ink: #8a5208;

  /* light theme */
  --bg: #f5f1e8;
  --surface: #fdfbf5;
  --surface-2: #efe9db;
  --text: #232b30;
  --muted: #55636b;
  --border: #e0d8c6;
  --border-strong: #cabfa6;
  --accent: #1d5d80;
  --accent-hover: #14496a;
  --accent-soft: #e2ecf2;
  --accent-soft-2: #d2e2eb;
  --link: #1d5d80;
  --link-hover: #123f57;
  --header-bg: rgba(253, 251, 245, 0.92);
  --sidebar-bg: #efe9db;
  --shadow-card: 0 1px 2px rgba(15, 30, 41, 0.05), 0 4px 16px rgba(15, 30, 41, 0.06);
  --shadow-card-hover: 0 2px 4px rgba(15, 30, 41, 0.06), 0 10px 28px rgba(15, 30, 41, 0.12);
  --glow: rgba(46, 127, 168, 0.4);

  /* semantic boxes - LIGHT */
  --red-soft: #f9e3dc;   --red-soft-text: #5c2a1b;
  --green-soft: #e2ede2; --green-soft-text: #1d4a30;
  --blue-soft: #e1e9f0;  --blue-soft-text: #1c3d5c;
  --amber-soft: #f6e9cd; --amber-soft-text: #5c4213;

  /* typography */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-size: 17px;
  --line-height: 1.7;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 60px;
  --sidebar-w: 290px;
  --transition: .2s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1822;
    --surface: #101f2b;
    --surface-2: #162735;
    --text: #e9e4d8;
    --muted: #a8b6bf;
    --border: #24384a;
    --border-strong: #34506a;
    --accent: #6db4d8;
    --accent-hover: #8ac6e4;
    --accent-soft: #1a2d3c;
    --accent-soft-2: #1f3648;
    --link: #7dbcdd;
    --link-hover: #a2d4ec;
    --header-bg: rgba(12, 24, 34, 0.92);
    --sidebar-bg: #0a141d;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-card-hover: 0 2px 4px rgba(0,0,0,.35), 0 12px 30px rgba(0,0,0,.45);
    --glow: rgba(224, 154, 47, 0.28);
    --red-soft: #3a1f18;   --red-soft-text: #f2c4b4;
    --green-soft: #16291d; --green-soft-text: #a8d4b4;
    --blue-soft: #16222e;  --blue-soft-text: #b3cfe6;
    --amber-soft: #2e2413; --amber-soft-text: #ecd9a8;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(42rem 30rem at 110% -8%, color-mix(in srgb, var(--air) 13%, transparent), transparent 70%),
    radial-gradient(38rem 28rem at -12% 112%, color-mix(in srgb, var(--heat) 11%, transparent), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; text-wrap: balance; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
ul, ol { padding-left: 1.3em; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--air) 35%, transparent); }

/* ---------- layout ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--glow), transparent);
  opacity: .5; pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.brand-mark .bm-roof { fill: none; stroke: var(--heat); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .bm-roof-in { fill: none; stroke: var(--air); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .bm-house { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linejoin: round; }
.brand-mark .bm-fan { fill: var(--air); }
@media (prefers-color-scheme: dark) {
  .brand-mark .bm-house { stroke: #c3d3dd; }
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -.02em; white-space: nowrap; }

.header-search {
  position: relative; margin-left: auto; width: min(340px, 42vw);
}
.search-icon { width: 16px; height: 16px; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; pointer-events: none; }
#search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  font-family: var(--font-display); font-size: .875rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 999px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 120;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card-hover); max-height: 380px; overflow-y: auto;
  display: none;
}
.search-results.open { display: block; }
.search-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); text-decoration: none; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--accent-soft); }
.search-item .si-title { font-family: var(--font-display); font-size: .875rem; font-weight: 600; color: var(--text); }
.search-item .si-excerpt { font-size: .8rem; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-empty { padding: 12px 14px; font-size: .85rem; color: var(--muted); }

.mobile-menu-btn {
  display: none; width: 40px; height: 40px; flex-shrink: 0;
  font-size: 1.15rem; color: var(--text);
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer;
}
.mobile-menu-btn:hover { background: var(--accent-soft); }

.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0; z-index: 90;
  width: var(--sidebar-w); overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 14px 40px;
  scrollbar-width: thin;
}
.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.nav-section {
  font-family: var(--font-display); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--heat-ink);
  padding: 16px 10px 6px;
}
@media (prefers-color-scheme: dark) { .nav-section { color: var(--heat); } }
.nav-section:first-child { padding-top: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: .9rem; font-weight: 400;
  color: var(--text); text-decoration: none;
  padding: 5.5px 10px; border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a .nav-icon { font-size: .95rem; line-height: 1; opacity: .85; }
.sidebar-nav a:hover { background: var(--accent-soft); color: var(--link-hover); }
.sidebar-nav a.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-hover);
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .sidebar-nav a.active { color: var(--accent); }
}

.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 28px) 28px 60px;
  min-height: 100vh;
}
.page { max-width: 900px; margin: 0 auto; }

/* ---------- page transition ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page.transition { animation: fadeUp .25s ease-out; }

/* ---------- HOME: hero ---------- */
.home-hero {
  position: relative;
  border-radius: 18px;
  padding: 48px 48px 42px;
  margin-bottom: 34px;
  background:
    radial-gradient(34rem 22rem at 88% -20%, color-mix(in srgb, var(--air) 38%, transparent), transparent 65%),
    radial-gradient(26rem 20rem at -8% 110%, color-mix(in srgb, var(--heat) 24%, transparent), transparent 60%),
    linear-gradient(140deg, #0a1822, var(--panel) 58%, #1b2c3a);
  color: #f4f1e6;
  overflow: hidden;
  box-shadow: var(--shadow-card-hover);
}
.home-hero::before {
  content: ''; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.75) 1px, transparent 1.4px);
  background-size: 26px 26px;
  mask-image: linear-gradient(120deg, transparent 30%, #000 75%);
  -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000 75%);
}
.hero-eyebrow {
  font-family: var(--font-display); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--heat-bright);
  margin-bottom: 12px;
}
.home-hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 700; color: #fff;
  margin-bottom: 14px; max-width: 600px;
}
.home-hero .hero-sub {
  font-size: 1.05rem; line-height: 1.6; color: #c3d3dd;
  max-width: 540px; margin-bottom: 24px;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: .95rem; font-weight: 600;
  color: var(--ink); background: var(--heat);
  padding: 11px 22px; border-radius: 999px; text-decoration: none;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.hero-cta:hover { background: var(--heat-bright); color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.hero-stats {
  display: flex; gap: 28px; margin-top: 30px; padding-top: 22px;
  border-top: 1px solid color-mix(in srgb, #fff 18%, transparent);
}
.hero-stat .hs-num { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--heat-bright); }
.hero-stat .hs-label { font-size: .8rem; color: #c3d3dd; }

/* ---------- HOME: airflow diagram (signature) ---------- */
.flow-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 26px 20px; margin-bottom: 34px;
  box-shadow: var(--shadow-card);
}
.flow-wrap h2 { font-size: 1.15rem; margin-bottom: 4px; }
.flow-wrap .flow-sub { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.flow-diagram {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
}
.flow-figure { flex: 1 1 420px; min-width: 280px; }
.flow-figure svg { width: 100%; height: auto; display: block; }
.flow-figure .f-wall { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.flow-figure .f-floor { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; opacity: .45; }
.flow-figure .f-unit { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.5; }
.flow-figure .f-core { fill: var(--amber-soft); stroke: var(--heat-ink); stroke-width: 1.5; }
.flow-figure .f-duct { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 6; }
.flow-figure .f-duct.supply { stroke: url(#gSupply); }
.flow-figure .f-duct.exhaust { stroke: url(#gExhaust); }
.flow-figure .f-house-fill { fill: color-mix(in srgb, var(--air) 7%, transparent); }
.flow-figure .f-window, .flow-figure .f-window-r { stroke-width: 2.5; }
.flow-figure .f-window { fill: color-mix(in srgb, var(--air) 20%, transparent); stroke: color-mix(in srgb, var(--air) 45%, transparent); }
.flow-figure .f-window-r { fill: color-mix(in srgb, var(--heat) 22%, transparent); stroke: color-mix(in srgb, var(--heat) 50%, transparent); }
.flow-figure .f-unit { filter: drop-shadow(0 3px 6px rgba(15, 30, 41, 0.3)); }
.flow-figure .f-core { filter: drop-shadow(0 2px 4px rgba(138, 82, 8, 0.28)); }
.flow-figure .f-arrow { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 4; stroke-dasharray: 1 14; animation: flowMove 2.6s linear infinite; }
.flow-figure .f-arrow.supply { stroke: var(--air-strong); }
.flow-figure .f-arrow.exhaust { stroke: var(--heat-ink); }
@media (prefers-color-scheme: dark) { .flow-figure .f-arrow.exhaust { stroke: var(--heat-bright); } }
@keyframes flowMove { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
.flow-figure .f-draw { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 1.1s ease-out, opacity .5s ease-out; }
.flow-figure .f-draw.drawn { stroke-dashoffset: 0; opacity: 1; }
.flow-figure .f-heat {
  fill: none; stroke: var(--heat); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 3 6; animation: heatPulse 1.8s ease-in-out infinite;
}
@keyframes heatPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.flow-figure .f-fan { fill: none; transform-origin: center; transform-box: fill-box; animation: fanSpin 3.2s linear infinite; }
.flow-figure .f-fan.supply { color: var(--air-strong); }
.flow-figure .f-fan.exhaust { color: var(--heat-ink); }
@media (prefers-color-scheme: dark) { .flow-figure .f-fan.exhaust { color: var(--heat-bright); } }
@keyframes fanSpin { to { transform: rotate(360deg); } }
.flow-figure .f-label {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  fill: var(--muted);
}
.flow-figure .f-label.hot { fill: var(--heat-ink); }
@media (prefers-color-scheme: dark) { .flow-figure .f-label.hot { fill: var(--heat-bright); } }
.flow-hotspots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1 1 260px; }
.flow-hotspot {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: .85rem; font-weight: 600;
  color: var(--text); background: var(--accent-soft);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 12px; text-decoration: none; cursor: pointer;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  text-align: left;
}
.flow-hotspot:hover { background: var(--accent-soft-2); transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.flow-hotspot .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.flow-hotspot .dot.supply { background: var(--air); }
.flow-hotspot .dot.exhaust { background: var(--heat); }
.flow-hotspot .dot.core { background: var(--heat-ink); }
@media (prefers-color-scheme: dark) { .flow-hotspot .dot.core { background: var(--heat-bright); } }
.flow-hotspot .dot.filter { background: var(--air-deep); }
@media (prefers-color-scheme: dark) { .flow-hotspot .dot.filter { background: #8ac6e4; } }

/* ---------- HOME: sections grid ---------- */
.home-section { margin-bottom: 38px; }
.section-head-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head-row .sec-num {
  font-family: var(--font-display); font-size: .8rem; font-weight: 700;
  color: var(--heat-ink);
  letter-spacing: .06em;
}
@media (prefers-color-scheme: dark) { .section-head-row .sec-num { color: var(--heat); } }
.section-head-row h2 { font-size: 1.35rem; margin: 0; }
.section-desc { font-size: .92rem; color: var(--muted); margin: -6px 0 16px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.home-card {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
}
.home-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--air), var(--heat));
  opacity: 0; transition: opacity var(--transition);
}
.home-card:hover, .home-card:focus-visible {
  transform: translateY(-2px); box-shadow: var(--shadow-card-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.home-card:hover::before, .home-card:focus-visible::before { opacity: 1; }
.home-card .card-icon { font-size: 1.2rem; line-height: 1; margin-bottom: 2px; }
.home-card h3 { font-size: .95rem; font-weight: 600; margin: 0; }
.home-card p { font-size: .85rem; color: var(--muted); margin: 0; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.home-card .card-arrow {
  margin-left: auto; margin-top: auto; padding-top: 6px;
  font-family: var(--font-display); font-size: .8rem; font-weight: 700;
  color: var(--accent);
  transition: transform var(--transition);
}
.home-card:hover .card-arrow { transform: translateX(4px); }

/* ---------- ARTICLE ---------- */
.article-head { margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-head .art-eyebrow {
  font-family: var(--font-display); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--heat-ink);
  margin-bottom: 10px;
}
@media (prefers-color-scheme: dark) { .article-head .art-eyebrow { color: var(--heat); } }
.article-head h1 { font-size: clamp(1.65rem, 3.4vw, 2.3rem); margin-bottom: 10px; }
.article-head .art-excerpt { font-size: 1.05rem; color: var(--muted); line-height: 1.6; max-width: 660px; }
.article-body { max-width: 720px; font-size: 1.02rem; }
.article-body h2 {
  font-size: 1.32rem; margin-top: 1.7em; margin-bottom: .55em;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-body h3 { font-size: 1.08rem; margin-top: 1.4em; scroll-margin-top: calc(var(--header-h) + 16px); }
.article-body h2 .hash, .article-body h3 .hash { color: color-mix(in srgb, var(--accent) 45%, transparent); text-decoration: none; margin-left: 6px; font-weight: 600; }
.article-body li { margin-bottom: .35em; }
.article-body strong { font-weight: 600; }

/* TOC */
.article-toc {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin: 0 0 26px;
  font-size: .9rem;
}
.article-toc summary {
  font-family: var(--font-display); font-weight: 600; font-size: .85rem;
  cursor: pointer; list-style: none; user-select: none;
}
.article-toc summary::before { content: 'Spis treści  '; color: var(--accent); }
.article-toc ol { margin: 10px 0 0; padding-left: 1.2em; }
.article-toc li { margin-bottom: 4px; }
.article-toc a { text-decoration: none; }

/* boxes */
.info-box, .tip-box, .warning-box, .key-takeaways, .error-box {
  border-radius: var(--radius-sm); padding: 16px 18px; margin: 22px 0;
  font-size: .96rem; line-height: 1.6;
}
.info-box { background: var(--blue-soft); color: var(--blue-soft-text); border-left: 4px solid #5b8db8; }
.tip-box { background: var(--green-soft); color: var(--green-soft-text); border-left: 4px solid #4e9f6e; }
.warning-box { background: var(--red-soft); color: var(--red-soft-text); border-left: 4px solid #c0684f; }
.key-takeaways { background: var(--amber-soft); color: var(--amber-soft-text); border-left: 4px solid var(--heat-ink); }
.info-box strong, .tip-box strong, .warning-box strong, .key-takeaways strong { display: block; font-family: var(--font-display); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }

/* tables */
.table-responsive { overflow-x: auto; margin: 22px 0; border-radius: var(--radius); border: 1px solid var(--border); }
table.error-table {
  width: 100%; border-collapse: collapse; font-size: .92rem;
  background: var(--surface);
}
.error-table th {
  font-family: var(--font-display); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
  text-align: left; padding: 12px 14px;
  background: var(--accent-soft); color: var(--accent-hover);
  border-bottom: 1px solid var(--border);
}
.error-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.error-table tr:last-child td { border-bottom: none; }
.error-table tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
@media (prefers-color-scheme: dark) { .error-table th { color: var(--accent); } }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin: 12px 0; overflow: hidden;
}
.faq-item summary {
  font-family: var(--font-display); font-weight: 600; font-size: .95rem;
  padding: 15px 18px; cursor: pointer; list-style: none; position: relative;
  padding-right: 44px; transition: background var(--transition);
}
.faq-item summary:hover { background: var(--accent-soft); }
.faq-item summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-size: 1.2rem; color: var(--accent);
  transition: transform var(--transition);
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item .faq-a { padding: 0 18px 16px; font-size: .95rem; }

/* glossary */
.glossary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 22px 14px; }
.glossary dt {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  margin-top: 16px; color: var(--accent-hover);
}
@media (prefers-color-scheme: dark) { .glossary dt { color: var(--accent); } }
.glossary dd { margin: 3px 0 0; font-size: .95rem; }

/* prev/next + related */
.article-bottom { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--border); }
.related-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.related-link {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 16px; text-decoration: none; transition: border-color var(--transition), transform var(--transition);
}
.related-link:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-1px); }
.related-link .rl-label { font-family: var(--font-display); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--heat-ink); }
@media (prefers-color-scheme: dark) { .related-link .rl-label { color: var(--heat); } }
.related-link .rl-title { font-family: var(--font-display); font-size: .88rem; font-weight: 600; color: var(--text); margin-top: 3px; }

/* ---------- footer ---------- */
.site-footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  padding: 34px 28px 20px;
}
.footer-inner { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr; gap: 26px; }
.footer-brand strong { font-family: var(--font-display); font-size: 1.05rem; }
.footer-brand p, .footer-note p { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-family: var(--font-display); font-size: .88rem; text-decoration: none; }
.footer-note { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 16px; }
.footer-note p { font-size: .8rem; }
.footer-bottom { max-width: 900px; margin: 18px auto 0; font-size: .8rem; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease-out; box-shadow: 0 0 40px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 85;
    background: rgba(10, 18, 24, 0.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity var(--transition);
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; padding: calc(var(--header-h) + 18px) 16px 40px; }
  .site-footer { margin-left: 0; padding: 26px 16px 16px; }
  .mobile-menu-btn { display: block; }
  .home-hero { padding: 34px 24px 30px; }
  .hero-stats { flex-wrap: wrap; gap: 18px; }
  .related-links { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .header-search { width: min(200px, 38vw); }
  #search-input { padding: 8px 10px 8px 32px; font-size: .82rem; }
  .brand-name { font-size: .95rem; }
  .home-grid { grid-template-columns: 1fr; }
  .flow-diagram { flex-direction: column; align-items: stretch; }
  .flow-hotspots { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-stat .hs-num { font-size: 1.15rem; }
}

/* ---------- print ---------- */
@media print {
  .app-header, .sidebar, .mobile-menu-btn, .sidebar-overlay, .site-footer, .article-toc { display: none !important; }
  body { background: #fff; color: #000; }
  .main { margin: 0 !important; padding: 0 !important; }
  a { color: #000 !important; text-decoration: underline; }
}

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

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .45s ease-out, transform .45s ease-out; }
.reveal.visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }
