/* LangIndex visual system — GitHub-flavored dark/light palette,
   content-forward, dense but humane reference layout. */

:root {
  color-scheme: dark;

  /* GitHub Primer dark palette */
  --bg: #0d1117;
  --bg-elevated: #010409;
  --surface: #161b22;
  --surface-muted: #0d1117;
  --surface-strong: #21262d;
  --surface-hover: #1c2128;
  --border: #30363d;
  --border-muted: #21262d;
  --border-strong: #484f58;
  --fg: #e6edf3;
  --fg-strong: #ffffff;
  --fg-muted: #7d8590;
  --fg-subtle: #6e7681;
  --accent: #1f6feb;
  --accent-strong: #58a6ff;
  --accent-bg: rgba(56, 139, 253, 0.15);
  --accent-fg: #ffffff;
  --accent-border: rgba(56, 139, 253, 0.4);
  --accent-hover: #388bfd;
  --warn: #d29922;
  --success: #3fb950;
  --code-bg: #161b22;
  --code-border: #30363d;
  --shadow-sm: 0 0 transparent;
  --shadow-md: 0 8px 24px rgba(1, 4, 9, 0.55);
  --focus-ring: 0 0 0 2px var(--accent);

  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono:
    ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
}

:root[data-theme="light"] {
  color-scheme: light;

  /* GitHub Primer light palette */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #f6f8fa;
  --surface-muted: #f6f8fa;
  --surface-strong: #eaeef2;
  --surface-hover: #eef1f5;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --border-strong: #afb8c1;
  --fg: #1f2328;
  --fg-strong: #0a0c10;
  --fg-muted: #59636e;
  --fg-subtle: #6e7781;
  --accent: #0969da;
  --accent-strong: #0550ae;
  --accent-bg: #ddf4ff;
  --accent-fg: #ffffff;
  --accent-border: #54aeff;
  --accent-hover: #0860c8;
  --warn: #9a6700;
  --success: #1a7f37;
  --code-bg: #f6f8fa;
  --code-border: #d0d7de;
  --shadow-md: 0 8px 24px rgba(31, 35, 40, 0.08);
}

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

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

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-bg);
  color: var(--fg-strong);
}

.container {
  width: min(76rem, calc(100% - 2rem));
  margin: 0 auto;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.55rem 0.85rem;
  font-weight: 600;
}

.skip:focus {
  top: 1rem;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
  padding: 0;
  margin: -1px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 7;
  border-bottom: 1px solid var(--border-muted);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg-strong);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--fg-strong);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-raised);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 1px 2px rgba(1, 4, 9, 0.4);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.primary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
  flex: 1;
  justify-content: center;
  margin: 0 0.5rem;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-button {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg-muted);
  cursor: pointer;
  font: inherit;
  transition:
    color 80ms ease,
    background-color 80ms ease,
    border-color 80ms ease;
}

.icon-button:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--fg-strong);
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

/* Theme toggle: swap visible icon based on data-theme */
.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle .theme-icon-moon {
  display: block;
}

:root[data-theme="light"] .theme-toggle .theme-icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-toggle .theme-icon-moon {
  display: none;
}

.mobile-nav {
  display: none;
}

.mobile-nav-backdrop {
  display: none;
}

.theme-toggle .icon-open,
.theme-toggle .icon-close,
.mobile-nav-toggle .icon-close {
  display: none;
}

.nav-link {
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    color 80ms ease,
    background-color 80ms ease;
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--fg-strong);
  text-decoration: none;
}

.nav-link.active {
  color: var(--fg-strong);
  background: var(--surface-strong);
  font-weight: 600;
}

/* ---------- Sections ---------- */

.hero {
  border-bottom: 1px solid var(--border-muted);
  padding: 4.5rem 0 3.5rem;
  background:
    radial-gradient(
      ellipse 80% 60% at 50% 0%,
      var(--accent-bg) 0%,
      transparent 70%
    );
}

.section {
  border-bottom: 1px solid var(--border-muted);
  padding: 3.25rem 0;
}

.section-tight {
  padding-top: 2.5rem;
}

.section:last-of-type,
.hero + .stats + .section:first-of-type {
  /* placeholder for future tweaks */
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(22rem, 0.95fr);
  gap: 2.5rem;
  align-items: start;
}

