/**
 * TRON Wiki — Premium feature layer
 * Command palette, reading progress, hero, paths, tools, feedback
 */

/* ── Reading progress ── */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: calc(var(--z-topbar) + 1);
  background: var(--border-subtle);
  pointer-events: none;
}

.read-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-brand) 0%, var(--color-accent) 100%);
  transition: width 80ms linear;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}

/* ── Announcement bar ── */
.announce {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  background: linear-gradient(90deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  color: #E2E8F0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.announce a {
  color: #93C5FD;
  font-weight: var(--weight-semibold);
}

.announce a:hover { color: #BFDBFE; text-decoration: none; }

.announce__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #22C55E;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.92); }
}

.announce__close {
  margin-left: var(--space-2);
  padding: var(--space-1);
  border: none;
  background: transparent;
  color: #64748B;
  cursor: pointer;
  border-radius: var(--radius-sm);
  line-height: 0;
}

.announce__close:hover { color: #fff; background: rgba(255,255,255,0.08); }

.announce__donate {
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border-left: 1px solid rgba(255,255,255,0.12);
}

.announce__donate-addr {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: #E2E8F0;
}

.announce__donate-btn {
  margin-left: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #E2E8F0;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.announce__donate-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}

.announce.is-hidden { display: none; }

/* ── Collapsible sidebar ── */
.shell.is-collapsed {
  grid-template-columns: 68px 1fr;
}

.shell.is-collapsed .sidebar__title,
.shell.is-collapsed .sidebar__subtitle,
.shell.is-collapsed .sidebar__label,
.shell.is-collapsed .sidebar__link span,
.shell.is-collapsed .sidebar__footer {
  display: none;
}

.shell.is-collapsed .sidebar__brand {
  justify-content: center;
  padding: var(--space-4) var(--space-2);
  gap: 0;
}

.shell.is-collapsed .sidebar__brand-text {
  display: none;
}

.shell.is-collapsed .sidebar__link {
  justify-content: center;
  padding: var(--space-2);
}

.shell.is-collapsed .sidebar__link .lucide { opacity: 0.7; }

.shell.is-collapsed .sidebar__collapse {
  margin-left: 0;
}

.shell.is-collapsed .sidebar__collapse .lucide { transform: rotate(180deg); }

.shell.is-collapsed .sidebar {
  overflow: visible;
}

.shell.is-collapsed .sidebar__scroll {
  overflow: visible;
}

/* Tooltips — only when collapsed */
.shell.is-collapsed .sidebar__link[data-tooltip]::after,
.shell.is-collapsed .sidebar__collapse[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--color-line);
  border-radius: 10px;
  padding: 6px 10px;
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    visibility var(--duration-fast) var(--ease-out);
  z-index: calc(var(--z-sidebar) + 5);
}

.shell.is-collapsed .sidebar__link[data-tooltip]::before,
.shell.is-collapsed .sidebar__collapse[data-tooltip]::before {
  content: '';
  position: absolute;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid var(--bg-surface);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    visibility var(--duration-fast) var(--ease-out);
  z-index: calc(var(--z-sidebar) + 5);
}

.shell.is-collapsed .sidebar__link:hover[data-tooltip]::after,
.shell.is-collapsed .sidebar__link:focus-visible[data-tooltip]::after,
.shell.is-collapsed .sidebar__collapse:hover[data-tooltip]::after,
.shell.is-collapsed .sidebar__collapse:focus-visible[data-tooltip]::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.shell.is-collapsed .sidebar__link:hover[data-tooltip]::before,
.shell.is-collapsed .sidebar__link:focus-visible[data-tooltip]::before,
.shell.is-collapsed .sidebar__collapse:hover[data-tooltip]::before,
.shell.is-collapsed .sidebar__collapse:focus-visible[data-tooltip]::before {
  opacity: 1;
  visibility: visible;
}

/* Collapse toggle */
.sidebar__collapse {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.sidebar__collapse:hover {
  background: var(--color-line-subtle);
  color: var(--text);
}

/* ── Search trigger (opens palette) ── */
.topbar__search-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), background var(--duration-fast);
  text-align: left;
  font-family: inherit;
}

.topbar__search-trigger:hover {
  border-color: var(--color-muted-light);
  background: var(--bg-surface);
}

.topbar__search-trigger kbd { margin-left: auto; }

/* ── Command palette ── */
.palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--space-5) var(--space-5);
  background: rgba(9, 9, 11, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out), visibility var(--duration-normal);
}

