/* ============================================================
   /assets/site.css — 共享外壳与基础组件
   1. Reset  2. Tokens  3. Base type  4. Layout  5. Components
   6. Header  7. Footer  8. Motion & JS hooks  9. Responsive
   ============================================================ */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body,
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }

ul[class], ol[class] { list-style: none; padding: 0; }

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

button { font: inherit; color: inherit; background: none; border: 0; }

a { color: inherit; text-decoration: none; }

[id] { scroll-margin-top: 112px; }

/* ---------- 2. Tokens ---------- */
:root {
  --ink-900: #071426;
  --ink-800: #0D223D;
  --ink-700: #163556;
  --gold-500: #C9A24A;
  --gold-300: #E7C97C;
  --paper: #F5F1E8;
  --celadon-400: #6FBFAD;
  --celadon-600: #2E7D6E;
  --mist-300: #C8D6E5;
  --slate-500: #6E86A6;

  --line: rgba(110, 134, 166, 0.24);
  --line-strong: rgba(110, 134, 166, 0.44);
  --gold-line: rgba(201, 162, 74, 0.44);
  --gold-glow: rgba(201, 162, 74, 0.14);
  --celadon-line: rgba(111, 191, 173, 0.44);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  --page-max: 1280px;
  --gutter: 24px;
  --shell-x: clamp(18px, 4vw, 32px);
  --header-x: clamp(14px, 3.2vw, 28px);

  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-soft: 0 18px 44px rgba(3, 10, 20, 0.46);
  --shadow-gold: 0 14px 32px rgba(201, 162, 74, 0.26);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 3. Base type ---------- */
body {
  min-height: 100vh;
  background-color: var(--ink-900);
  background-image:
    radial-gradient(820px 560px at 8% -8%, rgba(201, 162, 74, 0.16), transparent 62%),
    radial-gradient(680px 520px at 96% 4%, rgba(111, 191, 173, 0.10), transparent 64%),
    repeating-linear-gradient(0deg, rgba(110, 134, 166, 0.06) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(90deg, rgba(110, 134, 166, 0.06) 0 1px, transparent 1px 88px),
    linear-gradient(180deg, #071426 0%, #0A1B30 52%, #071426 100%);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: clamp(16px, 0.55vw + 14px, 17.5px);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 1000px) {
  body {
    background-attachment: fixed, fixed, fixed, fixed, fixed;
  }
}

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.02em;
  color: var(--paper);
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); }
h3 { font-size: clamp(1.12rem, 1.6vw, 1.4rem); letter-spacing: -0.015em; }

p { color: var(--mist-300); }

::selection { background: rgba(201, 162, 74, 0.32); color: var(--paper); }

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

/* ---------- 4. Layout ---------- */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--shell-x);
}

.section { padding-block: clamp(44px, 7vw, 96px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 32px;
  margin-bottom: clamp(22px, 3vw, 36px);
}

.section-title {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section-lede {
  max-width: 58ch;
  font-size: 15.5px;
  color: var(--mist-300);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-300);
}

.mono {
  font-family: var(--font-mono);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.prose p { max-width: 68ch; margin-bottom: 1.1em; }
.prose p:last-child { margin-bottom: 0; }
.prose a {
  color: var(--gold-300);
  border-bottom: 1px solid var(--gold-line);
  transition: border-color 0.2s var(--ease);
}
.prose a:hover { border-bottom-color: var(--gold-300); }

.grid { display: grid; gap: var(--gutter); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1fr) 300px; }

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
}
.bento-cell { grid-column: span 12; min-width: 0; }

/* ---------- 5. Components ---------- */
.card,
.panel {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(22, 53, 86, 0.72), rgba(13, 34, 61, 0.88));
  box-shadow: inset 0 1px 0 rgba(245, 241, 232, 0.05);
}

.card {
  padding: clamp(20px, 2.4vw, 28px);
  transition: transform 0.24s var(--ease), border-color 0.24s var(--ease), box-shadow 0.24s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-line);
  box-shadow: var(--shadow-soft), 0 0 0 1px rgba(201, 162, 74, 0.16);
}

.panel { padding: clamp(18px, 2.2vw, 26px); background: rgba(13, 34, 61, 0.62); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: rgba(22, 53, 86, 0.5);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--mist-300);
  white-space: nowrap;
}

.tag--gold {
  color: var(--gold-300);
  border-color: var(--gold-line);
  background: var(--gold-glow);
}

.tag--live {
  color: var(--celadon-400);
  border-color: var(--celadon-line);
  background: rgba(111, 191, 173, 0.12);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--celadon-400);
  box-shadow: 0 0 0 4px rgba(111, 191, 173, 0.18);
  flex: 0 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 26px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn--gold {
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  color: #071426;
  box-shadow: var(--shadow-gold);
}
.btn--gold:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(201, 162, 74, 0.36); color: #071426; }

