/* ==========================================================================
   Norma - kompendium BHP
   Design system: grafit + żółć sygnałowa + chłodna biel
   Typografia: Archivo (display/UI), Source Serif 4 (tekst), IBM Plex Mono (dane)
   ========================================================================== */

:root {
  --bg: #f3f4f0;
  --surface: #ffffff;
  --surface-2: #e9ebe5;
  --ink: #1b1e1c;
  --ink-soft: #333a35;
  --muted: #5a615c;
  --border: #d7dad2;
  --border-strong: #b9beb4;
  --yellow: #e9b500;
  --yellow-bright: #f2c21a;
  --yellow-strong: #b88f00;
  --yellow-soft: #fbf3d2;
  --yellow-line: #e8d48a;
  --red: #b3261e;
  --red-soft: #fbe9e7;
  --red-line: #e7bdb8;
  --green: #2f6b4f;
  --green-soft: #e7f1ea;
  --green-line: #b9d3c3;
  --header-h: 68px;
  --sidebar-w: 316px;
  --radius: 4px;
  --font-display: 'Archivo', 'Segoe UI', sans-serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

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

html {
  font-size: 17px;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 96% -8%, rgba(233, 181, 0, 0.08), transparent 70%),
    radial-gradient(720px 420px at -5% 102%, rgba(27, 30, 28, 0.045), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

a { color: inherit; }

img { max-width: 100%; height: auto; }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--yellow-strong);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: var(--radius);
  transition: top 160ms var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Header
   ========================================================================== */

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border-radius: 6px;
  color: var(--ink);
  transition: transform 180ms var(--ease-out), background 180ms ease;
}
.brand-mark svg { width: 25px; height: 25px; }
.brand:hover .brand-mark { transform: rotate(-4deg); background: var(--yellow-bright); }

.brand-text {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 11px;
  border-left: 1px solid var(--border);
  line-height: 1.4;
}

.search-box {
  position: relative;
  margin-left: auto;
  width: 330px;
  max-width: 42vw;
}

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

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 35px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.86rem;
  transition: border-color 160ms ease, background 160ms ease;
}
.search-box input::placeholder { color: var(--muted); opacity: 1; }
.search-box input:focus {
  border-color: var(--ink);
  background: var(--surface);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 62vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 8px 18px -8px rgba(20, 24, 21, 0.3);
  z-index: 120;
}

.search-result {
  display: block;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.search-result:last-child { border-bottom: 0; }
.search-result strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}
.search-result span {
  display: block;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}
.search-result:hover, .search-result:focus-visible { background: var(--yellow-soft); }
.search-empty { padding: 12px 13px; font-size: 0.84rem; color: var(--muted); }

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  cursor: pointer;
  flex: none;
  place-items: center;
  gap: 4px;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  transition: transform 180ms var(--ease-out), opacity 140ms ease;
}
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   Sidebar
   ========================================================================== */

.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 16px 28px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 90;
  scrollbar-width: thin;
}

.sidebar-close { display: none; }

.sidebar-section { margin-bottom: 22px; }
.sidebar-section + .sidebar-section { padding-top: 18px; border-top: 1px solid var(--border); }

.sidebar-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-section-title span { color: var(--border-strong); }

.sidebar-link {
  position: relative;
  display: block;
  padding: 6px 10px 6px 19px;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.32;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}
.sidebar-link::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 5px;
  height: 5px;
  background: var(--yellow);
  transform: translateY(-50%) scale(0.5);
  opacity: 0;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.sidebar-link:hover { background: var(--surface-2); color: var(--ink); }

.sidebar-home {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  font-weight: 600;
  color: var(--ink);
}
.sidebar-home:hover { background: transparent; color: var(--yellow-strong); }
.sidebar-home.active { background: transparent; }
.sidebar-home.active:hover { color: var(--ink); }
.sidebar-link.active {
  background: var(--yellow-soft);
  color: var(--ink);
  font-weight: 600;
}
.sidebar-link.active::before { opacity: 1; transform: translateY(-50%) scale(1); }

.sidebar-foot {
  margin-top: 26px;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted);
}
.sidebar-foot p { margin: 0 0 8px; }
.sidebar-update {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--border-strong);
}

.sidebar-overlay {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(15, 18, 16, 0.48);
  z-index: 85;
  opacity: 0;
  transition: opacity 220ms ease;
}
.sidebar-overlay.visible { opacity: 1; }

.mobile-search { display: none; }

/* ==========================================================================
   Main + footer
   ========================================================================== */

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

#content {
  max-width: 980px;
  margin: 0 auto;
}

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

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

