/* ==========================================================================
   GhostLayer — main.css
   Premium technical dark theme. Tokens first, then primitives, then pages.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Required palette */
  --bg: #050505;
  --bg-1: #0d0d0d;
  --bg-2: #141414;
  --border: rgba(255, 255, 255, 0.06);
  --border-h: rgba(255, 255, 255, 0.12);
  --text: #ededed;
  --text-2: #6b6b6b;
  --text-3: #2e2e2e;
  --accent: #00ff88;
  --accent-dim: rgba(0, 255, 136, 0.08);
  --red: #ff4444;

  /* Extras */
  --yellow: #ffcc44;
  --green: var(--accent);
  --accent-glow: rgba(0, 255, 136, 0.25);
  --red-dim: rgba(255, 68, 68, 0.1);
  --yellow-dim: rgba(255, 204, 68, 0.1);

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

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --max-w: 1200px;
  --max-w-prose: 72ch;
  --nav-h: 64px;

  --fast: 150ms;
  --med: 250ms;
  --slow: 450ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Fixed grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* Accent glow behind hero */
body::after {
  content: "";
  position: fixed;
  top: -20vh;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 60vh;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, var(--accent-dim) 0%, transparent 65%);
  opacity: 0.9;
}

.site-main, .navbar, .footer, .progress-bar { position: relative; z-index: 1; }
.site-main { flex: 1; }

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--fast) ease; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 200;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }

/* --------------------------------------------------------------------------
   3. Progress bar
   -------------------------------------------------------------------------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 0 4px var(--accent);
  z-index: 100;
  opacity: 0;
  transition: width 80ms linear, opacity var(--med) ease;
}
.progress-bar.is-active { opacity: 1; }

/* --------------------------------------------------------------------------
   4. Navbar
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 5, 5, 0.6);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-icon {
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
  transition: transform var(--med) var(--ease), filter var(--med) ease;
}
.logo:hover .logo-icon {
  transform: translateY(-2px) rotate(-6deg);
  filter: drop-shadow(0 0 12px var(--accent-glow));
}
.logo-accent { color: var(--accent); }
.logo-sm { font-size: 0.95rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  position: relative;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--fast) ease, background var(--fast) ease;
}
.nav-link:hover { color: var(--text); background: var(--bg-2); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.nav-right { display: flex; align-items: center; gap: var(--space-4); }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--bg-1);
}
.lang-sep { color: var(--text-3); }
.lang-icon { display: inline-flex; color: var(--text-3); margin-right: 0.15rem; }
.lang-btn {
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: color var(--fast) ease, background var(--fast) ease;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--accent); background: var(--accent-dim); }

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--radius-sm);
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  transition: background var(--fast) ease;
}
.hamburger:hover { background: var(--bg-2); }
.hamburger { align-items: center; color: var(--text); }
.hamburger .icon { transition: transform var(--med) var(--ease), opacity var(--med) ease; }
.hamburger .hamburger-close { display: none; }
.hamburger[aria-expanded="true"] .hamburger-open { display: none; }
.hamburger[aria-expanded="true"] .hamburger-close { display: inline-block; color: var(--accent); transform: rotate(90deg); }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: var(--space-3) var(--space-5) var(--space-5);
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.95);
  animation: dropIn var(--med) var(--ease);
}
.mobile-menu.open { display: flex; }
.mobile-link {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-weight: 500;
}
.mobile-link:hover { color: var(--accent); }
.mobile-lang { display: flex; gap: 0.5rem; padding-top: var(--space-4); font-family: var(--mono); font-size: 0.8rem; }
.mobile-lang .lang-btn { padding: 0.4rem 0.8rem; border: 1px solid var(--border); }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 768px) {
  .nav-links, .lang-switch { display: none; }
  .hamburger { display: flex; }
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  border: 1px solid transparent;
  transition:
    background var(--fast) ease,
    color var(--fast) ease,
    border-color var(--fast) ease,
    box-shadow var(--med) ease,
    transform var(--fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  box-shadow: 0 0 0 1px var(--accent), 0 8px 30px -6px var(--accent-glow), 0 0 24px -4px var(--accent-glow);
  background: #33ff9f;
}

.btn-secondary, .btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-h);
}
.btn-secondary:hover, .btn-ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.78rem; }
.btn-lg { padding: 0.95rem 1.8rem; font-size: 0.95rem; }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn .arrow { transition: transform var(--fast) var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn:hover .arrow-spin { transform: rotate(-90deg); }

/* --------------------------------------------------------------------------
   5b. Icon system (inline SVG, see templates/_icons.html)
   -------------------------------------------------------------------------- */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
  color: inherit;
  fill: none;
  stroke: currentColor;
  pointer-events: none;
}
/* Size comes from the width/height attributes set by the macro; helpers below override */
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-accent { color: var(--accent); }
.icon-muted { color: var(--text-3); }

