/* ==========================================================================
   Defient.io - Static Reference Platform
   Design system: dark modern dev-docs aesthetic
   ========================================================================== */

:root {
  /* Color tokens */
  --bg: #07080c;
  --bg-elevated: #0d0f15;
  --bg-surface: #11141c;
  --bg-code: #0a0c12;
  --bg-hover: #161a24;

  --border: #1d2230;
  --border-strong: #2a3142;
  --border-subtle: #141823;

  --text: #e6e8ee;
  --text-secondary: #a4a9b8;
  --text-muted: #6b7184;
  --text-faint: #4a5060;

  --accent: #6ee7c6;
  --accent-strong: #34d399;
  --accent-fade: rgba(110, 231, 198, 0.12);
  --violet: #a78bfa;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --rose: #fb7185;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);

  --max-w: 1200px;
  --max-w-prose: 760px;
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); letter-spacing: -0.03em; }
h2 { font-size: 1.5rem; margin-top: 2rem; }
h3 { font-size: 1.15rem; margin-top: 1.5rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; color: var(--text-secondary); }
strong { color: var(--text); font-weight: 600; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.88em; }

:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.85em;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text);
}
pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: inherit; }

kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.8em;
  color: var(--text);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

ul, ol { padding-left: 1.3em; color: var(--text-secondary); }
ul li, ol li { margin: 0.3em 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table thead { background: var(--bg-elevated); }
table th, table td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
table th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
table tr:last-child td { border-bottom: 0; }
table tbody tr:hover { background: var(--bg-hover); }
table td code { font-size: 0.82em; }

blockquote {
  margin: 1.2rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-fade);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}
blockquote p:last-child { margin-bottom: 0; }

/* ========================== Layout ========================== */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container-narrow { max-width: 880px; margin: 0 auto; padding: 0 1.25rem; }

/* ========================== Top navigation ========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 8, 12, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.02rem;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  display: inline-grid;
  place-items: center;
  color: #07080c;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.85rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 0.7rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--bg-hover); }
.nav-links a.active { color: var(--text); background: var(--bg-hover); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 0.85rem;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}
.nav-cta:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

/* ========================== Hero ========================== */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 400px at 15% -10%, rgba(110, 231, 198, 0.08), transparent 60%),
    radial-gradient(700px 360px at 90% 0%, rgba(167, 139, 250, 0.07), transparent 60%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 820px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-bottom: 1.4rem;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 1.1rem;
}
.hero h1 .accent {
  background: linear-gradient(120deg, var(--accent), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: 1.8rem;
}
.hero-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* ========================== Buttons ========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  text-decoration: none;
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text); }
.btn-primary {
  background: var(--accent);
  color: #061410;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #061410; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.82rem; }

/* ========================== Section structure ========================== */
section { padding: 3.5rem 0; }
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.6rem;
  flex-wrap: wrap;
}
.section-header h2 { margin: 0; font-size: 1.4rem; }
.section-header p { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.92rem; }
.section-link { font-size: 0.85rem; color: var(--text-secondary); }
.section-link:hover { color: var(--accent); }

.section-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 0.5rem;
}

/* ========================== Card grids ========================== */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  display: block;
  padding: 1.1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
}
.card:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.card-icon {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  color: var(--accent);
  margin-bottom: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.55;
}
.card-tag {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ========================== Category list (sidebar / hub) ========================== */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.9rem;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.18s ease;
  color: var(--text);
}
.cat-card:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.cat-card .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cat-card h3 { margin: 0; font-size: 1rem; }
.cat-card p { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--text-muted); }

/* ========================== Page layout with sidebar ========================== */
.docs-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2rem 0 4rem;
}
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs-sidebar { display: none; }
}

.docs-sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
}
.docs-sidebar nav { font-size: 0.88rem; }
.docs-sidebar h4 {
  margin: 1.2rem 0 0.5rem;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.docs-sidebar h4:first-child { margin-top: 0; }
.docs-sidebar ul { list-style: none; padding: 0; margin: 0; }
.docs-sidebar li { margin: 0; }
.docs-sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.4;
}
.docs-sidebar a:hover { background: var(--bg-hover); color: var(--text); }
.docs-sidebar a.active {
  background: var(--bg-hover);
  color: var(--text);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.docs-content { min-width: 0; }

/* Breadcrumb */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 1.4rem;
}
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-faint); }

