/* ==========================================================================
   Czujny Dom - design system
   Paleta: nocny granat (zaufanie, cisza) + bursztyn (sygnał, czujność)
   Typografia: Bricolage Grotesque (nagłówki, UI) + Spectral (tekst)
   ========================================================================== */

:root {
  --header-h: 66px;
  --sidebar-w: 292px;
  --content-max: 1080px;

  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #e9edf1;
  --surface-3: #dfe5eb;

  --ink: #0e1a24;
  --ink-2: #2b3a48;
  --muted: #55636f;
  --line: #d7dee5;
  --line-strong: #b9c4ce;

  --navy: #0b1722;
  --navy-2: #12283a;
  --rail: #0b1722;
  --rail-ink: #c3d0dc;
  --rail-muted: #7e90a1;
  --rail-line: #1d2f40;

  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-fill: #e08a1e;
  --accent-fill-hover: #f0a63a;
  --accent-soft: #fbefdc;
  --accent-line: #eccfa3;
  --accent-rail: #e6a860;

  --danger: #a01f1f;
  --danger-soft: #fbeaea;
  --danger-line: #ecc4c4;
  --ok: #1c6b4b;
  --ok-soft: #e6f3ec;

  --radius: 10px;
  --radius-lg: 14px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-text: "Spectral", Georgia, "Times New Roman", serif;

  --shadow-sm: 0 1px 2px rgba(12, 24, 36, 0.05);
  --shadow-md: 0 10px 30px rgba(12, 24, 36, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080e14;
    --surface: #0e1821;
    --surface-2: #16222d;
    --surface-3: #1d2b38;

    --ink: #eaf1f7;
    --ink-2: #cad6e1;
    --muted: #9dafbe;
    --line: #22313d;
    --line-strong: #334554;

    --navy: #060b10;
    --navy-2: #101f2c;
    --rail: #060b10;
    --rail-ink: #c9d6e2;
    --rail-muted: #8194a6;
    --rail-line: #1a2835;

    --accent: #f0a63a;
    --accent-hover: #ffbe5c;
    --accent-fill: #e08a1e;
    --accent-fill-hover: #f0a63a;
    --accent-soft: #2a1d0c;
    --accent-line: #4a3415;
  --accent-rail: #e6a860;

    --danger: #ff8f8f;
    --danger-soft: #2a1212;
    --danger-line: #4a2020;
    --ok: #6ed3a4;
    --ok-soft: #10281e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #080e14;
  --surface: #0e1821;
  --surface-2: #16222d;
  --surface-3: #1d2b38;

  --ink: #eaf1f7;
  --ink-2: #cad6e1;
  --muted: #9dafbe;
  --line: #22313d;
  --line-strong: #334554;

  --navy: #060b10;
  --navy-2: #101f2c;
  --rail: #060b10;
  --rail-ink: #c9d6e2;
  --rail-muted: #8194a6;
  --rail-line: #1a2835;

  --accent: #f0a63a;
  --accent-hover: #ffbe5c;
  --accent-fill: #e08a1e;
  --accent-fill-hover: #f0a63a;
  --accent-soft: #2a1d0c;
  --accent-line: #4a3415;
  --accent-rail: #e6a860;

  --danger: #ff8f8f;
  --danger-soft: #2a1212;
  --danger-line: #4a2020;
  --ok: #6ed3a4;
  --ok-soft: #10281e;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------- reset -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
  color: var(--ink);
}

p { margin: 0 0 1.1em; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button { font: inherit; }
::selection { background: var(--accent-fill); color: #14100a; }

:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent-fill);
  color: #14100a;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
  transition: top 160ms var(--ease-out);
}
.skip-link:focus { top: 0; }

/* -------------------------------------------------------------- header -- */

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--accent);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-sub {
  display: block;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  margin-top: 2px;
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.search {
  position: relative;
  width: 340px;
  max-width: 40vw;
}

.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 35px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.88rem;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus {
  border-color: var(--accent-line);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out),
              transform 120ms var(--ease-out);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:focus-visible { outline-offset: 2px; }

.menu-btn { display: none; }

/* ------------------------------------------------------------- sidebar -- */

.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  z-index: 80;
  width: var(--sidebar-w);
  background: var(--rail);
  border-right: 1px solid var(--rail-line);
  display: flex;
  flex-direction: column;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 14px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--rail-line) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--rail-line);
  border-radius: 8px;
}

