/*
 * Documentação do Nexus Hub. Tokens copiados de src/index.css da plataforma:
 * a diferenciação é sempre por fundo (canvas < surface < field) e sombra suave,
 * nunca por borda. Sem anel de foco: o foco aparece como mudança de fundo.
 */
:root {
  --brand: #ff4050;
  --brand-hover: #ec2f40;
  --brand-soft: #ffeced;
  --brand-soft-hover: #ffe0e3;
  --accent-ink: #c21f30;
  --navy: #0a113d;

  --canvas: #f7f7f9;
  --chrome: #eeeef2;
  --surface: #ffffff;
  --field: #f2f2f5;
  --field-hover: #ebebef;

  --ink: #111117;
  --ink-soft: #40404c;
  --ink-mute: #82848f;
  --line: #e7e7ec;

  --tip-bg: #ffeced;
  --tip-ink: #a3192a;
  --note-bg: #eaf4fc;
  --note-ink: #0b5d8f;
  --warn-bg: #fff4dd;
  --warn-ink: #855300;
  --important-bg: #eceef8;
  --important-ink: #0a113d;

  --shadow-card: 0 1px 2px rgb(17 17 23 / 0.04), 0 6px 20px -10px rgb(17 17 23 / 0.10);
  --shadow-card-hover: 0 2px 4px rgb(17 17 23 / 0.05), 0 14px 30px -12px rgb(17 17 23 / 0.16);
  --shadow-drop: 0 10px 15px -3px rgb(17 17 23 / 0.10), 0 4px 6px -4px rgb(17 17 23 / 0.10);
  --shadow-modal: 0 24px 60px -12px rgb(10 17 61 / 0.30);

  --radius-card: 24px;
  --radius-compact: 18px;
  --radius-item: 10px;

  --sidebar-w: 288px;
  --topbar-h: 56px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

html.dark {
  --brand-hover: #ff5a68;
  --brand-soft: #3a1a20;
  --brand-soft-hover: #48202a;
  --accent-ink: #ff8a95;

  --canvas: #0e0e12;
  --chrome: #131318;
  --surface: #17171c;
  --field: #212128;
  --field-hover: #2a2a32;

  --ink: #f1f1f4;
  --ink-soft: #c4c5ce;
  --ink-mute: #8a8c98;
  --line: #2a2a31;

  --tip-bg: #3a1a20;
  --tip-ink: #ff9aa4;
  --note-bg: #13263a;
  --note-ink: #8cc8f2;
  --warn-bg: #2d2412;
  --warn-ink: #f2c46d;
  --important-bg: #1c1f33;
  --important-ink: #c7cdf6;

  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.30);
  --shadow-card-hover: 0 10px 28px -12px rgb(0 0 0 / 0.60);
  --shadow-drop: 0 12px 28px -6px rgb(0 0 0 / 0.55);
  --shadow-modal: 0 24px 60px -12px rgb(0 0 0 / 0.70);

  color-scheme: dark;
}

/* ─── Base ─────────────────────────────────────────────────────────────── */

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

html {
  font-family: var(--font);
  font-feature-settings: "cv11", "ss01", "ss03";
  background: var(--canvas);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgb(255 64 80 / 0.18); color: var(--ink); }

a { color: inherit; text-decoration: none; }
img { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Sem anel de foco em lugar nenhum. */
:focus, :focus-visible { outline: none; }
input:focus, input:focus-visible { box-shadow: none; }

.icon { flex-shrink: 0; display: block; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-item);
  background: var(--surface);
  box-shadow: var(--shadow-drop);
  font-size: 14px;
  font-weight: 500;
}
.skip-link:focus { top: 12px; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--field);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  box-shadow: inset 0 -1px 0 rgb(17 17 23 / 0.08);
}

.ext { margin-left: 3px; font-size: 0.85em; opacity: 0.7; }

/* ─── Layout ───────────────────────────────────────────────────────────── */

.layout { min-height: 100vh; }