.palette.is-open {
  opacity: 1;
  visibility: visible;
}

.palette__dialog {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: transform var(--duration-normal) var(--ease-out);
}

.palette.is-open .palette__dialog {
  transform: translateY(0) scale(1);
}

.palette__input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.palette__input-wrap:focus-within {
  background: var(--bg-sidebar);
}

.palette__input-wrap .lucide {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.palette__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text);
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.palette__input:focus {
  outline: none;
  box-shadow: none;
}

.palette__input::placeholder { color: var(--text-muted); }

.palette__results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--bg-surface);
}

.palette__group-label {
  padding: var(--space-2) var(--space-3);
  font-size: 0.6875rem;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.palette__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast);
}

.palette__item:hover,
.palette__item.is-selected {
  background: var(--color-accent-soft);
  text-decoration: none;
  color: inherit;
}

.palette__item-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.palette__item.is-selected .palette__item-icon {
  background: var(--bg-surface);
  border-color: var(--color-accent-muted);
}

.palette__item-body { flex: 1; min-width: 0; }

.palette__item-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette__item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.palette__item mark {
  background: rgba(37, 99, 235, 0.15);
  color: var(--color-accent-ink);
  border-radius: 2px;
  padding: 0 2px;
}

.palette__empty {
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.palette__footer {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.palette__footer kbd { font-size: 0.65rem; }

/* ── Hero (homepage) ── */
.hero-docs {
  position: relative;
  margin: calc(var(--space-10) * -1) calc(var(--page-gutter) * -1) var(--space-10);
  padding: var(--space-12) var(--page-gutter);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--bg-surface) 0%, color-mix(in srgb, var(--bg-sidebar) 72%, var(--bg-surface)) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.hero-docs__plate {
  position: absolute;
  top: 10%;
  right: var(--page-gutter);
  width: min(300px, 30vw);
  height: min(420px, 68%);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: calc(var(--radius-lg) + 4px);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, var(--color-brand-soft) 0%, transparent 42%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 24px 64px rgba(9, 9, 11, 0.05);
  pointer-events: none;
  z-index: 0;
}

.hero-docs--overview::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--border) 72%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 72%, transparent) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 72% 68% at 84% 18%, black 8%, transparent 72%);
  opacity: 0.55;
}

.hero-docs--overview::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 58% 48% at 88% 6%, rgba(255, 6, 10, 0.07), transparent 62%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: auto, 180px 180px;
  opacity: 0.35;
  mix-blend-mode: multiply;
}

[data-theme="dark"] .hero-docs {
  background:
    linear-gradient(180deg, var(--bg-surface) 0%, color-mix(in srgb, var(--bg-sidebar) 55%, #09090B) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .hero-docs__plate {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.05) 0%, transparent 58%),
    linear-gradient(180deg, rgba(255, 6, 10, 0.08) 0%, transparent 42%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.28);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}

[data-theme="dark"] .hero-docs--overview::before {
  opacity: 0.28;
}

[data-theme="dark"] .hero-docs--overview::after {
  opacity: 0.22;
  mix-blend-mode: soft-light;
}

.hero-docs__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
}

.hero-docs__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: var(--space-10);
  align-items: start;
  margin-bottom: var(--space-8);
}

.hero-docs__main {
  min-width: 0;
}

.hero-docs__atlas {
  min-width: 0;
}

.hero-atlas {
  position: relative;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-surface) 94%, var(--bg-sidebar));
  padding: var(--space-5);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hero-atlas::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-4);
  right: var(--space-4);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-brand) 0%, color-mix(in srgb, var(--color-brand) 24%, transparent) 72%, transparent 100%);
}

.hero-atlas__eyebrow {
  margin: 0 0 var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-normal);
  text-transform: none;
  color: var(--text-muted);
}