.app-footer {
  margin-left: var(--sidebar-w);
  background: #151816;
  color: #c9cec8;
  padding: 40px 48px 34px;
}
.footer-inner {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px 40px;
  align-items: start;
}
.footer-brand { display: flex; gap: 12px; align-items: center; }
.footer-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: #151816;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  border-radius: 4px;
}
.footer-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #f2f4ef;
  letter-spacing: -0.015em;
}
.footer-desc { margin: 2px 0 0; font-size: 0.82rem; color: #a7afa7; }
.footer-note {
  grid-column: 1 / -1;
  margin: 0;
  max-width: 76ch;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #a7afa7;
}
.footer-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid #2b302b;
  font-family: var(--font-display);
  font-size: 0.83rem;
}
.footer-links a { color: var(--yellow); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-copy {
  grid-column: 1 / -1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7d857d;
}

/* ==========================================================================
   Home: hero + register index
   ========================================================================== */

.home-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 448px;
  margin-bottom: 48px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #151816;
  isolation: isolate;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
  z-index: -2;
  animation: heroIn 1.5s var(--ease-out) both;
}

@keyframes heroIn {
  from { transform: scale(1.045); opacity: 0.65; }
  to { transform: scale(1); opacity: 1; }
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(96deg, rgba(13, 15, 14, 0.96) 0%, rgba(13, 15, 14, 0.88) 40%, rgba(13, 15, 14, 0.42) 72%, rgba(13, 15, 14, 0.12) 100%);
}

.hero-copy {
  max-width: 640px;
  padding: 46px 42px;
}

.hero-copy p.hero-brand {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 4.6vw, 3.65rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.94;
  color: var(--yellow);
  max-width: none;
}

.hero-copy p.hero-brand::after {
  content: '';
  display: block;
  width: 46px;
  height: 3px;
  margin-top: 16px;
  background: var(--yellow);
  opacity: 0.55;
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 2.55vw, 2.25rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.022em;
  color: #ffffff;
  max-width: 21ch;
}

.hero-copy p {
  margin: 0 0 26px;
  max-width: 46ch;
  font-size: 1.03rem;
  line-height: 1.6;
  color: #d5dbd3;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  background: var(--yellow);
  color: #151816;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms var(--ease-out);
}
.hero-cta:hover { background: var(--yellow-bright); transform: translateY(-1px); }
.hero-cta:active { transform: scale(0.98); }
.hero-cta span { font-family: var(--font-mono); font-weight: 500; transition: transform 160ms var(--ease-out); }
.hero-cta:hover span { transform: translateX(3px); }

.home-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin: 0 0 34px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.home-intro p {
  margin: 0;
  max-width: 62ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.home-intro span {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-section { margin-bottom: 46px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--ink);
}
.section-mark { width: 10px; height: 10px; background: var(--yellow); flex: none; }
.section-head h2 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 700;
  letter-spacing: -0.018em;
}
.section-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.index-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 20px;
  align-items: center;
  padding: 17px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 180ms ease, padding 180ms var(--ease-out);
}
.index-row:hover, .index-row:focus-visible {
  background: linear-gradient(90deg, var(--yellow-soft), transparent 78%);
  padding-left: 12px;
}
.index-row h3 {
  margin: 0 0 3px;
  font-size: 1.01rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  line-height: 1.3;
}
.index-row p {
  margin: 0;
  max-width: 76ch;
  font-size: 0.91rem;
  line-height: 1.5;
  color: var(--muted);
}
.row-arrow {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--ink);
  opacity: 0.3;
  transition: transform 180ms var(--ease-out), opacity 180ms ease;
}
.index-row:hover .row-arrow, .index-row:focus-visible .row-arrow { transform: translateX(4px); opacity: 1; }

/* ==========================================================================
   Article
   ========================================================================== */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb .sep { color: var(--border-strong); }

.article-head { margin-bottom: 26px; }

.article-head h1 {
  margin: 0 0 18px;
  max-width: 24ch;
  font-size: clamp(1.9rem, 3.8vw, 2.85rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.article-doc {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 20px;
  padding: 10px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.article-doc span { display: inline-flex; align-items: center; gap: 7px; }
.article-doc span::before { content: ""; width: 5px; height: 5px; background: var(--yellow); flex: none; }

.article-toc {
  margin: 0 0 34px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--border);
}
.toc-title {
  margin: 0 0 9px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 34px;
}
.toc-list li { margin: 0 0 5px; break-inside: avoid; }
.toc-list a {
  display: flex;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink-soft);
  text-decoration: none;
}
.toc-list a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.toc-num { font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted); padding-top: 2px; }

