/* ============================================================
   12dPL Documentation Site - style.css
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --color-primary:        #0a6ebd;
  --color-primary-dark:   #065a9e;
  --color-primary-soft:   #e6f1fa;
  --color-accent:         #e84a2f;
  --color-bg:             #ffffff;
  --color-surface:        #f7f8fa;
  --color-surface-alt:    #eef1f5;
  --color-border:         #e1e4e8;
  --color-border-strong:  #cdd2d8;
  --color-text:           #1a1d23;
  --color-text-muted:     #586069;
  --color-code-bg:        #1e2432;
  --color-code-text:      #e6edf3;
  --color-nav-bg:         #fafbfc;
  --color-nav-active:     #0a6ebd;
  --color-nav-hover:      #f0f3f7;
  --color-header-bg:      #ffffff;
  --color-callout-info-bg:    #dff0ff;
  --color-callout-info-border:#0a6ebd;
  --color-callout-warn-bg:    #fff8e1;
  --color-callout-warn-border:#f59e0b;

  /* Category accents (matching badges + cards) */
  --cat-text:       #0ea5e9;
  --cat-math:       #8b5cf6;
  --cat-io:         #f97316;
  --cat-geometry:   #10b981;
  --cat-elements:   #0a6ebd;
  --cat-tin:        #84cc16;
  --cat-ui:         #ec4899;
  --cat-arrays:     #6366f1;
  --cat-system:     #64748b;
  --cat-attributes: #f59e0b;
  --cat-data:       #14b8a6;
  --cat-misc:       #94a3b8;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 10px 30px rgba(15,23,42,.12);
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
  --sidebar-w:    280px;
  --header-h:     60px;
  --transition:   0.2s ease;
}

[data-theme="dark"] {
  --color-bg:             #0d1117;
  --color-surface:        #161b22;
  --color-surface-alt:    #1c2230;
  --color-border:         #30363d;
  --color-border-strong:  #4a525d;
  --color-text:           #e6edf3;
  --color-text-muted:     #8b949e;
  --color-nav-bg:         #161b22;
  --color-nav-active:     #58a6ff;
  --color-nav-hover:      #1c2128;
  --color-header-bg:      #161b22;
  --color-primary-soft:   #0e2740;
  --color-callout-info-bg:    #0c2d50;
  --color-callout-info-border:#58a6ff;
  --color-callout-warn-bg:    #2d2000;
  --color-callout-warn-border:#d29922;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
               Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--color-header-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: saturate(140%) blur(8px);
}
.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.header-center { flex: 1; max-width: 560px; }
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-text); }
.logo-img {
  width: 32px; height: 32px; border-radius: 6px;
  display: block; box-shadow: var(--shadow-sm);
}
.logo-text { font-size: 16px; font-weight: 600; color: var(--color-text); }

.sidebar-toggle {
  display: none; flex-direction: column; justify-content: space-between;
  width: 24px; height: 18px;
  background: none; border: none; cursor: pointer; padding: 0;
}
.sidebar-toggle span {
  display: block; height: 2px; width: 100%;
  background: var(--color-text); border-radius: 2px;
  transition: var(--transition);
}

/* Search */
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-icon {
  position: absolute; left: 12px;
  width: 16px; height: 16px; color: var(--color-text-muted);
  pointer-events: none;
}
#searchInput {
  width: 100%; padding: 9px 14px 9px 38px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
#searchInput:focus {
  border-color: var(--color-primary);
  background: var(--color-bg);
  box-shadow: 0 0 0 3px rgba(10,110,189,.2);
}
.search-shortcut {
  position: absolute; right: 10px;
  font-size: 11px; color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1px 6px; border-radius: 4px;
  pointer-events: none;
}
.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px; overflow-y: auto;
  z-index: 200;
}
.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
  align-items: baseline;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--color-nav-hover); }