.main {
  margin-left: var(--sidebar-w);
  min-width: 0;
}

.page {
  display: flex;
  justify-content: center;
  gap: 56px;
  padding: 40px 40px 72px;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 680px;
}

/* ─── Menu lateral ─────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: 0 0 28px rgb(17 17 23 / 0.04);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 16px 14px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border-radius: var(--radius-item);
  transition: opacity 0.15s ease;
}
.brand:hover, .brand:focus-visible { opacity: 0.8; }
.brand-logo { height: 28px; width: auto; }
.logo-dark { display: none; }
html.dark .logo-light { display: none; }
html.dark .logo-dark { display: block; }
.brand-hub {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--field);
}
.theme-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--ink-mute);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-switch button:hover, .theme-switch button:focus-visible { color: var(--ink); background: var(--field-hover); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgb(17 17 23 / 0.08); }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 16px 10px;
  height: 40px;
  padding: 0 8px 0 12px;
  border-radius: 14px;
  background: var(--field);
  color: var(--ink-mute);
  font-size: 14px;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.search-trigger span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-trigger:hover, .search-trigger:focus-visible { background: var(--field-hover); color: var(--ink-soft); }
.search-trigger .kbd-hint { background: var(--surface); }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--field-hover) transparent;
}

.ext-links { list-style: none; margin: 0 0 8px; padding: 0; }
.ext-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-item);
  color: var(--ink-soft);
  font-size: 14px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ext-links a .icon { color: var(--ink-mute); }
.ext-links a span:first-of-type { flex: 1; }
.ext-links a:hover, .ext-links a:focus-visible { background: var(--field); color: var(--ink); }

.nav-group { margin-top: 18px; }
.nav-group-label {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-item);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.35;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-link .icon { color: var(--ink-mute); transition: color 0.15s ease; }
.nav-link:hover, .nav-link:focus-visible { background: var(--field); color: var(--ink); }
.nav-link.active { color: var(--brand); font-weight: 500; }
.nav-link.active .icon { color: var(--brand); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand);
}
.nav-tabs-mobile { display: none; }

.sidebar-footer {
  display: flex;
  gap: 18px;
  padding: 14px 22px 18px;
  font-size: 13px;
}
.sidebar-footer a {
  color: var(--ink-mute);
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.sidebar-footer a:hover, .sidebar-footer a:focus-visible { color: var(--ink); }

/* ─── Barra do topo e abas ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--canvas) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.topbar-mobile { display: none; }

.tabs {
  display: flex;
  gap: 28px;
  height: var(--topbar-h);
  padding: 0 40px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--ink-mute);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.tab:hover, .tab:focus-visible { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--ink-soft);
  transition: background-color 0.15s ease;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--field); }

/* ─── Conteúdo ─────────────────────────────────────────────────────────── */

.section-label {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
}

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 34px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.copy-page {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  height: 34px;
  margin-top: 4px;
  padding: 0 12px;
  border-radius: 11px;
  background: var(--field);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.copy-page:hover, .copy-page:focus-visible { background: var(--field-hover); color: var(--ink); }
.copy-page.copied { background: var(--brand-soft); color: var(--brand); }

.lead {
  margin: 14px 0 0;
  color: var(--ink-mute);
  font-size: 18px;
  line-height: 1.6;
}

.prose {
  margin-top: 32px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.72;
}
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a:not(.card):not(.anchor) {
  color: var(--accent-ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent-ink) 35%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
.prose a:not(.card):not(.anchor):hover, .prose a:not(.card):not(.anchor):focus-visible { text-decoration-color: currentColor; }

.prose h2, .prose h3, .prose h4 {
  position: relative;
  color: var(--ink);
  scroll-margin-top: calc(var(--topbar-h) + 24px);
}
.prose h2 { margin: 48px 0 14px; font-size: 23px; line-height: 1.3; font-weight: 650; letter-spacing: -0.015em; }
.prose h3 { margin: 32px 0 10px; font-size: 18px; line-height: 1.4; font-weight: 600; }
.prose h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 600; }
.anchor {
  position: absolute;
  left: -22px;
  padding-right: 6px;
  color: var(--ink-mute);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor, .anchor:focus-visible { opacity: 1; }

.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.3em; }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--ink-mute); }
.prose li > ul, .prose li > ol { margin: 6px 0 0; }
.prose li > p { margin: 6px 0; }