/* Text + icon pairs (reading time, views, etc.) */
.meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.meta-inline .icon { position: relative; top: -0.5px; color: var(--text-3); }
.section-link .icon,
.card-arrow .icon,
a.card-arrow .icon { transition: transform var(--fast) var(--ease); }
.tag .icon { color: currentColor; margin-left: -0.05rem; }
.chip .icon { color: var(--text-3); }
.chip.active .icon, .chip:hover .icon { color: currentColor; }
.copy-link .icon { color: currentColor; }
.result-band .icon { color: currentColor; }
.rel-meta .icon { color: inherit; }

/* --------------------------------------------------------------------------
   6. Generic layout pieces
   -------------------------------------------------------------------------- */
.section { padding: var(--space-8) 0; }
.section + .section { padding-top: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.section-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
}
.section-kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
}
.section-sub { color: var(--text-2); max-width: 60ch; }
.section-link {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.section-link:hover { color: var(--accent); }

.page-hero {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-7);
}
.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: var(--space-3);
}
.page-sub { color: var(--text-2); font-size: 1.05rem; max-width: 60ch; }

/* Breadcrumbs */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  margin-bottom: var(--space-5);
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-3); }
.breadcrumb .current {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}

/* Tags & badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: border-color var(--fast) ease, background var(--fast) ease;
}
a.tag:hover { border-color: var(--accent); }
.tag-muted { background: var(--bg-2); color: var(--text-2); }
.tag-lang { text-transform: uppercase; letter-spacing: 0.08em; }
.badge-soon {
  background: var(--yellow-dim);
  color: var(--yellow);
  border-color: rgba(255, 204, 68, 0.25);
}
.badge-live {
  background: var(--accent-dim);
  color: var(--accent);
}
.badge-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
}
.meta-row .dot { color: var(--text-3); }

/* Reveal (IntersectionObserver) */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 80ms; }
.reveal[data-delay="2"] { transition-delay: 160ms; }
.reveal[data-delay="3"] { transition-delay: 240ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition:
    border-color var(--med) ease,
    transform var(--med) var(--ease),
    box-shadow var(--med) ease,
    background var(--med) ease;
}
.card:hover {
  border-color: var(--border-h);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--border);
}
a.card { color: inherit; }
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--fast) ease;
}
.card:hover .card-title { color: var(--accent); }
.card-desc {
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.6;
}
.card-foot {
  margin-top: auto;
  padding-top: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
}
.card-arrow {
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
  transition: color var(--fast) ease, transform var(--fast) var(--ease);
}
.card:hover .card-arrow { color: var(--accent); transform: translateX(4px); }

/* Truncate helpers */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Cluster cards: accent glow */
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}
.cluster-card {
  padding: var(--space-6) var(--space-5);
  overflow: hidden;
}
.cluster-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 0%, var(--accent-dim), transparent 60%);
  opacity: 0;
  transition: opacity var(--med) ease;
  pointer-events: none;
}
.cluster-card:hover {
  border-color: rgba(0, 255, 136, 0.4);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8), 0 0 30px -8px var(--accent-glow);
}
.cluster-card:hover::before { opacity: 1; }
.cluster-icon {
  line-height: 1;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--accent);
  transition: transform var(--med) var(--ease), border-color var(--med) ease, box-shadow var(--med) ease;
}
.cluster-icon .icon { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.cluster-card:hover .cluster-icon {
  transform: scale(1.06) rotate(-3deg);
  border-color: var(--accent);
  box-shadow: 0 0 18px -6px var(--accent-glow);
}

/* Tools grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.tool-card { padding: var(--space-6); }
.tool-card.is-soon { opacity: 0.75; }
.tool-card.is-soon:hover { transform: none; border-color: var(--border-h); box-shadow: none; }
.tool-card.is-soon:hover .card-title { color: var(--text); }
.tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}
.tool-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.1rem;
  transition: border-color var(--med) ease, box-shadow var(--med) ease;
}
.tool-card.is-soon .tool-icon { color: var(--text-2); }
.tool-card:not(.is-soon):hover .tool-icon {
  border-color: var(--accent);
  box-shadow: 0 0 16px -4px var(--accent-glow);
}

/* Article cards (blog / cluster) */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}
.article-card { padding: var(--space-5); }
.article-card .card-title { font-size: 1.15rem; line-height: 1.3; }

