/* ============================================================
   Import z Chin - design system
   Palette: port navy, cargo rust, signal amber, paper
   Type: Archivo (UI/display) + Source Serif 4 (reading)
   ============================================================ */

:root {
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --ink: #0c1c26;
  --ink-2: #132a35;
  --ink-3: #1b3742;
  --paper: #f2f4ef;
  --surface: #ffffff;
  --surface-2: #e9ede6;
  --text: #182a31;
  --muted: #52646a;
  --muted-2: #6e807f;
  --border: #d5dcd4;
  --border-strong: #b9c4bb;

  --rust: #b23a1b;
  --rust-hover: #932d12;
  --rust-soft: #f3e2db;
  --amber: #d9a03f;
  --amber-soft: #f4ead3;
  --teal: #1d6663;
  --teal-soft: #e4efec;

  --on-dark: #eef2ee;
  --on-dark-muted: #a9bcb7;
  --on-dark-dim: #7f958f;

  --info-bg: #e9f1ef;
  --info-border: #bfd5cf;
  --tip-bg: #edf3e2;
  --tip-border: #cadbb0;
  --warn-bg: #f7e9e3;
  --warn-border: #dfbcae;
  --note-bg: #edeee8;
  --note-border: #cfd4c8;

  --radius: 8px;
  --radius-sm: 4px;
  --header-h: 68px;
  --sidebar-w: 292px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1418;
    --surface: #121e23;
    --surface-2: #17262c;
    --text: #e6ece9;
    --muted: #a3b3ae;
    --muted-2: #8b9d98;
    --border: #24343a;
    --border-strong: #35484e;
    --rust: #e0704f;
    --rust-hover: #ef8a6b;
    --rust-soft: #2e1712;
    --amber: #e3b05a;
    --amber-soft: #2c2413;
    --teal: #6fbdb5;
    --teal-soft: #102a28;
    --info-bg: #102522;
    --info-border: #24463f;
    --tip-bg: #1d2614;
    --tip-border: #3b4d27;
    --warn-bg: #2a1713;
    --warn-border: #533228;
    --note-bg: #182126;
    --note-border: #2c3d43;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 18px);
}

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

body.menu-open { overflow: hidden; }

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

a { color: var(--rust); text-underline-offset: 3px; }
a:hover { color: var(--rust-hover); }

img { max-width: 100%; display: block; }

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

.skip-link {
  position: absolute; top: -60px; left: 16px; z-index: 400;
  background: var(--amber); color: var(--ink);
  padding: 10px 16px; font-family: var(--font-display); font-size: .85rem;
  text-decoration: none; border-radius: var(--radius-sm);
  transition: top .18s var(--ease-out);
}
.skip-link:focus { top: 10px; }

/* ---------- Header ---------- */

.app-header {
  position: fixed; inset: 0 0 auto 0; z-index: 130;
  height: var(--header-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px;
  background: var(--ink);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--on-dark); text-decoration: none; flex-shrink: 0;
}
.brand:hover { color: #fff; }
.brand-mark { width: 30px; height: 30px; color: var(--amber); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  letter-spacing: -.015em;
}
.brand-sub {
  font-family: var(--font-mono); font-size: .6rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--on-dark-dim); margin-top: 4px;
}

.menu-toggle {
  display: none; width: 42px; height: 42px; padding: 0;
  background: transparent; border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--radius-sm); cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.menu-toggle span {
  display: block; width: 18px; height: 2px; background: var(--on-dark);
  transition: transform .2s var(--ease-out), opacity .2s var(--ease-out);
}
body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.search-box { margin-left: auto; position: relative; width: min(340px, 38vw); }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; fill: none; stroke: var(--on-dark-dim);
  stroke-width: 1.8; stroke-linecap: round; pointer-events: none;
}
#searchInput {
  width: 100%; padding: 9px 12px 9px 37px;
  background: #142832; color: var(--on-dark);
  border: 1px solid #2a414a; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: .86rem;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
#searchInput::placeholder { color: #829691; }
#searchInput:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 160, 63, .16);
}
#searchInput::-webkit-search-cancel-button { filter: invert(.7); }