.hero-atlas__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding: 0;
}

.hero-atlas__stat {
  margin: 0;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.hero-atlas__stat dt {
  margin: 0 0 var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.hero-atlas__stat dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  color: var(--text);
}

.hero-atlas__stack-label {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}

.hero-atlas__stack {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-subtle);
}

.hero-atlas__layer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}

.hero-atlas__layer:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hero-atlas__layer-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--color-accent-ink);
}

.hero-atlas__layer-icon .lucide {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .hero-atlas {
  background: color-mix(in srgb, var(--bg-surface) 88%, #111113);
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .hero-atlas__layer-icon {
  color: var(--text);
}

.hero-docs--overview .quick-routes--bar {
  margin-top: 0;
  margin-bottom: var(--space-5);
}

.hero-docs--overview .hero-proof-grid {
  margin-top: 0;
}

/* ── Quick routes ── */
.quick-routes {
  margin-top: var(--space-5);
}

.quick-routes--bar {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-sidebar);
}

.quick-routes__title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}

.quick-routes--bar .quick-routes__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.quick-routes__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  text-decoration: none;
  color: inherit;
  min-height: 0;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.quick-routes__item:hover {
  background: var(--bg-sidebar);
  border-color: var(--color-muted-light);
  text-decoration: none;
  color: inherit;
}

.quick-routes__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.quick-routes__icon .lucide {
  width: 16px;
  height: 16px;
}

.quick-routes__label {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  line-height: 1.3;
}

.quick-routes__chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.5;
}

.quick-routes__item:hover .quick-routes__chevron {
  opacity: 0.9;
  color: var(--text-secondary);
}

.hero-docs__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.hero-docs h1 {
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1.05;
  margin-bottom: var(--space-4);
  text-wrap: balance;
}

.hero-docs__lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-muted);
  max-width: 42rem;
  margin-bottom: var(--space-6);
}

.hero-docs__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.hero-tronmark {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-sidebar);
  display: grid;
  place-items: center;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

[data-theme="dark"] .hero-tronmark {
  color: var(--text);
  background: var(--bg-surface);
}

.hero-tronmark svg {
  width: 34px;
  height: 34px;
}

.hero-proof-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.hero-proof-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  text-decoration: none;
  transition:
    transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}

.hero-proof-card:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent-muted);
  box-shadow: var(--shadow-xs);
  background: var(--bg-sidebar);
}

.hero-proof-card__icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hero-proof-card__icon .lucide {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.hero-proof-card__body {
  min-width: 0;
  flex: 1;
}

.hero-proof-card__title {
  display: block;
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.2;
}

.hero-proof-card__desc {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: 1.3;
}

.hero-proof-card__arrow {
  margin-left: auto;
  color: var(--text-muted);
  opacity: 0.8;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── Hero safety checklist ── */
.hero-checklist {
  margin-top: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--bg-surface) 100%);
  box-shadow: var(--shadow-xs);
}

.hero-checklist__title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}

.hero-checklist__title .lucide {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
  opacity: 0.9;
}

.hero-checklist__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.hero-checklist__list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.hero-checklist__list li .lucide {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
  opacity: 0.85;
  margin-top: 2px;
  flex-shrink: 0;
}

.hero-checklist__btn {
  margin-top: var(--space-4);
  width: fit-content;
}

@media (max-width: 480px) {
  .hero-proof-grid { grid-template-columns: 1fr; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
  text-decoration: none;
}

.chip:hover {
  border-color: var(--color-accent-muted);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: var(--color-accent-ink);
  text-decoration: none;
}

.chip svg { width: 14px; height: 14px; opacity: 0.6; }

/* ── Category explorer ── */
.cat-explorer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.cat-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition:
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}

.cat-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--tile-accent, transparent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.cat-tile:hover {
  border-color: var(--color-accent-muted);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.cat-tile:hover::before { opacity: 0.06; }

.cat-tile__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--tile-bg, var(--bg-sidebar));
  border: 1px solid var(--border);
  margin-bottom: var(--space-4);
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
}

.cat-tile__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
  position: relative;
  z-index: 1;
}