/* --------------------------------------------------------------------------
   8. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 600px;
}
.table th, .table td {
  padding: 0.9rem 1.1rem;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--bg);
}
.table tbody tr { transition: background var(--fast) ease; }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-num { width: 1%; white-space: nowrap; font-family: var(--mono); color: var(--text-2); font-size: 0.8rem; }
.table .title-link { font-weight: 500; color: var(--text); }
.table .title-link:hover { color: var(--accent); }
.table tbody tr:hover .title-link { color: var(--accent); }
.table .t-mono { font-family: var(--mono); font-size: 0.8rem; color: var(--text-2); white-space: nowrap; }

/* --------------------------------------------------------------------------
   9. Home: hero & stats
   -------------------------------------------------------------------------- */
.hero {
  padding: clamp(4.5rem, 11vw, 8.5rem) 0 var(--space-8);
  text-align: center;
  position: relative;
}
.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin: 0 auto var(--space-5);
  max-width: 18ch;
  min-height: 2.1em; /* avoid layout jump while typing */
}
.hero-title .tw-wrap { display: inline; }
.hero-title .tw-text { color: var(--text); }
.tw-cursor {
  display: inline-block;
  width: 0.06em;
  height: 0.9em;
  margin-left: 0.08em;
  vertical-align: -0.08em;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .tw-cursor { animation: none; } }

.hero-sub {
  color: var(--text-2);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: 56ch;
  margin: 0 auto var(--space-7);
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* Terminal prompt decoration */
.prompt::before {
  content: "$ ";
  color: var(--accent);
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  overflow: hidden;
  margin-top: var(--space-8);
}
.stat {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  position: relative;
}
.stat + .stat { border-left: 1px solid var(--border); }
.stat-num {
  font-family: var(--mono);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
  text-shadow: 0 0 24px var(--accent-glow);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: var(--space-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   10. Blog filter bar
   -------------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  transition: color var(--fast) ease, border-color var(--fast) ease, background var(--fast) ease;
}
.chip:hover { color: var(--text); border-color: var(--border-h); }
.chip.active {
  color: var(--accent);
  border-color: rgba(0, 255, 136, 0.4);
  background: var(--accent-dim);
}
.filter-lang { display: inline-flex; gap: 0.35rem; }

.empty-state {
  padding: var(--space-9) var(--space-5);
  text-align: center;
  border: 1px dashed var(--border-h);
  border-radius: var(--radius-lg);
  color: var(--text-2);
}
.empty-state .empty-icon {
  font-family: var(--mono);
  font-size: 2rem;
  color: var(--text-3);
  margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------------------
   11. Article page
   -------------------------------------------------------------------------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-8);
  align-items: start;
  padding-bottom: var(--space-9);
}
.article-header {
  padding: var(--space-7) 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-7);
}
.article-title {
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: var(--space-4) 0 var(--space-5);
  max-width: 24ch;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.article-summary {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-left: 2px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  font-size: 1.02rem;
  max-width: var(--max-w-prose);
}

.copy-link { position: relative; }
.copy-link.copied { color: var(--accent); border-color: var(--accent); }

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-height: calc(100vh - var(--nav-h) - 3rem);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-3) transparent;
}
.side-block {
  border-left: 1px solid var(--border);
  padding-left: var(--space-4);
}
.side-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--space-3);
}
/* The TOC block draws its own rail so the active link can light it up */
.side-toc { border-left: 0; padding-left: 0; }
.side-toc .side-title { padding-left: var(--space-4); }
.toc ul { list-style: none; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 0.35rem 0 0.35rem var(--space-4);
  border-left: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.4;
  transition: color var(--fast) ease, border-color var(--fast) ease;
}
.toc a:hover { color: var(--text); }
.toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: -1px 0 8px -2px var(--accent-glow);
}
.toc .toc-h3 a { padding-left: calc(var(--space-4) + 0.9rem); font-size: 0.8rem; }
.toc-empty { color: var(--text-3); font-size: 0.82rem; font-family: var(--mono); }

.related-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.related-list a {
  display: block;
  color: var(--text-2);
  font-size: 0.88rem;
  line-height: 1.4;
}
.related-list a:hover { color: var(--accent); }
.related-list .rel-meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.2rem;
}