.search-results {
  position: absolute; top: calc(100% + 9px); left: 0; right: 0;
  max-height: 64vh; overflow-y: auto;
  background: #10232c; border: 1px solid #2a414a; border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  z-index: 200;
}
.search-item {
  display: block; padding: 11px 14px; text-decoration: none;
  border-bottom: 1px solid #1e333c; color: var(--on-dark);
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover, .search-item:focus { background: #17323d; color: #fff; }
.search-item strong {
  display: block; font-family: var(--font-display); font-size: .86rem;
  font-weight: 600; line-height: 1.35;
}
.search-item span {
  display: block; font-family: var(--font-mono); font-size: .66rem;
  color: var(--on-dark-dim); margin-top: 3px; letter-spacing: .04em;
}
.search-item.is-active { background: #17323d; }
.search-empty {
  padding: 16px; font-family: var(--font-display); font-size: .84rem;
  color: var(--on-dark-muted);
}

.read-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  background: var(--rust); transform: scaleX(0); transform-origin: 0 50%;
  opacity: 0; transition: opacity .2s;
}
.read-progress.active { opacity: 1; }

/* ---------- Layout ---------- */

.layout { padding-top: var(--header-h); }

.sidebar {
  position: fixed; top: var(--header-h); bottom: 0; left: 0;
  width: var(--sidebar-w); z-index: 80;
  background: var(--ink); border-right: 1px solid #1e333c;
  padding: 20px 14px 30px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #2c444d transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c444d; border-radius: 4px; }

.nav-section {
  margin-top: 24px; padding-top: 15px;
  border-top: 1px solid #1a2f37;
}
.nav-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.nav-section h3 {
  margin: 0 0 9px; padding: 0 10px;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase; color: var(--amber);
}
.sidebar-link {
  display: block; padding: 7px 10px; margin: 1px 0;
  font-family: var(--font-display); font-size: .95rem; line-height: 1.36;
  color: #b9cac5; text-decoration: none; border-radius: var(--radius-sm);
  transition: color .16s var(--ease-out), background .16s var(--ease-out), transform .16s var(--ease-out);
}
.sidebar-link:hover {
  color: #fff; background: rgba(255, 255, 255, .055); transform: translateX(2px);
}
.sidebar-link.active {
  color: #fff; background: rgba(178, 58, 27, .3); font-weight: 600;
}
.sidebar-foot {
  margin: 32px 6px 0; padding: 16px 4px 0;
  border-top: 1px solid #1e333c;
}
.sidebar-foot p {
  margin: 0; font-family: var(--font-display); font-size: .74rem;
  line-height: 1.5; color: var(--on-dark-dim);
}
.sidebar-foot-meta {
  margin-top: 7px !important; font-family: var(--font-mono) !important;
  font-size: .62rem !important; letter-spacing: .1em; text-transform: uppercase;
}

.sidebar-overlay {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 70;
  background: rgba(6, 16, 22, .55);
  opacity: 0; transition: opacity .24s var(--ease-out);
}
.sidebar-overlay.visible { opacity: 1; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  background: var(--paper);
}

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

.home-hero {
  position: relative; min-height: 432px; display: flex; align-items: flex-end;
  overflow: hidden; background: var(--ink);
  border-bottom: 1px solid var(--border);
}
.home-hero img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 42%;
  animation: heroZoom 1.7s var(--ease-out) both;
}
.home-hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 18, 25, .95) 0%, rgba(6, 18, 25, .82) 40%, rgba(6, 18, 25, .22) 100%),
    linear-gradient(0deg, rgba(6, 18, 25, .8) 0%, rgba(6, 18, 25, 0) 55%);
}
.hero-inner {
  position: relative; z-index: 2; width: 100%;
  padding: 54px 54px 50px; max-width: 820px;
}
.hero-inner h1 {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.4vw, 3.85rem); font-weight: 800;
  line-height: 1.02; letter-spacing: -.035em; color: #fff;
  text-wrap: balance;
}
.hero-inner p {
  margin: 17px 0 0; max-width: 53ch;
  font-family: var(--font-body); font-size: 1.12rem; line-height: 1.6;
  color: #d5dfdb;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 27px; padding: 12px 19px;
  background: var(--rust); color: #fff; text-decoration: none;
  font-family: var(--font-display); font-size: .9rem; font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
.hero-cta span { transition: transform .18s var(--ease-out); }
.hero-cta:hover { background: #c94725; color: #fff; transform: translateY(-1px); }
.hero-cta:hover span { transform: translateX(3px); }
.hero-cta:active { transform: scale(.98); }
.hero-credit {
  position: absolute; right: 14px; bottom: 9px; z-index: 3;
  font-family: var(--font-mono); font-size: .58rem; letter-spacing: .03em;
  color: rgba(255, 255, 255, .5);
}

@keyframes heroZoom {
  from { transform: scale(1.045); }
  to { transform: scale(1); }
}

/* ---------- Home body ---------- */

.home-wrap { max-width: 1120px; margin: 0 auto; padding: 0 54px 76px; }

.home-intro {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  padding: 30px 0 0;
}
.home-intro p {
  margin: 0; max-width: 62ch; font-size: 1.02rem; line-height: 1.6;
  color: var(--muted);
}
.home-intro .stamp {
  flex-shrink: 0; font-family: var(--font-mono); font-size: .66rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2);
  padding-bottom: 4px;
}

.start-here {
  margin-top: 34px; padding: 22px 24px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section-rule {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  border-bottom: 2px solid var(--ink); padding-bottom: 9px;
}
.section-rule h2 {
  margin: 0; font-family: var(--font-display); font-size: 1.32rem;
  font-weight: 700; letter-spacing: -.02em;
}
.section-rule span {
  font-family: var(--font-mono); font-size: .68rem; color: var(--muted-2);
  letter-spacing: .06em;
}
.section-desc {
  margin: 10px 0 2px; font-size: .93rem; color: var(--muted); max-width: 64ch;
}

.start-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.start-here .start-grid { border-bottom: 0; }
.start-link {
  display: block; padding: 17px 20px 18px 0; text-decoration: none; color: var(--text);
  border-top: 1px solid var(--border);
  transition: color .16s var(--ease-out);
}
.start-link + .start-link { padding-left: 20px; border-left: 1px solid var(--border); }
.start-link .kicker {
  display: block; font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--rust);
  margin-bottom: 6px;
}
.start-link strong {
  display: block; font-family: var(--font-display); font-size: 1rem;
  font-weight: 600; line-height: 1.35; letter-spacing: -.01em;
}
.start-link em {
  display: block; font-style: normal; font-size: .85rem; color: var(--muted);
  margin-top: 4px; line-height: 1.45;
}
.start-link:hover strong { color: var(--rust); }
.start-link:hover .kicker { color: var(--rust-hover); }

.browse-section { margin-top: 46px; }
.article-list { border-bottom: 1px solid var(--border); }
.article-row {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 22px;
  gap: 14px; align-items: start;
  padding: 14px 4px 15px; text-decoration: none; color: var(--text);
  border-top: 1px solid var(--border);
  transition: background .18s var(--ease-out), padding-left .18s var(--ease-out);
}
.article-row:hover { background: var(--surface-2); color: var(--text); padding-left: 10px; }
.row-num {
  font-family: var(--font-mono); font-size: .68rem; color: var(--muted-2);
  padding-top: 4px; letter-spacing: .02em;
}
.row-title {
  display: block; font-family: var(--font-display); font-size: 1.02rem;
  font-weight: 600; line-height: 1.38; letter-spacing: -.012em;
  transition: color .16s var(--ease-out);
}
.article-row:hover .row-title { color: var(--rust); }
.row-excerpt {
  display: block; font-family: var(--font-body); font-size: .92rem;
  line-height: 1.5; color: var(--muted); margin-top: 3px; max-width: 74ch;
}
.row-arrow {
  font-family: var(--font-display); font-size: 1rem; color: var(--rust);
  opacity: 0; transform: translateX(-5px); padding-top: 1px;
  transition: opacity .18s var(--ease-out), transform .18s var(--ease-out);
}
.article-row:hover .row-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Article ---------- */

.article-wrap { max-width: 1120px; margin: 0 auto; padding: 32px 54px 72px; }

.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-family: var(--font-display); font-size: .78rem; color: var(--muted);
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--rust); text-decoration: underline; }
.breadcrumbs .sep { color: var(--border-strong); }