.cat-tile__desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: var(--leading-snug);
  flex: 1;
  position: relative;
  z-index: 1;
}

.cat-tile__count {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* ── Learning paths ── */
.paths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.path-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  transition: border-color var(--duration-fast);
}

.path-card:hover {
  border-color: var(--color-muted-light);
}

.path-card__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.path-card__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.path-card__icon .lucide {
  width: 18px;
  height: 18px;
}

.path-card__intro {
  min-width: 0;
}

.path-card__title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-1);
  line-height: 1.3;
}

.path-card__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: var(--leading-normal);
}

.path-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.path-card__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.path-card__link:hover {
  background: var(--bg-sidebar);
  color: var(--text);
  text-decoration: none;
}

.path-card__num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  flex-shrink: 0;
}

.path-card__link-text {
  min-width: 0;
  line-height: 1.35;
}

/* ── Tools strip ── */
.tools-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.tool-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--bg-surface) 100%);
  text-decoration: none;
  color: inherit;
  transition: border-style var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.tool-card:hover {
  border-style: solid;
  border-color: var(--color-accent-muted);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

.tool-card__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
  flex-shrink: 0;
}

.tool-card__icon svg { width: 20px; height: 20px; }

.tool-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: 2px;
}

.tool-card__desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.tool-card__arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform var(--duration-fast), color var(--duration-fast);
}

.tool-card:hover .tool-card__arrow {
  transform: translateX(3px);
  color: var(--color-accent);
}

/* ── Article toolbar (sticky) ── */
.article-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.article-toolbar__group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.article-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.article-toolbar__btn:hover {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text);
}

.article-toolbar__btn.is-copied { color: var(--color-success); }

/* ── Heading anchor links ── */
.prose h2, .prose h3 {
  position: relative;
}

.heading-anchor {
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  padding: var(--space-1);
  color: var(--text-muted);
  transition: opacity var(--duration-fast), color var(--duration-fast);
  text-decoration: none;
  line-height: 0;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover { color: var(--color-accent); text-decoration: none; }

/* ── Related articles ── */
.related {
  margin-top: var(--space-10);
  padding: var(--space-6);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.related__title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.related__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

.related__item {
  display: block;
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.related__item:hover {
  border-color: var(--color-accent-muted);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
}

.related__item h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-1);
  border: none;
  padding: 0;
}

.related__item span {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Feedback widget ── */
.feedback {
  margin-top: var(--space-10);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
}

.feedback__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-4);
}

.feedback__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.feedback__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast);
}

.feedback__btn:hover {
  border-color: var(--color-muted-light);
  background: var(--bg-sidebar);
  transform: scale(1.02);
}

.feedback__btn.is-selected {
  border-color: var(--color-accent-muted);
  background: var(--color-accent-soft);
  color: var(--color-accent-ink);
}

.feedback__thanks {
  font-size: var(--text-sm);
  color: var(--color-success-ink);
  display: none;
}

.feedback.is-done .feedback__actions { display: none; }
.feedback.is-done .feedback__thanks { display: block; }

/* ── TOC progress rail ── */
.toc__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.toc__list { position: relative; }

.toc__progress-fill {
  position: absolute;
  left: 0;
  width: 2px;
  margin-left: -0.5px;
  background: var(--color-accent);
  border-radius: 1px;
  transition: height 100ms linear, top 100ms linear;
}

/* ── Theme toggle ── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.theme-toggle:hover {
  background: var(--bg-sidebar);
  color: var(--text);
}

.badge .lucide {
  width: 11px;
  height: 11px;
  opacity: 0.85;
}

.theme-toggle .lucide { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.topbar__menu-btn .lucide { width: 18px; height: 18px; }
.topbar__link .lucide { width: 16px; height: 16px; }

/* ── Language switcher ── */
.lang-switcher {
  position: relative;
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.lang-switcher__btn:hover {
  background: var(--bg-sidebar);
  border-color: var(--color-muted-light);
}

.lang-switcher__btn .lucide { width: 14px; height: 14px; }

.lang-switcher__menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  padding: var(--space-2);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-topbar);
}