.sidebar-group {
  margin: 0 0 22px;
  padding-top: 16px;
  border-top: 1px solid var(--rail-line);
}
.sidebar-group:first-child { padding-top: 0; border-top: 0; }

.sidebar-heading {
  padding: 0 12px 7px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--rail-muted);
}

.sidebar-link {
  position: relative;
  display: block;
  padding: 6px 12px 6px 22px;
  margin-bottom: 1px;
  border-radius: 6px;
  color: var(--rail-ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.38;
  text-decoration: none;
  transition: color 150ms var(--ease-out), background 150ms var(--ease-out),
              transform 150ms var(--ease-out);
}
.sidebar-link::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rail-line);
  transition: background 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.sidebar-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}
.sidebar-link:hover::before { background: var(--rail-muted); }
.sidebar-link.active {
  color: #ffffff;
  background: rgba(224, 138, 30, 0.13);
  font-weight: 500;
}
.sidebar-link.active::before {
  background: var(--accent-fill);
  transform: scale(1.35);
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--rail-line);
  font-family: var(--font-display);
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--rail-muted);
}
.sidebar-foot a { color: var(--rail-ink); text-decoration: none; }
.sidebar-foot a:hover { color: #fff; text-decoration: underline; }

.sidebar-overlay {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 75;
  background: rgba(3, 8, 13, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms var(--ease-out), visibility 200ms;
}

/* ---------------------------------------------------------------- main -- */

.shell {
  padding-top: var(--header-h);
  min-height: 100vh;
}

.main {
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--header-h));
}

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 42px 52px 88px;
}

.page-enter { animation: pageIn 260ms var(--ease-out) both; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- hero -- */

.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--navy);
  isolation: isolate;
}

.hero-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("../assets/hero-1600.webp");
  background-size: cover;
  background-position: 68% center;
  animation: heroIn 900ms var(--ease-out) both;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg,
    rgba(8, 18, 27, 0.97) 0%,
    rgba(8, 18, 27, 0.95) 40%,
    rgba(8, 18, 27, 0.80) 58%,
    rgba(8, 18, 27, 0.34) 78%,
    rgba(8, 18, 27, 0.06) 100%);
}

@keyframes heroIn {
  from { opacity: 0; transform: scale(1.035); }
  to { opacity: 1; transform: scale(1); }
}

.hero-inner {
  position: relative;
  max-width: 590px;
  padding: 58px 48px 60px;
  color: #eef5fb;
}

.hero-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.hero-mark svg { width: 42px; height: 42px; color: var(--accent-fill); flex: 0 0 auto; }

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.038em;
  line-height: 1;
  color: #ffffff;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.32rem, 1.65vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: #edf3f9;
  margin: 16px 0 14px;
  max-width: 27ch;
  text-wrap: balance;
}

.hero p {
  font-size: 1rem;
  line-height: 1.65;
  color: #c6d4e1;
  margin: 0 0 28px;
  max-width: 44ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent-fill);
  color: #14100a;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--accent-fill-hover); }
.btn:active { transform: scale(0.975); }

/* ------------------------------------------------------------- index ---- */

.section-block { margin-top: 54px; }
.section-block:first-of-type { margin-top: 46px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.section-head h2 {
  font-size: 1.42rem;
  letter-spacing: -0.025em;
}

.section-count {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 46px;
}

.index-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 2px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 160ms var(--ease-out);
}

.index-num {
  flex: 0 0 auto;
  padding-top: 2px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.index-body { min-width: 0; }

.index-title {
  display: inline;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--ink);
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 220ms var(--ease-out), color 160ms var(--ease-out);
}