.article-body {
  max-width: 72ch;
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--ink);
}
.article-body > p:first-child {
  font-size: 1.1rem;
  line-height: 1.68;
  color: var(--ink-soft);
}
.article-body p { margin: 0 0 1.1em; }
.article-body h2 {
  margin: 2.3em 0 0.65em;
  padding-top: 0.55em;
  border-top: 1px solid var(--border);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.018em;
}
.article-body h3 {
  margin: 1.8em 0 0.5em;
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.008em;
}
.article-body h2:first-child, .article-body h3:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 1.25em; }
.article-body li { margin: 0 0 0.42em; padding-left: 0.15em; }
.article-body ul li::marker { color: var(--yellow-strong); }
.article-body ol li::marker { font-family: var(--font-mono); font-size: 0.86em; color: var(--muted); }
.article-body strong { font-weight: 600; }
.article-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--yellow-strong); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.article-body a:hover { background: var(--yellow-soft); }

.article-body blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--yellow);
  font-size: 1.05rem;
  color: var(--ink-soft);
}
.article-body blockquote p:last-child { margin-bottom: 0; }

/* Boxes - full borders, no side stripes */
.info-box, .tip-box, .warning-box {
  margin: 1.6em 0;
  padding: 17px 19px;
  border: 1px solid;
  border-radius: 3px;
  font-size: 0.96rem;
  line-height: 1.62;
}
.info-box { background: var(--yellow-soft); border-color: var(--yellow-line); color: var(--ink); }
.tip-box { background: var(--green-soft); border-color: var(--green-line); color: var(--ink); }
.warning-box { background: var(--red-soft); border-color: var(--red-line); color: #5a1a15; }
.info-box p:last-child, .tip-box p:last-child, .warning-box p:last-child { margin-bottom: 0; }
.info-box strong:first-child, .tip-box strong:first-child, .warning-box strong:first-child { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* Tables */
.table-responsive { margin: 1.6em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.5;
}
th {
  padding: 10px 12px;
  background: var(--ink);
  color: #f6f1dc;
  border: 1px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}
td { padding: 10px 12px; border: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--surface-2); }

/* FAQ */
.faq-item { border-top: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-item summary {
  position: relative;
  padding: 15px 34px 15px 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-size: 1.01rem;
  font-weight: 600;
  line-height: 1.4;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  top: 12px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--yellow-strong);
}
.faq-item[open] summary::after { content: "-"; }
.faq-item p { margin: 0; padding: 0 0 17px; max-width: 68ch; font-size: 0.97rem; line-height: 1.66; color: var(--ink-soft); }

/* FAQ as plain divs (subagent output) */
div.faq-item { padding: 17px 0 3px; border-top: 1px solid var(--border); }
div.faq-item h3 {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 1.01rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
div.faq-item h3::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  vertical-align: 2px;
  background: var(--yellow-strong);
}
div.faq-item p { padding-bottom: 14px; }

/* Glossary */
.glossary { margin: 1.5em 0; }
.glossary dt {
  margin-top: 15px;
  padding-top: 11px;
  border-top: 1px solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}
.glossary dd {
  margin: 4px 0 0;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
  font-size: 0.96rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

/* Article navigation */
.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 48px;
  background: var(--border);
  border: 1px solid var(--border);
}
.article-nav a {
  display: block;
  padding: 17px 19px;
  background: var(--surface);
  text-decoration: none;
  transition: background 160ms ease;
}
.article-nav a:hover { background: var(--yellow-soft); }
.article-nav .nav-label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.article-nav .nav-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.35;
}
.article-nav .next { text-align: right; }

/* Static pages (about, privacy, contact) */
.static-body { max-width: 74ch; }
.static-body h2 { margin-top: 2.1em; }
.static-body h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