/* Page header (within docs) */
.page-header { margin-bottom: 1.6rem; }
.page-header h1 { margin-bottom: 0.55rem; }
.page-header .page-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.page-header .page-meta .badge {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.page-header p.summary {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-top: 0.6rem;
}

/* ========================== Tool interface ========================== */
.tool-shell {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  margin: 1.2rem 0 2rem;
}
.tool-shell .tool-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 760px) {
  .tool-shell .tool-row { grid-template-columns: 1fr; }
}
.tool-shell label,
.field-label {
  display: block;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

textarea, input[type="text"], input[type="number"], input[type="email"], input[type="search"], select {
  width: 100%;
  background: var(--bg-code);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fade);
}
textarea { min-height: 180px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.1rem;
  margin: 0.6rem 0;
}
.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  margin: 0;
}
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.6rem;
}

.output-box {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  min-height: 60px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}
.output-box.empty { color: var(--text-faint); }
.output-box.error { color: var(--rose); border-color: rgba(251, 113, 133, 0.3); }

.status-line {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.status-line .ok { color: var(--accent); }
.status-line .err { color: var(--rose); }

.tool-tabs {
  display: inline-flex;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 0.8rem;
  gap: 2px;
}
.tool-tabs button {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 5px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  font-weight: 500;
}
.tool-tabs button.active { background: var(--bg-hover); color: var(--text); }
.tool-tabs button:hover:not(.active) { color: var(--text); }

/* ========================== Callouts ========================== */
.callout {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin: 1.2rem 0;
  font-size: 0.9rem;
}
.callout .icon {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  width: 22px;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 0.5em; }
.callout strong { color: var(--text); }
.callout.warn { border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.05); }
.callout.warn .icon { color: var(--amber); }
.callout.danger { border-color: rgba(251, 113, 133, 0.3); background: rgba(251, 113, 133, 0.05); }
.callout.danger .icon { color: var(--rose); }
.callout.info { border-color: rgba(96, 165, 250, 0.3); background: rgba(96, 165, 250, 0.05); }
.callout.info .icon { color: var(--blue); }

/* ========================== FAQ ========================== */
.faq { margin: 1rem 0; }
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  list-style: none;
  position: relative;
  padding-right: 2.4rem;
  user-select: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { background: var(--bg-hover); }
.faq .faq-body {
  padding: 0 1.1rem 1rem;
  color: var(--text-secondary);
  font-size: 0.93rem;
}
.faq .faq-body p:last-child { margin-bottom: 0; }

/* ========================== Related / In-page block ========================== */
.related-block {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.related-block h2 {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
}
.related-list { display: grid; gap: 0.6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .related-list { grid-template-columns: 1fr; } }
.related-list a {
  display: block;
  padding: 0.7rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}
.related-list a:hover { background: var(--bg-surface); border-color: var(--border-strong); }
.related-list a small {
  display: block;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-family: var(--font-mono);
  margin-top: 0.15rem;
  font-weight: 400;
}

.refs-list { list-style: none; padding: 0; margin: 0.8rem 0; }
.refs-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); }
.refs-list li:last-child { border-bottom: 0; }
.refs-list a { font-size: 0.9rem; }
.refs-list .source {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.1rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ========================== Footer ========================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 2.5rem;
  margin-bottom: 2rem;
}
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.6rem; }
}
.footer-grid h5 {
  margin: 0 0 0.7rem;
  color: var(--text);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 0.35rem 0; }
.footer-grid a { color: var(--text-secondary); font-size: 0.86rem; }
.footer-grid a:hover { color: var(--accent); }
.footer-brand p { color: var(--text-muted); font-size: 0.88rem; margin: 0.5rem 0 0; max-width: 320px; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-faint);
}
.footer-bottom .legal-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--accent); }

/* ========================== Misc ========================== */
.kbd-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

.toc {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}
.toc h5 {
  font-size: 0.74rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}
.toc ul { list-style: none; padding-left: 0; margin: 0; columns: 2; column-gap: 1.5rem; }
.toc li { margin: 0.2rem 0; break-inside: avoid; }
.toc a { font-size: 0.86rem; color: var(--text-secondary); }
.toc a:hover { color: var(--accent); }
@media (max-width: 640px) { .toc ul { columns: 1; } }

/* Mobile nav */
@media (max-width: 800px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem;
    gap: 0;
  }
  .nav-links.open a {
    height: auto;
    padding: 0.7rem 0.85rem;
    border-radius: 6px;
    width: 100%;
  }
  .nav-cta { display: none; }
}

/* Print-ish for code samples in references */
.codeblock-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.2rem 0 -0.5rem;
  padding: 0 0.2rem;
}
.codeblock-title h4 { margin: 0; font-size: 0.85rem; color: var(--text-secondary); font-family: var(--font-mono); font-weight: 500; }

/* Anchor target offset */
:target { scroll-margin-top: 80px; }