.index-excerpt {
  margin: 5px 0 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.index-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  padding-top: 4px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.index-arrow svg { width: 15px; height: 15px; }

.index-item:hover .index-title { background-size: 100% 1px; color: var(--accent); }
.index-item:hover .index-arrow { opacity: 1; transform: translateX(0); }

/* ------------------------------------------------------------ article --- */

.article-head {
  padding-top: 6px;
  border-top: 2px solid var(--ink);
  margin-bottom: 26px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 14px 0 18px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb span[aria-hidden] { color: var(--line-strong); }

.article-head h1 {
  font-size: clamp(1.9rem, 3.4vw, 2.65rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 16px;
  max-width: 24ch;
}

.article-lede {
  font-size: 1.12rem;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0 0 20px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--muted);
}
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta svg { width: 13px; height: 13px; opacity: 0.75; }

.toc {
  margin: 0 0 38px;
  padding: 18px 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toc-title {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 34px;
}
.toc li { margin: 0 0 6px; break-inside: avoid; }

.toc a {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.toc a:hover { color: var(--accent); border-color: var(--accent-line); }

/* prose */

.prose {
  max-width: 71ch;
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--ink);
}

.prose > p:first-of-type { font-size: 1.06rem; }

.prose p { margin: 0 0 1.15em; }

.prose h2 {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
  margin: 2.2em 0 0.55em;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 88px;
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.prose h3 {
  font-size: 1.13rem;
  font-weight: 600;
  margin: 1.7em 0 0.4em;
  scroll-margin-top: 88px;
}

.prose ul,
.prose ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.prose li { margin-bottom: 0.45em; padding-left: 0.15em; }
.prose li::marker { color: var(--accent); }

.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: var(--accent-line);
  transition: color 140ms var(--ease-out), text-decoration-color 140ms var(--ease-out);
}
.prose a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 22px;
  border-left: 2px solid var(--accent-line);
  color: var(--ink-2);
  font-style: italic;
}

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

/* tables */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.6em 0 1.8em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table.error-table,
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-display);
  font-size: 0.87rem;
  line-height: 1.5;
  min-width: 520px;
}

.prose th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
  vertical-align: bottom;
}

.prose td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}

.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover td { background: var(--surface-2); }

/* boxes */

.info-box,
.warning-box,
.tip-box {
  margin: 1.6em 0;
  padding: 16px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.62;
}

.info-box { background: var(--surface-2); border-color: var(--line); }
.tip-box { background: var(--ok-soft); border-color: var(--ok-soft); }
.warning-box { background: var(--danger-soft); border-color: var(--danger-line); }

.info-box p:last-child,
.warning-box p:last-child,
.tip-box p:last-child { margin-bottom: 0; }

.info-box strong:first-child,
.warning-box strong:first-child,
.tip-box strong:first-child {
  display: block;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.warning-box strong:first-child { color: var(--danger); }
.tip-box strong:first-child { color: var(--ok); }

/* FAQ */

.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 2px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink);
  list-style: none;
  transition: color 150ms var(--ease-out);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent); }
.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
  transition: transform 180ms var(--ease-out);
}
.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-answer {
  padding: 0 34px 18px 2px;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.7;
}
.faq-answer p:last-child { margin-bottom: 0; }

/* glossary */

.prose dl { margin: 1.2em 0; }
.prose dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-top: 1.1em;
}
.prose dd {
  margin: 0.2em 0 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.65;
}

/* article footer nav */