.btn--ghost {
  border-color: var(--gold-line);
  background: rgba(201, 162, 74, 0.07);
  color: var(--gold-300);
}
.btn--ghost:hover { background: rgba(201, 162, 74, 0.15); border-color: var(--gold-300); transform: translateY(-2px); color: var(--gold-300); }

.btn--quiet {
  border-color: var(--line-strong);
  background: rgba(22, 53, 86, 0.6);
  color: var(--paper);
}
.btn--quiet:hover { border-color: var(--gold-line); color: var(--gold-300); transform: translateY(-2px); }

.btn--block { display: flex; width: 100%; }

.breadcrumbs { padding-block: 18px 4px; }
.breadcrumb-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--slate-500); }
.breadcrumb-item { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb-link { color: var(--mist-300); transition: color 0.18s var(--ease); }
.breadcrumb-link:hover { color: var(--gold-300); }
.breadcrumb-sep { color: var(--slate-500); font-family: var(--font-mono); }
.breadcrumb-current { color: var(--gold-300); font-weight: 600; }

/* 图片容器基础规则（共享头尾不放图，供页面阶段使用） */
.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(201, 162, 74, 0.16), transparent 60%),
    linear-gradient(150deg, #0D223D, #163556 58%, #0A1B30);
  aspect-ratio: 16 / 10;
}

.media-frame > img,
.media-frame > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--banner { aspect-ratio: 3 / 1; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame--tall { aspect-ratio: 4 / 5; }

.media-frame__caption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: rgba(7, 20, 38, 0.78);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--mist-300);
}

.media-frame--grid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(245, 241, 232, 0.08) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(245, 241, 232, 0.08) 0 1px, transparent 1px 56px);
}

/* 长页目录侧栏 */
.rail { display: grid; gap: 16px; align-content: start; }

.toc {
  position: sticky;
  top: 108px;
  padding: 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: rgba(13, 34, 61, 0.7);
  backdrop-filter: blur(8px);
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-500);
  margin-bottom: 12px;
}

.toc-list { display: grid; gap: 4px; }

.toc-link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: 14px;
  color: var(--mist-300);
  border-left: 2px solid transparent;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.toc-link:hover { color: var(--paper); background: rgba(201, 162, 74, 0.1); }
.toc-link[aria-current="true"] {
  color: #071426;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
}

/* ---------- 6. Header ---------- */
.skip-link {
  position: fixed;
  top: -70px;
  left: 16px;
  z-index: 200;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  background: var(--gold-300);
  color: #071426;
  font-size: 14px;
  font-weight: 700;
  transition: top 0.2s var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible { top: 14px; color: #071426; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  padding: 14px 0 16px;
  background: linear-gradient(180deg, rgba(7, 20, 38, 0.96) 0%, rgba(7, 20, 38, 0.78) 62%, rgba(7, 20, 38, 0) 100%);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--header-x);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 7px 18px 7px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--gold-line);
  background: linear-gradient(140deg, rgba(22, 53, 86, 0.94), rgba(13, 34, 61, 0.9));
  box-shadow: 0 10px 26px rgba(3, 10, 20, 0.42), inset 0 1px 0 rgba(245, 241, 232, 0.06);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.brand:hover { transform: translateY(-1px); border-color: rgba(231, 201, 124, 0.75); color: var(--paper); }

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--gold-300), var(--gold-500) 58%, #8F6F27 100%);
  box-shadow: inset 0 0 0 1px rgba(7, 20, 38, 0.35), 0 6px 16px rgba(201, 162, 74, 0.3);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1.5px solid rgba(7, 20, 38, 0.6);
  border-radius: 4px;
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-12deg);
}
.brand-mark--lg { width: 40px; height: 40px; border-radius: 13px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.16; }
.brand-name { font-size: 16.5px; font-weight: 800; letter-spacing: -0.01em; color: var(--paper); }
.brand-plate {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-300);
  margin-top: 2px;
}

.primary-nav { margin-inline: auto; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(13, 34, 61, 0.74);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(245, 241, 232, 0.05);
}

.nav-item { display: block; }

.nav-link {
  display: block;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--mist-300);
  white-space: nowrap;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-link:hover { color: var(--paper); background: rgba(201, 162, 74, 0.12); }
.nav-link[aria-current="page"] {
  color: #071426;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 8px 18px rgba(201, 162, 74, 0.28);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 700;
  color: #071426;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  box-shadow: 0 10px 24px rgba(201, 162, 74, 0.24);
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.header-cta:hover { transform: translateY(-2px); box-shadow: 0 15px 32px rgba(201, 162, 74, 0.34); color: #071426; }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 10px 16px 10px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(13, 34, 61, 0.86);
  color: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-toggle:hover { border-color: var(--gold-line); background: rgba(22, 53, 86, 0.92); }

.nav-toggle-bars { display: inline-flex; flex-direction: column; gap: 5px; width: 18px; }
.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--gold-300);
  transition: transform 0.25s var(--ease), opacity 0.2s var(--ease);
}
.site-header[data-open] .nav-toggle-bar:first-child { transform: translateY(3.5px) rotate(45deg); }
.site-header[data-open] .nav-toggle-bar:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.nav-toggle-label { font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em; }