.prose code {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.86em;
}
.prose pre.code {
  margin: 0 0 20px;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: var(--radius-compact);
  background: var(--field);
  font-size: 13.5px;
  line-height: 1.6;
}
.prose pre.code code { padding: 0; background: none; font-size: inherit; }

.prose blockquote {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: var(--radius-compact);
  background: var(--field);
}
.prose blockquote > :last-child { margin-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  vertical-align: 1px;
}

.inline-icon { display: inline-block; vertical-align: -2px; color: var(--ink-mute); }

/* Avisos */
.callout {
  display: flex;
  gap: 12px;
  margin: 0 0 20px;
  padding: 16px 18px;
  border-radius: var(--radius-compact);
  font-size: 15px;
  line-height: 1.65;
}
.callout-icon { margin-top: 2px; }
.callout-body { min-width: 0; }
.callout-title { margin: 0 0 4px !important; font-weight: 600; }
.callout-body > :last-child { margin-bottom: 0; }
.callout p { margin: 0 0 8px; }
.callout-dica { background: var(--tip-bg); color: var(--tip-ink); }
.callout-nota { background: var(--note-bg); color: var(--note-ink); }
.callout-atencao { background: var(--warn-bg); color: var(--warn-ink); }
.callout-importante { background: var(--important-bg); color: var(--important-ink); }
.callout strong, .callout a:not(.card) { color: inherit !important; }
.callout code { background: rgb(255 255 255 / 0.55); color: inherit; }
html.dark .callout code { background: rgb(0 0 0 / 0.25); }

/* Cartões */
.cards {
  display: grid;
  gap: 16px;
  margin: 0 0 28px;
}
.cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  text-align: left;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
html.dark .card:hover, html.dark .card:focus-visible { background: var(--field); }
.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}
.card-title { color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.35; }
.card-desc { color: var(--ink-mute); font-size: 14px; line-height: 1.55; }

/* Passo a passo */
.prose ol.steps { list-style: none; margin: 8px 0 24px; padding: 0; }
.step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 16px;
  margin: 0 !important;
  padding: 0 0 22px !important;
}
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 36px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--field-hover);
}
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}
.step-title { margin: 3px 0 6px !important; color: var(--ink); font-weight: 600; }
.step-body > :last-child { margin-bottom: 0; }
.step-body p { margin: 0 0 10px; }

/* Tabelas: a linha aqui é divisória de conteúdo, não contorno. */
.table-wrap {
  margin: 0 0 22px;
  overflow-x: auto;
  border-radius: var(--radius-compact);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.prose th {
  padding: 12px 16px;
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.prose td { padding: 12px 16px; vertical-align: top; }
.prose tbody tr + tr td { box-shadow: inset 0 1px 0 var(--line); }

/* Anterior / próxima */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 56px;
}
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius-compact);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: background-color 0.15s ease, box-shadow 0.2s ease;
}
.pager-link:hover, .pager-link:focus-visible { box-shadow: var(--shadow-card-hover); }
html.dark .pager-link:hover, html.dark .pager-link:focus-visible { background: var(--field); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-dir { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-mute); font-size: 13px; }
.pager-title { color: var(--ink); font-size: 15px; font-weight: 600; }

.page-footer {
  margin-top: 48px;
  padding-top: 24px;
  color: var(--ink-mute);
  font-size: 14px;
  line-height: 1.6;
}
.page-footer p { margin: 0 0 6px; }
.page-footer a { color: var(--accent-ink); font-weight: 500; }
.page-footer .muted { font-size: 13px; }