.hero-copy {
  padding-top: 0.5rem;
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  color: var(--fg-strong);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h1 {
  max-width: 54rem;
  margin: 0;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.lede {
  max-width: 50rem;
  margin: 1.1rem 0 0;
  color: var(--fg-muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.5rem;
}

/* ---------- Buttons ---------- */

.button,
.site-search button,
.filter-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  padding: 0.4rem 0.95rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color 80ms ease,
    background-color 80ms ease,
    color 80ms ease;
}

.button:hover,
.site-search button:hover,
.filter-actions button:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--fg-strong);
  text-decoration: none;
}

.button.primary,
.site-search button,
.filter-actions button {
  border-color: rgba(240, 246, 252, 0.1);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover,
.site-search button:hover,
.filter-actions button:hover {
  background: var(--accent-hover);
  border-color: rgba(240, 246, 252, 0.1);
  color: #ffffff;
}

:root[data-theme="light"] .button.primary,
:root[data-theme="light"] .site-search button,
:root[data-theme="light"] .filter-actions button {
  border-color: rgba(31, 35, 40, 0.15);
}

.button.quiet {
  background: transparent;
}

.button.quiet:hover {
  background: var(--surface);
}

.button.compact {
  min-height: 1.85rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}

/* ---------- Panels & cards ---------- */

.search-panel,
.card,
.need-card,
.panel,
.sources,
.filter-form,
.trust-card,
.link-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-panel {
  padding: 1.1rem;
}

.search-panel-head {
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
}

.search-panel h2 {
  margin-bottom: 0.4rem;
}

.search-panel p {
  margin: 0;
  color: var(--fg-muted);
}

.site-search {
  display: grid;
  gap: 0.55rem;
}

.site-search label,
.filter-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--fg-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

input,
select {
  width: 100%;
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--fg);
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 80ms ease, box-shadow 80ms ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-bg);
}

input::placeholder {
  color: var(--fg-subtle);
}

.search-status {
  margin-top: 0.8rem;
}

.search-results {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.search-result {
  display: grid;
  gap: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: 0.65rem 0.75rem;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 80ms ease, background-color 80ms ease;
}

.search-result:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  color: var(--fg-strong);
  text-decoration: none;
}

.search-result strong {
  font-weight: 600;
}

.search-result span:last-child {
  color: var(--fg-muted);
  font-size: 0.88rem;
}

.search-kind {
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.quick-links a,
.tag-list li {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--fg-muted);
  padding: 0.18rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.quick-links a {
  font-family: var(--font-sans);
  font-weight: 500;
  transition: border-color 80ms ease, color 80ms ease, background-color 80ms ease;
}

.quick-links a:hover {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--fg-strong);
  text-decoration: none;
}

.muted,
.small {
  color: var(--fg-muted);
}

.small {
  font-size: 0.86rem;
}

/* ---------- Grids ---------- */

.stat-grid,
.card-grid,
.browse-grid,
.list-grid,
.fit-grid,
.fact-grid,
.filter-grid,
.need-grid {
  display: grid;
  gap: 0.9rem;
}

.stats {
  padding: 1.5rem 0 0;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  min-height: 7.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 80ms ease, background-color 80ms ease, transform 120ms ease;
}

.stat:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.stat span,
.fact-grid dt {
  display: block;
  color: var(--fg-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat strong {
  color: var(--fg-strong);
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat em {
  color: var(--fg-muted);
  font-style: normal;
  font-size: 0.88rem;
  line-height: 1.5;
}

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

.filter-form + .card-grid,
.filter-form + .list-grid {
  margin-top: 1.5rem;
}

.browse-grid,
.need-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.filter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-muted);
  padding-top: 1rem;
}

.filter-actions p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--fg-muted);
  padding: 1.75rem;
  text-align: center;
}

.card,
.need-card,
.panel,
.sources,
.trust-card,
.filter-form,
.link-list {
  padding: 1.1rem;
}

.card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  gap: 0.7rem;
  transition: border-color 80ms ease, background-color 80ms ease, transform 120ms ease;
}

.card:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.card h2 {
  font-size: 1.05rem;
}

.card h2 a {
  color: var(--fg-strong);
}