/* Prose */
.prose {
  counter-reset: h2;
  font-size: 1.05rem;
  line-height: 1.75;
  min-width: 0;
}
.prose > * { max-width: var(--max-w-prose); }
.prose h2 {
  counter-increment: h2;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: var(--space-8) 0 var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
.prose h2::before {
  content: counter(h2, decimal-leading-zero) ".";
  font-family: var(--mono);
  font-size: 0.8em;
  font-weight: 500;
  color: var(--accent);
  flex-shrink: 0;
}
.prose h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: var(--space-6) 0 var(--space-3);
  color: var(--text);
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
.prose h4 { font-size: 1.05rem; margin: var(--space-5) 0 var(--space-2); }
.prose p { margin: 0 0 var(--space-4); color: var(--text); }
.prose p:last-child { margin-bottom: 0; }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--fast) ease;
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--text-2); }

.prose ul, .prose ol { margin: 0 0 var(--space-4); padding-left: 1.4rem; }
.prose li { margin-bottom: 0.4rem; }
.prose li::marker { color: var(--accent); }
.prose ul { list-style: none; padding-left: 0; }
.prose ul > li {
  position: relative;
  padding-left: 1.4rem;
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 8px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.prose ol { list-style: decimal; }
.prose ol li::marker { font-family: var(--mono); color: var(--accent); font-size: 0.9em; }

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-2);
  color: #7dffc0;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.prose pre {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  margin: 0 0 var(--space-5);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  position: relative;
  max-width: 100%;
}
.prose pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  opacity: 0.6;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}
.prose blockquote {
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  font-style: italic;
}
.prose blockquote p { color: inherit; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}
.prose img { border-radius: var(--radius); border: 1px solid var(--border); margin: var(--space-4) 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 var(--space-5);
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  text-align: left;
}
.prose th {
  background: var(--bg-1);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}

.article-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}
.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-3);
}

/* Mobile TOC (details) */
.toc-mobile {
  display: none;
  margin-bottom: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.toc-mobile summary {
  padding: var(--space-3) var(--space-4);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after { content: "+"; color: var(--accent); }
.toc-mobile[open] summary::after { content: "−"; }
.toc-mobile .toc { padding: 0 var(--space-4) var(--space-4); }

/* --------------------------------------------------------------------------
   12. Cluster hero
   -------------------------------------------------------------------------- */
.cluster-hero {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8) 0 var(--space-7);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-7);
}
.cluster-hero-icon {
  line-height: 1;
  width: 104px;
  height: 104px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  border: 1px solid var(--border-h);
  color: var(--accent);
  box-shadow: 0 0 40px -10px var(--accent-glow);
}
.cluster-hero-icon .icon { filter: drop-shadow(0 0 10px var(--accent-glow)); }
.cluster-hero .page-title { margin-bottom: var(--space-2); }

/* --------------------------------------------------------------------------
   13. Security score
   -------------------------------------------------------------------------- */
.score-wrap { max-width: 820px; margin: 0 auto; padding-bottom: var(--space-9); }

.quiz-form { display: flex; flex-direction: column; gap: var(--space-5); }

.question {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: var(--space-5);
  margin: 0;
  min-width: 0;
  transition: border-color var(--med) ease, box-shadow var(--med) ease;
}
.question:has(input:checked) {
  border-color: rgba(0, 255, 136, 0.3);
}
.question:focus-within { border-color: var(--border-h); }
.question legend {
  float: left; /* legend reset trick */
  width: 100%;
  padding: 0;
  margin-bottom: var(--space-4);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.4;
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}
.question legend + * { clear: both; }
.q-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 2ch;
}
.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
  clear: both;
}
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-2);
  font-size: 0.92rem;
  cursor: pointer;
  transition:
    border-color var(--fast) ease,
    background var(--fast) ease,
    color var(--fast) ease,
    transform var(--fast) var(--ease);
  user-select: none;
}
.option:hover { border-color: var(--border-h); color: var(--text); }
.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.option .radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--text-2);
  flex-shrink: 0;
  position: relative;
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
.option .radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform var(--fast) var(--ease);
}
/* Checked state: :has() with input:checked + label fallback */
.option:has(input:checked),
.option input:checked + .radio ~ .option-label {
  color: var(--text);
}
.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px -6px var(--accent-glow);
}
.option input:checked + .radio { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.option input:checked + .radio::after { transform: scale(1); }
.option input:focus-visible + .radio { outline: 2px solid var(--accent); outline-offset: 2px; }
.option-label { line-height: 1.35; }

.quiz-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
}
.quiz-progress {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
}
.quiz-progress b { color: var(--accent); font-weight: 500; }