.lang-switcher.is-open .lang-switcher__menu { display: block; }

.lang-switcher__item {
  display: block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--duration-fast);
}

.lang-switcher__item:hover {
  background: var(--bg-sidebar);
  color: var(--text);
  text-decoration: none;
}

.lang-switcher__item.is-active {
  font-weight: var(--weight-semibold);
  color: var(--color-accent-ink);
  background: var(--color-accent-soft);
}

.lang-switcher__item.is-disabled {
  opacity: 0.45;
  cursor: default;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}

/* ── Dark theme overrides ── */
[data-theme="dark"] {
  --color-canvas: #09090B;
  --color-surface: #111113;
  --color-sidebar: #0C0C0E;
  --color-ink: #F4F4F5;
  --color-ink-soft: #D4D4D8;
  --color-muted: #A1A1AA;
  --color-line: #27272A;
  --color-line-subtle: #1C1C1F;
  --color-accent: #93C5FD;
  --color-accent-hover: #BFDBFE;
  --color-accent-soft: rgba(147, 197, 253, 0.1);
  --color-accent-muted: rgba(147, 197, 253, 0.22);
  --color-accent-ink: #DBEAFE;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.5);
}

[data-theme="dark"] .topbar {
  background: rgba(17, 17, 19, 0.85);
}

[data-theme="dark"] .chip {
  background: var(--bg-surface);
  border-color: var(--border);
}

[data-theme="dark"] .chip:hover {
  background: var(--bg-sidebar);
  border-color: var(--color-muted-light);
}

[data-theme="dark"] .chip .lucide {
  color: var(--text-secondary);
}

[data-theme="dark"] .badge--accent {
  background: rgba(147, 197, 253, 0.12);
  color: #DBEAFE;
  border-color: rgba(147, 197, 253, 0.28);
}

[data-theme="dark"] .quick-routes--bar {
  background: var(--bg-surface);
}

[data-theme="dark"] .quick-routes__item {
  background: var(--bg-sidebar);
}

[data-theme="dark"] .quick-routes__item:hover {
  background: #18181B;
  border-color: var(--color-muted-light);
}

[data-theme="dark"] .hero-proof-card {
  background: var(--bg-surface);
}

[data-theme="dark"] .hero-proof-card:hover {
  background: var(--bg-sidebar);
  border-color: var(--color-muted-light);
}

[data-theme="dark"] .path-card {
  background: var(--bg-surface);
}

[data-theme="dark"] .palette__item:hover,
[data-theme="dark"] .palette__item.is-selected {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .palette__item mark {
  background: rgba(147, 197, 253, 0.2);
  color: #DBEAFE;
}

[data-theme="dark"] :not(pre) > code {
  background: #1C1C1F;
  border-color: #27272A;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .cat-explorer { grid-template-columns: repeat(2, 1fr); }
  .paths { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .hero-docs__layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .hero-docs--overview::before,
  .hero-docs--overview::after,
  .hero-docs__plate {
    display: none;
  }

  .quick-routes--bar .quick-routes__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-docs {
    margin-left: calc(var(--space-5) * -1);
    margin-right: calc(var(--space-5) * -1);
    padding: var(--space-8) var(--space-5);
  }

  .hero-docs h1 { font-size: var(--text-3xl); }

  .cat-explorer,
  .tools-strip,
  .related__grid { grid-template-columns: 1fr; }

  .sidebar__collapse { display: none; }

  .heading-anchor { display: none; }
}

@media (max-width: 600px) {
  .quick-routes--bar .quick-routes__list {
    grid-template-columns: 1fr;
  }

  .palette {
    padding: var(--space-3);
    align-items: flex-start;
  }

  .palette__dialog {
    max-width: none;
    border-radius: var(--radius-md);
  }

  .palette__input-wrap {
    padding: var(--space-3) var(--space-4);
  }

  .palette__results {
    max-height: min(52vh, 360px);
  }

  .paths {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: stretch;
    padding-right: 0;
    gap: var(--space-3);
  }

  .donate-chip {
    width: 100%;
    border-radius: var(--radius-lg);
  }
}