.search-result-item strong { font-size: 14px; }
.search-result-item .result-sub {
  font-size: 12px; color: var(--color-text-muted);
  grid-column: 2;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-result-item .kind {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 6px; border-radius: 4px;
  align-self: center;
  grid-row: span 2;
  background: var(--color-surface);
  color: var(--color-text-muted);
}
.search-result-item .kind-fn   { background: var(--color-primary-soft); color: var(--color-primary); }
.search-result-item .kind-type { background: rgba(139,92,246,.12); color: #8b5cf6; }
.search-result-item .kind-snip { background: rgba(236,72,153,.12); color: #ec4899; }
.search-result-item mark {
  background: rgba(245,158,11,.25);
  color: inherit; font-weight: 700;
  padding: 0 2px; border-radius: 2px;
}

/* Theme toggle + buttons */
.theme-toggle {
  background: none; border: 1px solid var(--color-border);
  border-radius: 22px; padding: 7px 11px;
  cursor: pointer; color: var(--color-text);
  display: flex; align-items: center;
  transition: background var(--transition);
}
.theme-toggle:hover { background: var(--color-surface); }
.theme-toggle svg { width: 16px; height: 16px; }
.btn-outline {
  padding: 7px 14px; border: 1px solid var(--color-border);
  border-radius: 6px; font-size: 13px;
  color: var(--color-text); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--color-bg);
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
}
.btn-outline:hover { background: var(--color-surface); border-color: var(--color-border-strong); text-decoration: none; }
.btn-primary {
  padding: 9px 18px;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - var(--header-h)); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--color-nav-bg);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  padding: 16px 0 40px;
  transition: transform var(--transition);
}
.nav-list { list-style: none; padding: 0; }
.nav-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--color-text-muted);
  padding: 18px 20px 6px;
}
.nav-link {
  display: block; padding: 6px 20px;
  font-size: 14px; color: var(--color-text-muted);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
}
.nav-link:hover { background: var(--color-nav-hover); color: var(--color-text); text-decoration: none; }
.nav-link.active {
  color: var(--color-nav-active);
  border-left-color: var(--color-nav-active);
  background: var(--color-nav-hover);
  font-weight: 500;
}
.nav-sub { list-style: none; padding-left: 16px; }
.nav-sub .nav-link { font-size: 13px; padding: 4px 20px 4px 12px; }
.nav-link .nav-count {
  float: right; font-size: 11px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 1px 7px; border-radius: 10px;
}

/* ---------- Content ---------- */
.content {
  flex: 1; overflow-y: auto;
  padding: 40px 56px 80px;
  max-width: 1080px;
}
@media (max-width: 900px) {
  .content { padding: 24px 20px 60px; }
}
.doc-section { display: none; }
.doc-section.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Typography ---------- */
.doc-section h1 {
  font-size: 2rem; font-weight: 700;
  margin-bottom: 12px; line-height: 1.25;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}
.doc-section h2 { font-size: 1.3rem; font-weight: 600; margin: 32px 0 12px; }
.doc-section h3 { font-size: 1.05rem; font-weight: 600; margin: 24px 0 8px; }
.doc-section p  { margin-bottom: 14px; }
.doc-section ul, .doc-section ol { margin: 0 0 14px 24px; }
.doc-section li { margin-bottom: 4px; }

/* ---------- Hero (homepage) ---------- */
.hero {
  position: relative;
  margin: -8px 0 32px;
  padding: 36px 36px 32px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(800px 360px at 100% 0%, rgba(10,110,189,.18), transparent 60%),
    radial-gradient(640px 320px at 0% 100%, rgba(232,74,47,.12), transparent 60%),
    linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.hero .badge {
  display: inline-block;
  background: var(--color-primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 12px; border-radius: 20px;
  margin-bottom: 14px; letter-spacing: .5px;
}
.hero h1 {
  font-size: 2.6rem; line-height: 1.15;
  margin: 0 0 12px; border: none; padding: 0;
  letter-spacing: -.02em;
}
.hero .lead {
  font-size: 1.1rem; color: var(--color-text-muted);
  max-width: 680px; margin-bottom: 18px;
}
.hero .hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 24px 0 8px;
}
.stat-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-num {
  font-size: 1.8rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
  line-height: 1.1;
}
.stat-card .stat-label {
  font-size: 12px; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600;
}

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0 36px;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}
.card-icon { font-size: 26px; margin-bottom: 10px; }
.card h3 { font-size: 1rem; margin: 0 0 6px; }
.card p { font-size: 13px; color: var(--color-text-muted); margin: 0; }