.contact-block {
  margin: 1.6em 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
}
.contact-block .contact-label {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-block a {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
}

.noscript { padding: 24px; border: 1px solid var(--red-line); background: var(--red-soft); color: #5a1a15; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  :root { --sidebar-w: 268px; }
  .main { padding: 34px 34px 68px; }
  .app-footer { padding: 36px 34px 30px; }
  .hero-copy { padding: 40px 34px; }
}

@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .brand-tag { display: none; }
  .search-box { width: 250px; max-width: 38vw; }

  .sidebar {
    width: 306px;
    transform: translateX(-100%);
    transition: transform 260ms var(--ease-drawer);
    box-shadow: 12px 0 30px -18px rgba(15, 18, 16, 0.4);
    padding-top: 14px;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-close {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .sidebar-close:hover { color: var(--ink); }

  .main { margin-left: 0; padding: 30px 26px 60px; }
  .app-footer { margin-left: 0; padding: 34px 26px 28px; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-copy { padding: 36px 28px; }
  .home-hero { min-height: 410px; }
  .home-hero .hero-copy h1 { max-width: 20ch; }
  .toc-list { columns: 1; }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav .next { text-align: left; }
}

@media (max-width: 600px) {
  :root { --header-h: 60px; }
  .header-inner { gap: 10px; padding: 0 14px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .brand-text { font-size: 1.18rem; }
  .search-box { display: none; }

  .sidebar { width: min(86vw, 330px); }
  .mobile-search { display: block; position: relative; margin: 0 0 16px; }
  .mobile-search input { width: 100%; height: 40px; padding: 0 12px 0 35px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); color: var(--ink); font-family: var(--font-display); font-size: 0.9rem; }
  .mobile-search .search-icon { left: 11px; }
  .mobile-search .search-results { top: calc(100% + 4px); }

  .main { padding: 22px 16px 48px; }
  .app-footer { padding: 28px 18px 24px; }
  .home-hero { min-height: 392px; margin-bottom: 34px; }
  .hero-copy { padding: 28px 20px; }
  .hero-brand { font-size: 1.75rem; margin-bottom: 10px; }
  .hero-copy h1 { font-size: 1.86rem; letter-spacing: -0.028em; }
  .hero-copy p { font-size: 0.97rem; margin-bottom: 20px; }
  .hero-cta { width: 100%; justify-content: center; }

  .home-intro { margin-bottom: 26px; }
  .home-section { margin-bottom: 36px; }
  .section-head h2 { font-size: 1.2rem; }
  .index-row { grid-template-columns: minmax(0, 1fr) 18px; gap: 10px; padding: 14px 2px; }
  .index-row:hover, .index-row:focus-visible { padding-left: 8px; }
  .index-row h3 { font-size: 0.97rem; }
  .index-row p { font-size: 0.86rem; }

  .article-head h1 { font-size: 1.72rem; max-width: none; }
  .article-doc { gap: 7px 14px; font-size: 0.6rem; }
  .article-body { font-size: 1rem; line-height: 1.68; }
  .article-body > p:first-child { font-size: 1.03rem; }
  .article-body h2 { font-size: 1.3rem; }
  .article-body h3 { font-size: 1.06rem; }
  .info-box, .tip-box, .warning-box { padding: 14px 15px; font-size: 0.93rem; }
  table { font-size: 0.84rem; }
  th, td { padding: 8px 9px; }

  .footer-copy { font-size: 0.6rem; }
}

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

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111412;
    --surface: #171b18;
    --surface-2: #1e231f;
    --ink: #ecefe9;
    --ink-soft: #d3dad2;
    --muted: #a7afa7;
    --border: #2c332d;
    --border-strong: #3b443c;
    --yellow: #f5c518;
    --yellow-bright: #ffd43b;
    --yellow-strong: #f5c518;
    --yellow-soft: #2a2410;
    --yellow-line: #4a3d12;
    --red: #f2b8b5;
    --red-soft: #2a1513;
    --red-line: #5a2a26;
    --green: #9ccbaf;
    --green-soft: #12251a;
    --green-line: #2e4a38;
  }

  body {
    background-image:
      radial-gradient(900px 520px at 96% -8%, rgba(245, 197, 24, 0.06), transparent 70%),
      radial-gradient(720px 420px at -5% 102%, rgba(255, 255, 255, 0.025), transparent 70%);
  }

  .brand-mark { color: #151816; }
  .hero-cta { color: #151816; }
  .search-result:hover, .search-result:focus-visible { background: #262b22; }
  .index-row:hover, .index-row:focus-visible {
    background: linear-gradient(90deg, rgba(245, 197, 24, 0.1), transparent 78%);
  }
  .sidebar-link { color: #c6cec6; }
  .sidebar-link:hover { background: #202621; }
  .sidebar-link.active { background: #2a2410; color: #f2f4ef; }
  .article-body > p:first-child { color: #dde3db; }
  .article-body a:hover { background: #2a2410; }
  .warning-box { color: #f2c3bf; }
  th { background: #0c0f0d; color: #f5c518; border-color: #2c332d; }
  tbody tr:nth-child(even) { background: #1a1f1b; }
  .contact-block { background: #171b18; }
  .app-footer { background: #0b0e0c; }
  .footer-links { border-top-color: #2b302b; }
  .noscript { color: #f2c3bf; }
}

/* Print */
@media print {
  .app-header, .sidebar, .app-footer, .article-nav, .article-toc, #vd-cookie-bar, .skip-link { display: none !important; }
  .main { margin: 0; padding: 0; }
  .article-body { max-width: none; font-size: 11pt; }
  a { text-decoration: none; }
}