/* ---------- 7. Footer ---------- */
.site-footer {
  position: relative;
  margin-top: clamp(56px, 8vw, 110px);
  padding-top: clamp(40px, 6vw, 72px);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 27, 48, 0.95), rgba(7, 20, 38, 0.99));
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  top: -170px;
  left: -8%;
  width: 560px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(201, 162, 74, 0.22), rgba(201, 162, 74, 0));
}

.site-footer::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(110, 134, 166, 0.08) 0 1px, transparent 1px 84px);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 72%);
  mask-image: linear-gradient(180deg, #000, transparent 72%);
}

.footer-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--shell-x);
}

.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.8fr 1.35fr;
  gap: clamp(24px, 3vw, 44px);
  padding-bottom: clamp(28px, 4vw, 48px);
}

.footer-brand { min-width: 0; }

.footer-brand-name {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--paper);
}

.footer-plate {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--gold-300);
}

.footer-note { margin-top: 12px; font-size: 14px; line-height: 1.7; color: var(--mist-300); max-width: 34ch; }

.footer-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--celadon-line);
  background: rgba(111, 191, 173, 0.1);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--celadon-400);
}

.footer-col { min-width: 0; }

.footer-col-title {
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-500);
}

.footer-links { display: grid; gap: 10px; }

.footer-link {
  display: inline-block;
  font-size: 14.5px;
  color: var(--mist-300);
  transition: color 0.18s var(--ease), transform 0.18s var(--ease);
}
.footer-link:hover { color: var(--gold-300); transform: translateX(2px); }
.footer-link--accent { color: var(--gold-300); font-weight: 700; }

.contact-list { display: grid; gap: 14px; }

.contact-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 3px;
  align-items: center;
}

.contact-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--slate-500);
}

.contact-value { grid-column: 1; font-size: 14px; line-height: 1.6; color: var(--paper); word-break: break-word; }
.contact-value--mono { font-family: var(--font-mono); font-size: 13.5px; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }

.copy-btn {
  grid-column: 2;
  justify-self: end;
  align-self: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(22, 53, 86, 0.7);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mist-300);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.copy-btn:hover { color: var(--gold-300); border-color: var(--gold-line); background: var(--gold-glow); }
.copy-btn[data-copied="true"] { color: var(--celadon-400); border-color: var(--celadon-line); background: rgba(111, 191, 173, 0.14); }

.footer-cta { margin-top: 18px; padding-block: 11px; font-size: 14px; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 28px;
  padding-block: 20px clamp(22px, 3vw, 34px);
  border-top: 1px solid var(--line);
}

.footer-fine {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--slate-500);
}

.footer-legal { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-legal .footer-link { font-size: 13px; }

/* ---------- 8. Motion & JS hooks ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s var(--ease), transform 0.55s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].is-revealed { opacity: 1; transform: none; }

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 120;
  pointer-events: none;
  background: rgba(110, 134, 166, 0.14);
}
.scroll-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--celadon-400), var(--gold-300));
  box-shadow: 0 0 12px rgba(201, 162, 74, 0.5);
}

.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 30px);
  bottom: clamp(14px, 3vw, 30px);
  z-index: 110;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  background: rgba(13, 34, 61, 0.92);
  color: var(--gold-300);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease), visibility 0.24s, border-color 0.2s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--gold-300); background: rgba(22, 53, 86, 0.96); }

/* ---------- 9. Responsive ---------- */
@media (max-width: 1100px) {
  .grid--sidebar { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
}

@media (max-width: 1000px) {
  .header-cta { display: none; }
  .nav-toggle { display: inline-flex; }

  .primary-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: var(--header-x);
    right: var(--header-x);
    margin: 0;
    padding: 10px;
    border-radius: var(--r-lg);
    border: 1px solid var(--line-strong);
    background: linear-gradient(165deg, rgba(13, 34, 61, 0.99), rgba(7, 20, 38, 0.99));
    box-shadow: var(--shadow-soft);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0.22s;
  }
  .site-header[data-open] .primary-nav {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
  }
  .nav-link { padding: 12px 14px; border-radius: 14px; font-size: 15.5px; }
  .nav-link[aria-current="page"] { box-shadow: none; }

  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }
  .brand { padding: 6px 14px 6px 7px; }
  .brand-name { font-size: 15px; }
  .brand-plate { font-size: 10px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 620px) {
  .footer-top { grid-template-columns: minmax(0, 1fr); }
  .footer-note { max-width: none; }
}

@media (max-width: 400px) {
  .brand-plate { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .card:hover, .btn:hover, .brand:hover, .footer-link:hover { transform: none; }
  .to-top { transition: opacity 0.2s linear, visibility 0.2s linear; }
  .primary-nav, .site-header[data-open] .primary-nav { transition: opacity 0.1s linear; }
}