/* ---------- Code blocks ---------- */
pre {
  background: var(--color-code-bg) !important;
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 12px 0 20px;
  font-size: 13.5px;
  line-height: 1.55;
  border: 1px solid rgba(255,255,255,.05);
}
pre code { background: none !important; padding: 0 !important; font-size: inherit; }

:not(pre) > code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--color-accent);
}

/* ---------- Tables ---------- */
table {
  width: 100%; border-collapse: collapse;
  margin: 12px 0 20px; font-size: 14px;
}
thead { background: var(--color-surface); }
th {
  text-align: left; padding: 10px 14px;
  font-weight: 600; border-bottom: 2px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em;
}
td { padding: 9px 14px; border-bottom: 1px solid var(--color-border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-surface); }

/* ---------- Callouts ---------- */
.callout {
  border-left: 4px solid;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin: 14px 0 20px;
  font-size: 14px;
}
.callout-info { background: var(--color-callout-info-bg); border-color: var(--color-callout-info-border); }
.callout-warning { background: var(--color-callout-warn-bg); border-color: var(--color-callout-warn-border); }

/* ---------- Keyword grid ---------- */
.keyword-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 10px 0 18px;
}
.keyword-grid code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12.5px;
  color: var(--color-accent);
}

/* ---------- All-Calls list ---------- */
.calls-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between;
  margin: 14px 0 16px;
  padding: 12px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.calls-toolbar-left, .calls-toolbar-right {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
#allCallsFilter, #typesFilter {
  min-width: 260px; flex: 1; max-width: 460px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}
#allCallsFilter:focus, #typesFilter:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10,110,189,.18);
}
.calls-stats { font-size: 13px; color: var(--color-text-muted); }
.calls-stats strong { color: var(--color-text); font-variant-numeric: tabular-nums; }

.category-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.category-chips button {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  cursor: pointer;
  transition: var(--transition);
}
.category-chips button:hover { background: var(--color-surface); color: var(--color-text); }
.category-chips button.active {
  background: var(--color-primary); color: #fff;
  border-color: var(--color-primary);
}

.calls-list { display: grid; gap: 12px; margin: 6px 0 14px; }