.article-end {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.article-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.article-nav a {
  display: block;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.article-nav a:hover { border-color: var(--accent-line); transform: translateY(-2px); }

.article-nav .nav-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.article-nav .nav-title {
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}
.article-nav a:last-child { text-align: right; }

/* ------------------------------------------------------------- search --- */

.search-view { padding-top: 8px; }

.search-view h1 {
  font-size: 2rem;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.search-summary {
  font-family: var(--font-display);
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 26px;
}

.search-result {
  display: block;
  padding: 16px 2px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.search-result:hover .search-result-title { color: var(--accent); }

.search-result-title {
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  transition: color 150ms var(--ease-out);
}
.search-result-section {
  display: block;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.search-result p {
  margin: 6px 0 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 72ch;
}

.empty-state {
  padding: 40px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 1rem;
}

/* ------------------------------------------------------------- footer --- */

.site-footer {
  margin-top: 70px;
  padding: 34px 0 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 26px;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 6px;
}

.footer-col h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.footer-col a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 2px 0;
}
.footer-col a:hover { color: var(--accent); text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 14px 0 26px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--muted);
}

/* --------------------------------------------------------- responsive --- */

@media (max-width: 1180px) {
  .container { padding: 36px 38px 76px; }
  .index-grid { column-gap: 32px; }
  .hero-inner { padding: 46px 38px 48px; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 288px; }
  .search { width: 250px; }
  .container { padding: 32px 28px 68px; }
  .index-grid { grid-template-columns: minmax(0, 1fr); }
  .hero { min-height: 400px; }
  .hero-inner { max-width: 520px; }
  .hero::after {
    background: linear-gradient(180deg,
      rgba(9, 20, 30, 0.72) 0%,
      rgba(9, 20, 30, 0.94) 55%,
      rgba(9, 20, 30, 0.98) 100%);
  }
  .hero-img { background-position: 62% 30%; }
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 280ms var(--ease-out);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.25);
    width: 300px;
    max-width: 86vw;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-overlay { opacity: 1; visibility: visible; }
  body.nav-open { overflow: hidden; }

  .main { margin-left: 0; }
  .header-tools { gap: 8px; }
  .brand-sub { display: none; }
}

@media (max-width: 640px) {
  :root { --header-h: 60px; }

  body { font-size: 17px; }
  .app-header { padding: 0 14px; gap: 10px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-name { font-size: 0.98rem; }

  .search { width: auto; max-width: none; flex: 1 1 auto; }
  .search input { height: 36px; font-size: 0.82rem; }
  .search svg { width: 14px; height: 14px; left: 9px; }
  .search input { padding-left: 30px; }

  .icon-btn { width: 36px; height: 36px; }
  .header-tools { flex: 1 1 auto; justify-content: flex-end; }

  .container { padding: 22px 18px 60px; }

  .hero { min-height: 380px; }
  .hero-inner { padding: 34px 22px 36px; }
  .hero-brand { font-size: clamp(2.2rem, 11vw, 2.8rem); }
  .hero h1 { font-size: 1.05rem; margin: 10px 0 12px; }
  .hero p { font-size: 0.92rem; margin-bottom: 22px; }
  .hero-mark svg { width: 34px; height: 34px; }

  .section-block { margin-top: 40px; }
  .section-head h2 { font-size: 1.24rem; }
  .index-title { font-size: 0.97rem; }
  .index-excerpt { font-size: 0.87rem; }
  .index-item { padding: 13px 0 14px; gap: 10px; }

  .article-head h1 { font-size: 1.75rem; max-width: none; }
  .article-lede { font-size: 1.02rem; }
  .toc { padding: 14px 16px 16px; }
  .toc ol { columns: 1; }
  .prose { font-size: 1rem; }
  .prose h2 { font-size: 1.32rem; }
  .prose h3 { font-size: 1.08rem; }
  .article-nav { grid-template-columns: minmax(0, 1fr); }
  .article-nav a:last-child { text-align: left; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
}

/* --------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-img { animation: none; }
  .index-arrow { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .app-header, .sidebar, .sidebar-overlay, .toc, .article-nav, .site-footer { display: none !important; }
  .main { margin: 0; }
  .container { max-width: none; padding: 0; }
  body { font-size: 11pt; background: #fff; color: #000; }
  .prose { max-width: none; }
}

/* ------------------------------------------------------ cookie consent -- */

.vd-cookie-bar {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  width: min(560px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 14px 38px rgba(8, 16, 24, 0.22);
  animation: cookieIn 320ms var(--ease-out) both;
}

@keyframes cookieIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.vd-cookie-inner {
  padding: 15px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.vd-cookie-inner p {
  margin: 0;
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-2);
  flex: 1 1 230px;
  max-width: 52ch;
}
.vd-cookie-inner p a { color: var(--accent); }

.vd-cookie-actions {
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}

.vd-btn {
  padding: 9px 16px;
  border-radius: 7px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out),
              transform 120ms var(--ease-out);
}
.vd-btn:hover { background: var(--surface-2); }
.vd-btn:active { transform: scale(0.97); }
.vd-btn-solid {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: #14100a;
}
.vd-btn-solid:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }

@media (max-width: 720px) {
  .vd-cookie-bar { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .vd-cookie-inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
  .vd-cookie-actions { justify-content: stretch; }
  .vd-cookie-actions .vd-btn { flex: 1 1 0; }
}

/* ------------------------------------------------------ home composition -- */

#app.app-home {
  padding: 0 0 92px;
}

.home-body {
  padding: 0 52px;
}

.section-desc {
  margin: 12px 0 22px;
  max-width: 62ch;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .home-body { padding: 0 38px; }
  #app.app-home { padding-bottom: 78px; }
}

@media (max-width: 900px) {
  .home-body { padding: 0 28px; }
}

@media (max-width: 640px) {
  .home-body { padding: 0 18px; }
  #app.app-home { padding-bottom: 64px; }
  .hero { min-height: 420px; }
  .hero-inner { padding: 34px 22px 38px; }
  .hero h1 { font-size: 1.08rem; }
}