.article-header { margin-top: 20px; max-width: 880px; }
.article-header h1 {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(1.95rem, 3.5vw, 3rem); font-weight: 800;
  line-height: 1.07; letter-spacing: -.032em; color: var(--text);
  text-wrap: balance;
}
.article-lead {
  margin: 16px 0 0; max-width: 66ch;
  font-family: var(--font-body); font-size: 1.16rem; line-height: 1.62;
  color: var(--muted);
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 16px;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-2);
}
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-meta span + span::before {
  content: "/"; color: var(--border-strong); margin-right: 6px;
}

.toc {
  margin: 30px 0 6px; padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 16px;
}
.toc-label {
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--rust); padding-top: 2px;
}
.toc-links {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 26px; counter-reset: toc;
}
.toc-links a {
  display: flex; gap: 8px; align-items: baseline;
  font-family: var(--font-display); font-size: .82rem; line-height: 1.4;
  color: var(--text); text-decoration: none; counter-increment: toc;
}
.toc-links a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono); font-size: .6rem; color: var(--muted-2);
  flex-shrink: 0;
}
.toc-links a:hover { color: var(--rust); }

.content-article {
  max-width: 762px; margin-top: 30px;
  font-size: 1.08rem; line-height: 1.72;
}
.content-article > p:first-child { margin-top: 0; }
.content-article p { margin: 0 0 1.2em; }
.content-article h2 {
  margin: 2.3em 0 .55em; padding-top: .7em;
  border-top: 1px solid var(--border);
  font-family: var(--font-display); font-size: 1.52rem; font-weight: 700;
  line-height: 1.22; letter-spacing: -.022em; color: var(--text);
  text-wrap: balance;
}
.content-article h3 {
  margin: 1.7em 0 .4em;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  line-height: 1.35; letter-spacing: -.01em;
}
.content-article ul, .content-article ol { margin: 0 0 1.25em; padding-left: 1.25em; }
.content-article li { margin: .38em 0; }
.content-article li::marker { color: var(--rust); }
.content-article strong { font-weight: 600; }
.content-article a { color: var(--rust); text-decoration-thickness: 1px; }
.content-article a:hover { color: var(--rust-hover); }
.content-article blockquote {
  margin: 1.7em 0; padding: .8em 0 .9em 1.2em;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  font-style: italic; font-size: 1.1rem; line-height: 1.6; color: var(--muted);
}
.content-article blockquote p:last-child { margin-bottom: 0; }
.content-article hr {
  border: 0; border-top: 1px solid var(--border); margin: 2em 0;
}