.call-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  padding: 14px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.call-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); }
.call-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.call-card-header h3 {
  margin: 0; font-size: 1.05rem; font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--color-text);
}
.call-card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-pill {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.cat-text       { background: rgba(14,165,233,.12);  color: var(--cat-text); border-color: transparent; }
.cat-math       { background: rgba(139,92,246,.12);  color: var(--cat-math); border-color: transparent; }
.cat-io         { background: rgba(249,115,22,.12);  color: var(--cat-io); border-color: transparent; }
.cat-geometry   { background: rgba(16,185,129,.12);  color: var(--cat-geometry); border-color: transparent; }
.cat-elements   { background: rgba(10,110,189,.12);  color: var(--cat-elements); border-color: transparent; }
.cat-tin        { background: rgba(132,204,22,.14);  color: #65a30d; border-color: transparent; }
.cat-ui         { background: rgba(236,72,153,.12);  color: var(--cat-ui); border-color: transparent; }
.cat-arrays     { background: rgba(99,102,241,.12);  color: var(--cat-arrays); border-color: transparent; }
.cat-system     { background: rgba(100,116,139,.12); color: var(--cat-system); border-color: transparent; }
.cat-attributes { background: rgba(245,158,11,.14);  color: #b45309; border-color: transparent; }
.cat-data       { background: rgba(20,184,166,.14);  color: var(--cat-data); border-color: transparent; }
.cat-misc       { background: rgba(148,163,184,.14); color: var(--cat-misc); border-color: transparent; }

.call-signature {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 60px 8px 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 8px;
}
.sig-return { color: var(--color-primary); font-weight: 600; }
.sig-fn     { color: var(--color-text); font-weight: 600; }
.sig-paren  { color: var(--color-text-muted); }
.sig-type   { color: var(--cat-math); font-weight: 500; }
.sig-name   { color: var(--color-accent); }

.copy-btn {
  position: absolute; top: 5px; right: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.copy-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.copy-btn.copied { color: #10b981; border-color: #10b981; }

.call-description {
  margin: 0; font-size: 14px; color: var(--color-text);
}

#allCallsMore {
  display: inline-flex;
  margin-top: 8px;
  cursor: pointer;
}

.empty-state {
  padding: 40px 16px;
  text-align: center;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

/* ---------- Types grid ---------- */
.types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.type-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--cat-misc);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: var(--transition);
}
.type-card:hover { box-shadow: var(--shadow-sm); }
.type-card.cat-math       { border-left-color: var(--cat-math); }
.type-card.cat-geometry   { border-left-color: var(--cat-geometry); }
.type-card.cat-elements   { border-left-color: var(--cat-elements); }
.type-card.cat-ui         { border-left-color: var(--cat-ui); }
.type-card.cat-data       { border-left-color: var(--cat-data); }
.type-card.cat-attributes { border-left-color: var(--cat-attributes); }
.type-card.cat-arrays     { border-left-color: var(--cat-arrays); }
.type-card.cat-system     { border-left-color: var(--cat-system); }
.type-card h3 { margin: 0 0 4px; font-size: 1rem; }
.type-card h3 code { font-size: 14px; padding: 3px 8px; }
.type-card .type-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-text-muted); font-weight: 600;
  margin-bottom: 8px;
}
.type-card p { font-size: 13px; color: var(--color-text); margin: 0; line-height: 1.55; }

/* ---------- Snippets ---------- */
.snippets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.snippet-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column;
}
.snippet-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.snippet-card-header h3 { margin: 0 0 4px; font-size: 1rem; }
.snippet-prefix {
  font-size: 11px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border: 1px solid transparent;
  padding: 2px 7px; border-radius: 4px;
}
.snippet-card .copy-btn {
  position: static;
  flex-shrink: 0;
}
.snippet-description {
  font-size: 12.5px; color: var(--color-text-muted);
  margin: 0 0 8px;
}
.snippet-card pre { margin: 0; flex: 1; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed; right: 20px; bottom: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-primary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: none; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  transition: var(--transition);
  z-index: 50;
}
.back-to-top.visible { display: flex; }
.back-to-top:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 24px 22px; }
  .hero h1 { font-size: 2rem; }
}
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0;
    z-index: 99;
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .header-right .btn-outline { display: none; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .site-header { gap: 10px; padding: 0 14px; }
  .logo-text { display: none; }
  .search-shortcut { display: none; }
}

/* ---------- Scrollbar ---------- */
.sidebar::-webkit-scrollbar, .content::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track, .content::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb {
  background: var(--color-border); border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover, .content::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-strong);
}

/* ---------- About / Legal section ---------- */
#about .disclaimer-lead {
  background: rgba(239, 68, 68, .08);
  border-left: 3px solid #ef4444;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 0 0 20px;
}
#about .disclaimer-list { list-style: disc; padding-left: 22px; margin: 0 0 18px; }
#about .disclaimer-list li { margin-bottom: 10px; line-height: 1.6; }
#about .disclaimer-foot {
  padding-top: 14px;
  border-top: 1px dashed var(--color-border);
  margin: 24px 0 8px;
  color: var(--color-text-muted);
}
#about .copyright {
  font-size: 12.5px;
  margin: 0;
  color: var(--color-text-muted);
  opacity: .85;
}

/* ---------- Print ---------- */
@media print {
  .site-header, .sidebar, .back-to-top, .copy-btn { display: none !important; }
  .doc-section { display: block !important; }
  .content { padding: 0; max-width: 100%; }
  .call-card { break-inside: avoid; }
}