/* Result panel */
.result-panel {
  border: 1px solid var(--border-h);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  padding: clamp(1.5rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-7);
}
.result-panel::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 80%;
  background: radial-gradient(ellipse, var(--band-glow, var(--accent-dim)), transparent 70%);
  pointer-events: none;
}
.result-panel.band-green { --band: var(--accent); --band-glow: var(--accent-dim); }
.result-panel.band-yellow { --band: var(--yellow); --band-glow: var(--yellow-dim); }
.result-panel.band-red { --band: var(--red); --band-glow: var(--red-dim); }

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  position: relative;
}
.result-score {
  font-family: var(--mono);
  font-size: clamp(3.5rem, 10vw, 6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--band, var(--accent));
  text-shadow: 0 0 40px var(--band-glow, var(--accent-dim));
  font-variant-numeric: tabular-nums;
}
.result-score small { font-size: 0.4em; color: var(--text-2); margin-left: 0.15em; }
.result-band {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--band, var(--accent));
  color: var(--band, var(--accent));
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--band-glow, var(--accent-dim));
}

.meter {
  margin: var(--space-6) 0;
  position: relative;
}
.meter-track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-2);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 50%, var(--accent) 100%);
  background-size: var(--meter-bg-size, 100%) 100%;
  transition: width 1.2s var(--ease);
  box-shadow: 0 0 16px -2px var(--band-glow, var(--accent-dim));
}
.meter.is-set .meter-fill { width: var(--pct, 0%); }
.meter-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
}
.meter-ticks span:nth-child(1) { color: var(--red); }
.meter-ticks span:nth-child(2) { color: var(--yellow); }
.meter-ticks span:nth-child(3) { color: var(--accent); }

.recs { position: relative; }
.recs-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: var(--space-4);
}
.recs-list {
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.recs-list li {
  display: flex;
  gap: 0.9rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.recs-list .rec-idx {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--band, var(--accent));
  flex-shrink: 0;
  padding-top: 0.2rem;
}
.result-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
  position: relative;
}

/* --------------------------------------------------------------------------
   13b. Client-side tools (password strength, passphrase, onion validator)
   -------------------------------------------------------------------------- */
.tool-wrap { max-width: 820px; margin: 0 auto; padding-bottom: var(--space-9); }
.tool-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.tool-panel:hover { transform: none; box-shadow: none; border-color: var(--border-h); }
.tool-panel:hover .card-title { color: inherit; }

.tool-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: var(--space-4);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-2);
}
.tool-note .icon { color: var(--accent); }

.tool-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

.tool-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.tool-input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--fast) ease, box-shadow var(--fast) ease;
}
.tool-input::placeholder { color: var(--text-3); }
.tool-input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 20px -6px var(--accent-glow); }
.tool-input-row .btn { padding-left: 0.9rem; padding-right: 0.9rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  background: var(--bg);
  transition: color var(--fast) ease, border-color var(--fast) ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn .icon-off { display: none; }
.icon-btn[aria-pressed="true"] .icon-on { display: none; }
.icon-btn[aria-pressed="true"] .icon-off { display: inline-block; }

/* Segmented strength bar */
.strength-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.strength-bar span {
  height: 10px;
  border-radius: 2px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  transition: background var(--med) ease, box-shadow var(--med) ease;
}
.strength-bar span.on { background: var(--band, var(--accent)); border-color: transparent; box-shadow: 0 0 10px -2px var(--band, var(--accent)); }

.strength-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.strength-label {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--band, var(--text-2));
  text-shadow: 0 0 24px var(--band-glow, transparent);
  transition: color var(--med) ease;
}
.strength-hint { font-family: var(--mono); font-size: 0.78rem; color: var(--text-2); }