/* ─── Nesta página ─────────────────────────────────────────────────────── */

.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
  flex: 0 0 220px;
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h) - 64px);
  overflow-y: auto;
  scrollbar-width: none;
}
.toc-title { margin: 0 0 10px; color: var(--ink); font-size: 13px; font-weight: 600; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  position: relative;
  display: block;
  padding: 5px 0 5px 14px;
  color: var(--ink-mute);
  font-size: 13.5px;
  line-height: 1.45;
  transition: color 0.15s ease;
}
.toc .toc-l3 a { padding-left: 26px; font-size: 13px; }
.toc a:hover, .toc a:focus-visible { color: var(--ink); }
.toc a.active { color: var(--brand); font-weight: 500; }
.toc a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--brand);
}

/* ─── Busca ────────────────────────────────────────────────────────────── */

.search-modal { position: fixed; inset: 0; z-index: 100; }
.search-modal[hidden] { display: none; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(10 17 61 / 0.32);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
html.dark .search-backdrop { background: rgb(0 0 0 / 0.55); }
.search-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 120px));
  margin: 12vh auto 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 18px;
  color: var(--ink-mute);
  background: var(--surface);
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.search-field input::placeholder { color: var(--ink-mute); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-results {
  list-style: none;
  margin: 0;
  padding: 0 10px 10px;
  overflow-y: auto;
}
.search-results:empty { display: none; }
.search-result a {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  transition: background-color 0.1s ease;
}
.search-result a:hover, .search-result.active a { background: var(--field); }
.sr-crumb { display: block; color: var(--ink-mute); font-size: 12px; }
.sr-title { display: block; margin-top: 1px; color: var(--ink); font-size: 15px; font-weight: 600; }
.sr-snippet { display: block; margin-top: 3px; color: var(--ink-mute); font-size: 13px; line-height: 1.5; }
.search-results mark { padding: 0 2px; border-radius: 4px; background: var(--brand-soft); color: var(--accent-ink); }
.search-empty { padding: 18px 14px; color: var(--ink-mute); font-size: 14px; }
.search-foot {
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 10px 18px;
  background: var(--field);
  color: var(--ink-mute);
  font-size: 12px;
}
.search-foot span { display: inline-flex; align-items: center; gap: 4px; }
.search-foot kbd { height: 20px; min-width: 20px; background: var(--surface); font-size: 11px; }
body.search-open { overflow: hidden; }

/* ─── Telas menores ────────────────────────────────────────────────────── */

@media (max-width: 1240px) {
  .toc { display: none; }
  .page { gap: 0; }
}

@media (max-width: 1023px) {
  .main { margin-left: 0; }
  .sidebar {
    width: min(320px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.32s ease;
    box-shadow: none;
  }
  body.drawer-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-modal); }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgb(10 17 61 / 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  html.dark .drawer-backdrop { background: rgb(0 0 0 / 0.55); }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .nav-tabs-mobile { display: block; }
  .search-trigger .kbd-hint { display: none; }

  .topbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: var(--topbar-h);
    padding: 0 8px;
  }
  .tabs { height: 46px; padding: 0 16px; gap: 22px; }
  .page { padding: 28px 16px 56px; }
  .prose h2, .prose h3, .prose h4 { scroll-margin-top: 120px; }
}

@media (max-width: 720px) {
  h1 { font-size: 28px; }
  .lead { font-size: 17px; }
  .title-row { flex-direction: column; gap: 12px; }
  .copy-page { margin-top: 0; }
  .cards.cols-3, .cards.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .anchor { display: none; }
  .search-panel { margin-top: 16px; max-height: calc(100vh - 32px); }
  .search-foot { display: none; }
}

@media (min-width: 721px) and (max-width: 900px) {
  .cards.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .sidebar, .topbar, .toc, .pager, .copy-page, .search-modal { display: none !important; }
  .main { margin: 0; }
  .card, .table-wrap, .pager-link { box-shadow: none; }
}