.card h2 a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.collection-card h2 {
  font-size: 1.15rem;
}

.collection-card h3 {
  font-size: 1.05rem;
}

.collection-card h3 a {
  color: var(--fg-strong);
}

.collection-card h3 a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.concept-group + .concept-group {
  margin-top: 2.5rem;
}

.concept-count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.hub-card h3,
.need-card h3 {
  font-size: 1.05rem;
}

.hub-card h3 a,
.need-card h3 a {
  color: var(--fg-strong);
}

.hub-card h3 a:hover,
.need-card h3 a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.card p,
.need-card p,
.panel li,
.sources li {
  color: var(--fg-muted);
  line-height: 1.6;
}

.card p,
.need-card p {
  margin: 0;
}

.card dl {
  display: grid;
  gap: 0.5rem;
  margin: 0.2rem 0 0;
  border-top: 1px solid var(--border-muted);
  padding-top: 0.75rem;
}

.card dt {
  color: var(--fg-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card dd {
  margin: 0.15rem 0 0;
  color: var(--fg);
  font-size: 0.88rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.verified-mini {
  flex: 0 0 auto;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: -0.01em;
}

.card-footer {
  margin-top: auto;
  padding-top: 0.2rem;
}

.card-action,
.sources a,
.link-list a,
.breadcrumb a,
.section-head a {
  color: var(--accent-strong);
  text-decoration: none;
}

.content-body a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.card-action {
  font-weight: 600;
  font-size: 0.88rem;
}

.card-action:hover,
.sources a:hover,
.link-list a:hover,
.breadcrumb a:hover,
.section-head a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content-body a:hover {
  text-decoration-thickness: 2px;
}

.need-card ul,
.hub-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.need-card li,
.hub-card li {
  color: var(--fg-muted);
  font-size: 0.86rem;
}

.hub-card li a {
  color: var(--fg-muted);
}

.hub-card li a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

.need-card li + li::before {
  color: var(--border-strong);
  content: "·";
  padding-right: 0.4rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-head p {
  max-width: 48rem;
  margin: 0.4rem 0 0;
  color: var(--fg-muted);
}

.section-head a {
  font-weight: 600;
  font-size: 0.9rem;
}

.intro {
  padding-bottom: 1.25rem;
}

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  padding-top: 2rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

.breadcrumb span[aria-hidden="true"] {
  color: var(--fg-subtle);
}

.detail {
  padding: 2rem 0 4rem;
}

.detail-hero,
.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.34fr);
  gap: 2rem;
  align-items: start;
}

.detail-hero h1,
.detail-header h1 {
  font-size: 2.5rem;
}

.trust-card {
  color: var(--fg-muted);
  background: var(--surface);
}

.trust-card p {
  margin: 0;
}

.trust-card p + p {
  margin-top: 0.65rem;
}

.trust-label {
  color: var(--fg-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.trust-date {
  color: var(--fg-strong);
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 500;
}

.trust-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border-muted);
  gap: 1px;
}

.fact-grid div {
  min-width: 0;
  background: var(--surface);
  padding: 0.95rem 1.05rem;
}

.fact-grid dd {
  margin: 0.4rem 0 0;
  color: var(--fg-strong);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.fit-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 2rem 0;
}

.panel h2 {
  font-size: 1rem;
  margin-bottom: 0.65rem;
}

.panel ul,
.list-panel ul {
  margin: 0;
  padding-left: 1.15rem;
}

.panel li {
  margin: 0.25rem 0;
}

/* ---------- Long-form content ---------- */

.content-body {
  max-width: 72ch;
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.75;
}

.content-body h2,
.content-body h3 {
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

.content-body h2 {
  border-top: 1px solid var(--border-muted);
  padding-top: 1.5rem;
  font-size: 1.45rem;
}

.content-body h3 {
  font-size: 1.15rem;
}

.content-body p {
  margin: 0 0 1rem;
}

.content-body img {
  display: block;
  max-width: 100%;
  height: auto;
}

.content-body ul,
.content-body ol {
  padding-left: 1.5rem;
}

.content-body li {
  margin: 0.25rem 0;
}

.content-body pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  background: var(--code-bg);
  padding: 0.9rem 1rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.content-body code {
  font-family: var(--font-mono);
}

.content-body :not(pre) > code {
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  background: var(--surface);
  padding: 0.1rem 0.32rem;
  font-size: 0.86em;
  color: var(--fg-strong);
}

.content-body blockquote {
  border-left: 3px solid var(--border-strong);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  color: var(--fg-muted);
}

.content-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

.content-body th,
.content-body td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  vertical-align: top;
  text-align: left;
}

.content-body th {
  background: var(--surface);
  color: var(--fg-strong);
  font-weight: 600;
}

.content-body tr:nth-child(even) td {
  background: var(--surface-muted);
}

.content-body hr {
  border: 0;
  border-top: 1px solid var(--border-muted);
  margin: 2rem 0;
}

.link-list,
.sources {
  margin-top: 2rem;
}

.link-list h2,
.sources h2 {
  font-size: 1rem;
  margin: 0 0 0.7rem;
}

.link-list ul,
.sources ol {
  margin-bottom: 0;
  padding-left: 1.15rem;
}

.link-list li,
.sources li {
  margin: 0.3rem 0;
}

.verified {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}

.sources span {
  color: var(--fg-muted);
}

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

.site-footer {
  border-top: 1px solid var(--border-muted);
  background: var(--surface-muted);
  color: var(--fg-muted);
  margin-top: 0;
  padding: 1.5rem 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-inner p {
  margin: 0;
  font-size: 0.9rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-footer a {
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  color: var(--fg-muted);
  font-size: 0.88rem;
}

.site-footer a:hover {
  background: var(--surface-hover);
  color: var(--fg-strong);
  text-decoration: none;
}

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

@media (max-width: 980px) {
  .hero-grid,
  .detail-hero,
  .detail-header,
  .card-grid,
  .browse-grid,
  .need-grid,
  .list-grid,
  .fit-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .fact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 2.4rem;
  }

  .detail-hero h1,
  .detail-header h1 {
    font-size: 2.1rem;
  }
}

@media (min-width: 881px) {
  .mobile-nav-toggle {
    display: none;
  }
}

@media (max-width: 880px) {
  .primary-nav,
  .header-github {
    display: none;
  }

  .header-inner {
    padding: 0.55rem 0;
    gap: 0.5rem;
  }

  .brand {
    flex: 1;
    min-width: 0;
  }

  .header-actions {
    gap: 0.35rem;
  }

  .mobile-nav-toggle[aria-expanded="true"] .icon-open {
    display: none;
  }
  .mobile-nav-toggle[aria-expanded="true"] .icon-close {
    display: block;
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 4;
    background: rgba(1, 4, 9, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .mobile-nav-backdrop[hidden] {
    display: none;
  }

  .mobile-nav {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    width: min(20rem, 86vw);
    border-left: 1px solid var(--border);
    background: var(--bg);
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .mobile-nav[hidden] {
    display: none;
  }

  .mobile-nav-inner {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 4rem 1rem 1.25rem;
  }

  .mobile-nav-eyebrow {
    margin: 0 0 0.35rem;
    padding: 0 0.25rem;
    color: var(--fg-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .mobile-nav .nav-link {
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg);
    min-height: 2.75rem;
    display: flex;
    align-items: center;
  }

  .mobile-nav .nav-link.active {
    background: var(--accent-bg);
    color: var(--fg-strong);
    border: 1px solid var(--accent-border);
    padding: calc(0.75rem - 1px) calc(0.85rem - 1px);
  }

  .mobile-nav-footer {
    margin-top: 0.75rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-muted);
  }

  .mobile-nav-link-external {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    color: var(--fg-muted);
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
  }

  .mobile-nav-link-external:hover {
    background: var(--surface-hover);
    color: var(--fg-strong);
    text-decoration: none;
  }

  body.nav-open {
    overflow: hidden;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 3rem 0 2.5rem;
  }
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 1rem, 76rem);
  }

  .stat-grid,
  .fact-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .detail-hero h1,
  .detail-header h1 {
    font-size: 1.75rem;
  }

  .lede {
    font-size: 1rem;
  }

  .hero {
    padding: 2.25rem 0 1.75rem;
  }

  .section {
    padding: 2.5rem 0;
  }

  .actions .button {
    flex: 1 1 auto;
    justify-content: center;
  }
}

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