.band-0 { --band: var(--text-2); --band-glow: transparent; }
.band-1 { --band: var(--red); --band-glow: var(--red-dim); }
.band-2 { --band: #ff8844; --band-glow: rgba(255, 136, 68, 0.12); }
.band-3 { --band: var(--yellow); --band-glow: var(--yellow-dim); }
.band-4 { --band: #a8ff5c; --band-glow: rgba(168, 255, 92, 0.12); }
.band-5 { --band: var(--accent); --band-glow: var(--accent-dim); }

/* Readouts grid */
.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}
.readout {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.readout-k {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 0.35rem;
}
.readout-v {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.readout-v.accent { color: var(--accent); }
.readout-v small { font-size: 0.7em; color: var(--text-2); font-weight: 400; margin-left: 0.2em; }

.warn-list {
  list-style: none;
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-2);
}
.warn-list li { display: flex; gap: 0.5rem; align-items: flex-start; }
.warn-list .icon { color: var(--yellow); margin-top: 0.2rem; }
.warn-list:empty { display: none; }

/* Controls (passphrase) */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}
.control { display: flex; flex-direction: column; gap: 0.5rem; }
.control .tool-label { margin-bottom: 0; }
.control-value { color: var(--accent); }
input[type="range"].range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  flex: 1;
  padding: 0.55rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--bg);
  border-right: 1px solid var(--border);
  transition: color var(--fast) ease, background var(--fast) ease;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--accent); background: var(--accent-dim); }

.toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--text-2);
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.toggle .track {
  width: 38px;
  height: 20px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-h);
  background: var(--bg);
  position: relative;
  flex-shrink: 0;
  transition: background var(--fast) ease, border-color var(--fast) ease;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform var(--fast) var(--ease), background var(--fast) ease;
}
.toggle input:checked + .track { background: var(--accent-dim); border-color: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle:hover { color: var(--text); }

.pass-output {
  padding: var(--space-5);
  border: 1px solid var(--border-h);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 500;
  line-height: 1.5;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-height: 3.6em;
  display: flex;
  align-items: center;
  position: relative;
}
.pass-output::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  opacity: 0.6;
}
.tool-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.btn.copied { color: var(--accent); border-color: var(--accent); }

/* Onion validator result */
.verdict {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--mono);
}
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--text-3);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.verdict-reason { font-size: 0.88rem; color: var(--text-2); }
.verdict.is-valid { border-color: rgba(0, 255, 136, 0.35); }
.verdict.is-valid .verdict-badge { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.verdict.is-invalid { border-color: rgba(255, 68, 68, 0.35); }
.verdict.is-invalid .verdict-badge { color: var(--red); border-color: var(--red); background: var(--red-dim); }
.verdict.is-valid .verdict-reason, .verdict.is-invalid .verdict-reason { color: var(--text); }

.hex {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
  line-height: 1.6;
}
.ok { color: var(--accent); }
.bad { color: var(--red); }

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.examples .chip { max-width: 100%; }
.examples .chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34ch;
}

@media (max-width: 768px) {
  .tool-input-row { flex-wrap: wrap; }
  .tool-input-row .tool-input { flex-basis: 100%; }
  .tool-actions .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: var(--space-7) 0;
  margin-top: var(--space-8);
  color: var(--text-2);
  font-size: 0.85rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-7);
  align-items: start;
}
.footer-brand { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-copy { font-family: var(--mono); font-size: 0.75rem; color: var(--text-2); }
.footer-disclaimer {
  max-width: 60ch;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-2);
  border-left: 1px solid var(--border);
  padding-left: var(--space-5);
}
.footer-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.footer-nav a { color: var(--text-2); }
.footer-nav a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: var(--space-6); }
}

@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    order: 2;
  }
  .sidebar .side-toc { display: none; }
  .toc-mobile { display: block; }
  .footer-inner { grid-template-columns: 1fr; gap: var(--space-5); }
  .footer-disclaimer { border-left: 0; padding-left: 0; }
  .footer-nav { flex-direction: row; flex-wrap: wrap; gap: var(--space-4); }
}

@media (max-width: 768px) {
  .container { padding: 0 var(--space-4); }
  .section { padding: var(--space-7) 0; }
  .hero { padding-top: var(--space-8); }
  .hero-title { min-height: 2.2em; }
  .stats-bar { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--border); }
  .cluster-hero { flex-direction: column; align-items: flex-start; gap: var(--space-4); }
  .cluster-hero-icon { width: 80px; height: 80px; }
  .cluster-hero-icon .icon { width: 40px; height: 40px; }
  .article-title { max-width: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-lang { justify-content: flex-end; }
  .options { grid-template-columns: 1fr; }
  .quiz-submit { flex-direction: column; align-items: stretch; }
  .quiz-submit .btn { width: 100%; }
  .table { min-width: 520px; }
}

@media (max-width: 480px) {
  .hero-actions .btn { width: 100%; }
  .breadcrumb .current { max-width: 22ch; }
}