.content-article .info-box,
.content-article .tip-box,
.content-article .warning-box,
.content-article .key-takeaways {
  margin: 1.55em 0; padding: 16px 19px;
  border: 1px solid; border-radius: var(--radius);
  font-family: var(--font-display); font-size: .91rem; line-height: 1.6;
  color: var(--text);
}
.content-article .info-box { background: var(--info-bg); border-color: var(--info-border); }
.content-article .tip-box { background: var(--tip-bg); border-color: var(--tip-border); }
.content-article .warning-box { background: var(--warn-bg); border-color: var(--warn-border); }
.content-article .key-takeaways { background: var(--note-bg); border-color: var(--note-border); }
.content-article .info-box p:last-child,
.content-article .tip-box p:last-child,
.content-article .warning-box p:last-child,
.content-article .key-takeaways p:last-child { margin-bottom: 0; }
.content-article .info-box strong:first-child,
.content-article .tip-box strong:first-child,
.content-article .warning-box strong:first-child,
.content-article .key-takeaways strong:first-child {
  display: block; margin-bottom: 5px; font-weight: 700;
}

.content-article table {
  width: 100%; margin: 1.55em 0; border-collapse: collapse;
  border: 1px solid var(--border-strong);
  font-family: var(--font-display); font-size: .86rem; line-height: 1.5;
}
.content-article thead { background: var(--ink); color: #fff; }
.content-article th {
  padding: 9px 11px; text-align: left; font-weight: 600;
  font-size: .78rem; letter-spacing: .02em; vertical-align: bottom;
}
.content-article td {
  padding: 9px 11px; border-top: 1px solid var(--border); vertical-align: top;
}
.content-article tbody tr:nth-child(even) { background: var(--surface-2); }
.content-article table caption {
  caption-side: bottom; padding-top: 8px;
  font-family: var(--font-mono); font-size: .66rem; color: var(--muted-2);
  text-align: left;
}

.content-article .faq-item {
  padding: 19px 0; border-top: 1px solid var(--border);
}
.content-article .faq-item:last-child { border-bottom: 1px solid var(--border); }
.content-article .faq-item h3 {
  margin: 0; font-family: var(--font-display); font-size: 1.02rem;
  font-weight: 700; line-height: 1.4;
}
.content-article .faq-item p { margin: .45em 0 0; font-size: 1rem; color: var(--muted); }
.content-article details.faq-item summary {
  cursor: pointer; font-family: var(--font-display); font-weight: 700;
  font-size: 1.02rem; list-style: none;
}
.content-article details.faq-item summary::-webkit-details-marker { display: none; }
.content-article details.faq-item summary::after {
  content: "+"; float: right; color: var(--rust); font-size: 1.1rem;
}
.content-article details.faq-item[open] summary::after { content: "-"; }

.content-article dl.glossary { margin: 1.4em 0; }
.content-article dl.glossary dt {
  margin-top: 15px; font-family: var(--font-display);
  font-size: .98rem; font-weight: 700; color: var(--text);
}
.content-article dl.glossary dd {
  margin: 2px 0 0; font-size: 1rem; color: var(--muted);
}

.article-foot {
  max-width: 762px; margin-top: 34px; padding: 15px 18px;
  background: var(--surface-2); border-radius: var(--radius);
  font-family: var(--font-display); font-size: .8rem; line-height: 1.55;
  color: var(--muted);
}
.article-foot a { color: var(--rust); }

.article-nav {
  max-width: 762px; margin-top: 46px; padding-top: 20px;
  border-top: 2px solid var(--ink);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px;
}
.article-nav a { display: block; text-decoration: none; color: var(--text); }
.article-nav .label {
  display: block; font-family: var(--font-mono); font-size: .6rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2);
  margin-bottom: 5px;
}
.article-nav .title {
  font-family: var(--font-display); font-size: .96rem; font-weight: 600;
  line-height: 1.4; transition: color .16s var(--ease-out);
}
.article-nav a:hover .title { color: var(--rust); }
.article-nav .next { text-align: right; }

.not-found { max-width: 640px; margin: 0 auto; padding: 90px 54px; }
.not-found h1 {
  font-family: var(--font-display); font-size: 2.2rem; letter-spacing: -.03em;
  margin: 0 0 12px;
}
.not-found p { color: var(--muted); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 70px; background: var(--ink); color: var(--on-dark);
  padding: 38px 54px 26px;
}
.footer-inner {
  max-width: 1120px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px 40px;
  align-items: start;
}
.footer-brand { display: flex; gap: 13px; align-items: flex-start; }
.footer-mark {
  width: 24px; height: 24px; flex-shrink: 0; margin-top: 2px; border-radius: 3px;
  background:
    linear-gradient(var(--amber), var(--amber)) 0 0 / 100% 6px no-repeat,
    linear-gradient(#b23a1b, #b23a1b) 0 9px / 62% 6px no-repeat,
    linear-gradient(#e8ece7, #e8ece7) 0 18px / 82% 6px no-repeat;
}
.footer-brand strong {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
}
.footer-brand p {
  margin: 4px 0 0; font-family: var(--font-display); font-size: .8rem;
  line-height: 1.5; color: var(--on-dark-muted); max-width: 46ch;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 3px; }
.footer-nav a {
  font-family: var(--font-display); font-size: .8rem; color: #c9d6d2;
  text-decoration: none;
}
.footer-nav a:hover { color: var(--amber); text-decoration: underline; }
.footer-credit {
  grid-column: 1 / -1; margin: 8px 0 0; padding-top: 15px;
  border-top: 1px solid #1e333c;
  font-family: var(--font-mono); font-size: .62rem; line-height: 1.65;
  color: var(--on-dark-dim);
}

/* ---------- Cookie bar ---------- */

.vd-cookie-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 300;
  display: flex; justify-content: center; pointer-events: none;
}
.vd-cookie-inner {
  pointer-events: auto; width: 100%; max-width: 820px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 18px;
  background: #0f232c; color: #e8eeea;
  border: 1px solid #2a414a; border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
.vd-cookie-inner p {
  margin: 0; font-family: var(--font-display); font-size: .8rem;
  line-height: 1.55; color: #cdd9d5;
}
.vd-cookie-inner a { color: var(--amber); }
.vd-cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: background .16s var(--ease-out), border-color .16s var(--ease-out), transform .16s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: #c94725; }
.btn-ghost { background: transparent; color: #dbe5e0; border-color: #3a525b; }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); border-color: #56707a; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  :root { --sidebar-w: 268px; }
  .hero-inner { padding: 46px 40px 44px; }
  .home-wrap { padding: 0 40px 66px; }
  .article-wrap { padding: 30px 40px 64px; }
  .site-footer { padding: 34px 40px 24px; }
}

@media (max-width: 980px) {
  :root { --sidebar-w: 288px; }
  .menu-toggle { display: flex; }
  .sidebar {
    top: 0; z-index: 120; padding-top: calc(var(--header-h) + 16px);
    transform: translateX(-100%);
    transition: transform .26s var(--ease-drawer);
    box-shadow: 12px 0 40px rgba(0, 0, 0, .25);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .vd-cookie-bar { display: none !important; }
  .sidebar-overlay { z-index: 110; }
  .main { margin-left: 0; }
  .brand { margin-right: auto; }
  .search-box { width: min(300px, 40vw); }
  .hero-inner { padding: 42px 34px 40px; }
  .hero-inner h1 { font-size: clamp(2.1rem, 5.2vw, 3.1rem); }
  .home-wrap { padding: 0 34px 60px; }
  .article-wrap { padding: 28px 34px 58px; }
  .site-footer { padding: 32px 34px 22px; }
}

@media (max-width: 720px) {
  :root { --header-h: 106px; }
  .app-header {
    display: grid; grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: 54px 46px; align-content: center;
    padding: 0 14px 6px; gap: 0 10px;
  }
  .menu-toggle { grid-column: 1; grid-row: 1; }
  .brand { grid-column: 2; grid-row: 1; margin-right: 0; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-name { font-size: 1.02rem; }
  .brand-sub { font-size: .55rem; }
  .search-box {
    grid-column: 1 / -1; grid-row: 2; width: 100%; margin: 0;
  }
  #searchInput { padding-top: 8px; padding-bottom: 8px; }
  .sidebar { padding-top: calc(var(--header-h) + 14px); }
  .sidebar-overlay { inset: var(--header-h) 0 0 0; }

  .home-hero { min-height: 372px; }
  .hero-inner { padding: 28px 20px 30px; }
  .hero-inner h1 { font-size: 2.02rem; line-height: 1.04; }
  .hero-inner p { font-size: 1rem; margin-top: 13px; max-width: 40ch; }
  .hero-cta { margin-top: 21px; padding: 11px 16px; font-size: .85rem; }
  .hero-credit { display: none; }

  .home-wrap { padding: 0 18px 52px; }
  .home-intro { display: block; padding-top: 24px; }
  .home-intro .stamp { margin-top: 9px; }
  .home-intro p { font-size: .97rem; }
  .start-here { margin-top: 30px; }
  .start-grid { grid-template-columns: 1fr; }
  .start-link { padding: 14px 0; }
  .start-link + .start-link { padding-left: 0; border-left: 0; }
  .section-rule h2 { font-size: 1.18rem; }
  .article-row { grid-template-columns: 24px minmax(0, 1fr) 16px; gap: 10px; padding: 13px 2px; }
  .row-title { font-size: .97rem; }
  .row-excerpt { font-size: .87rem; }
  .row-arrow { opacity: 1; transform: none; font-size: .9rem; }

  .article-wrap { padding: 22px 18px 50px; }
  .article-header h1 { font-size: 1.82rem; line-height: 1.1; }
  .article-lead { font-size: 1.04rem; }
  .toc { grid-template-columns: 1fr; gap: 10px; }
  .toc-links { grid-template-columns: 1fr; gap: 4px; }
  .content-article { font-size: 1.07rem; margin-top: 24px; }
  .content-article h2 { font-size: 1.32rem; margin-top: 2em; }
  .content-article table {
    display: block; overflow-x: auto; white-space: nowrap;
    font-size: .8rem; border: 0;
  }
  .content-article th, .content-article td { padding: 8px 9px; }
  .content-article .info-box,
  .content-article .tip-box,
  .content-article .warning-box,
  .content-article .key-takeaways { font-size: .88rem; padding: 14px 15px; }
  .article-nav { grid-template-columns: 1fr; gap: 16px; }
  .article-nav .next { text-align: left; }

  .site-footer { padding: 28px 18px 20px; margin-top: 50px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { padding-top: 0; }

  .vd-cookie-bar { left: 10px; right: 10px; bottom: 10px; }
  .vd-cookie-inner { display: block; padding: 15px 16px; }
  .vd-cookie-actions { margin-top: 12px; }
  .btn { flex: 1; padding: 10px 12px; }
}

@media (max-width: 400px) {
  .brand-sub { display: none; }
  .brand-name { font-size: .98rem; }
  .hero-inner h1 { font-size: 1.82rem; }
  .content-article { font-size: 1.07rem; }
}

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