/* ==========================================================================
   Android Security Atlas: styles
   ========================================================================== */

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

  --bg: #0a0b0c;
  --bg-elev: #101214;
  --bg-soft: #15181b;
  --bg-hover: #191d21;
  --text: #ecebe6;
  --text-dim: #a4a6a2;
  --text-faint: #7d817b;
  --line: #23272b;
  --line-soft: #1a1e21;
  --line-strong: #343a3f;
  --gold: #d9b878;
  --gold-bright: #ecd09a;
  --gold-soft: rgba(217, 184, 120, 0.11);
  --teal: #8fb8a8;
  --coral: #d08d7d;
  --sky: #8aa9c9;
  --lilac: #a99ac9;
  --sand: #bdb18d;
  --hackerone: #e0665a;
  --research: #8aa9c9;
  --github: #a99ac9;
  --shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  --drawer-shadow: -40px 0 90px -30px rgba(0, 0, 0, 0.75);
  --radius: 14px;
  --head-h: 68px;
  --wrap: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f4ef;
  --bg-elev: #fffefa;
  --bg-soft: #efebe3;
  --bg-hover: #eae5db;
  --text: #17181a;
  --text-dim: #5a5c58;
  --text-faint: #686a63;
  --line: #dfdbd2;
  --line-soft: #e9e5dd;
  --line-strong: #c6c1b6;
  --gold: #8a6428;
  --gold-bright: #6f4f1d;
  --gold-soft: rgba(138, 100, 40, 0.1);
  --teal: #4f7d6b;
  --coral: #a45c4c;
  --sky: #4f708f;
  --lilac: #6d5f91;
  --sand: #857349;
  --hackerone: #b5473b;
  --research: #4f708f;
  --github: #6d5f91;
  --shadow: 0 28px 70px -45px rgba(40, 34, 20, 0.35);
  --drawer-shadow: -30px 0 80px -40px rgba(40, 34, 20, 0.3);
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--head-h) + 18px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 110px 110px;
  opacity: 0.42;
  -webkit-mask-image: radial-gradient(ellipse 100% 55% at 50% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 100% 55% at 50% 0%, #000 0%, transparent 72%);
}

body.is-locked { overflow: hidden; }

main { position: relative; z-index: 1; }

::selection { background: var(--gold-soft); color: var(--gold-bright); }

a { color: inherit; text-decoration: none; }

button, input { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

svg { display: block; }

h1, h2, h3, p, dl, dd, dt, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 32px;
}

.mono { font-family: var(--mono); font-variant-ligatures: none; }

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

.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-head { background: var(--bg); }
}

.head-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--head-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--gold);
}
.brand-mark svg { width: 100%; height: 100%; }

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-text strong { font-weight: 550; }
.brand-text span {
  color: var(--text-faint);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 10px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  position: relative;
  padding: 7px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 13px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--bg-soft); }
.nav-link.is-active { color: var(--text); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 1px;
  height: 1px;
  background: var(--gold);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-faint);
  font-size: 12.5px;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.search-trigger svg { width: 14px; height: 14px; }
.search-trigger:hover { border-color: var(--line-strong); color: var(--text-dim); }
kbd {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 4px 6px;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); background: var(--bg-soft); border-color: var(--line); }

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

.gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-dim);
  font-size: 12.5px;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.gh-btn svg { width: 15px; height: 15px; }
.gh-btn .arrow { width: 12px; height: 12px; opacity: 0.55; }
.gh-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--bg-soft); }

.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1px;
  width: 100%;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: 40px;
  min-height: 620px;
  padding-top: 72px;
  padding-bottom: 84px;
}

.hero-copy { max-width: 590px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 26px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.pulse {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex-shrink: 0;
}
.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  animation: pulse 3s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.7; }
  70%, 100% { transform: scale(1.7); opacity: 0; }
}

.hero h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(40px, 5.2vw, 62px);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin-bottom: 24px;
}
.hero h1 .accent { color: var(--gold); }

.lede {
  max-width: 520px;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.72;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn svg { width: 14px; height: 14px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #14120c;
}
.btn-primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
html[data-theme="light"] .btn-primary { color: #fffdf7; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--line-strong); color: var(--text); background: var(--bg-soft); }

.btn-sm { height: 36px; padding: 0 14px; font-size: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.stats > div { padding-right: 12px; }
.stats > div + div { padding-left: 18px; border-left: 1px solid var(--line-soft); }
.stats dt {
  order: 2;
  margin-top: 2px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.stats dd {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 550;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.hero-art {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 520px;
  justify-self: end;
  opacity: 0;
  transform: scale(0.97);
  animation: art-in 1.4s 0.15s var(--ease) forwards;
}
.hero-art svg { width: 100%; height: 100%; overflow: visible; }
.hero-art .ring { fill: none; stroke: var(--line); stroke-width: 1; }
.hero-art .ring-faint { fill: none; stroke: var(--line); stroke-width: 1; opacity: 0.55; }
.hero-art .ring-dash { fill: none; stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 9; opacity: 0.7; }
.hero-art .spoke { stroke: var(--line); stroke-width: 1; opacity: 0.7; }
.hero-art .arc { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: 0.55; }
.hero-art .cross { stroke: var(--line-strong); stroke-width: 1; }
.hero-art .orbit-dot { fill: var(--gold); opacity: 0.8; }
.hero-art .spin { transform-origin: 280px 280px; animation: spin 140s linear infinite; }
.hero-art .spin-rev { transform-origin: 280px 280px; animation: spin 90s linear infinite reverse; }
.hero-art .glow { opacity: 0.5; }

html[data-theme="light"] .hero-art .ring { stroke: #cbc5b8; opacity: 0.8; }
html[data-theme="light"] .hero-art .ring-faint { stroke: #d3cdc0; opacity: 0.8; }
html[data-theme="light"] .hero-art .spoke { stroke: #d3cdc0; opacity: 0.85; }
html[data-theme="light"] .hero-art .cross { stroke: #cbc5b8; }
html[data-theme="light"] .hero-art .glow { opacity: 0.75; }

@keyframes art-in {
  to { opacity: 1; transform: scale(1); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.section {
  padding-top: 92px;
  padding-bottom: 92px;
  scroll-margin-top: calc(var(--head-h) + 12px);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.section-intro { max-width: 620px; }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.kicker span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--gold);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.section h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(28px, 3.2vw, 38px);
  line-height: 1.18;
  letter-spacing: -0.012em;
}

.section-sub {
  margin-top: 14px;
  max-width: 580px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
  font-weight: 400;
}

.tree-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.mini-btn {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.mini-btn:hover { color: var(--text); background: var(--bg-soft); }
.mini-btn:disabled { color: var(--text-faint); opacity: 0.4; cursor: default; }
.mini-btn:disabled:hover { background: none; color: var(--text-faint); }

.control-divider {
  width: 1px;
  height: 12px;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-field:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.search-field > svg {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  background: none;
  border: 0;
  outline: 0;
  font-size: 13.5px;
}
.search-field input::placeholder { color: var(--text-faint); }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-kbd { flex-shrink: 0; }
.search-field:focus-within .search-kbd { display: none; }

.search-clear[hidden] { display: none; }

.search-clear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: 4px;
  border-radius: 5px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.search-clear svg { width: 13px; height: 13px; }
.search-clear:hover { color: var(--text); background: var(--bg-soft); }

.chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.chip:hover { color: var(--text-dim); background: var(--bg-soft); }
.chip[aria-pressed="true"] {
  color: var(--text);
  background: var(--bg-elev);
  border-color: var(--line);
}
.chip .chip-count {
  font-size: 9.5px;
  color: var(--text-faint);
}
.chip[aria-pressed="true"] .chip-count { color: var(--gold); }
.chip .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--chip-color, var(--text-faint));
}

.tree-status {
  min-height: 18px;
  margin-bottom: 12px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.tree-status strong { color: var(--text-dim); font-weight: 500; }

/* --------------------------------------------------------------------------
   Tree
   -------------------------------------------------------------------------- */

.load-error {
  padding: 24px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}
.load-error a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

.tree-shell {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tree {
  padding: 10px 10px 14px;
}

.root-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.root-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--gold);
  flex-shrink: 0;
}
.root-mark::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px var(--gold-soft);
}
.root-label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.root-meta {
  display: block;
  margin-top: 1px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.root-count {
  margin-left: auto;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
}

.branches { position: relative; padding-top: 2px; }

.branch {
  position: relative;
}
.branch + .branch { margin-top: 1px; }
.branch::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 38px;
  bottom: 6px;
  width: 1px;
  background: var(--line-soft);
  opacity: 0;
}
.branch[data-open="true"]::before { opacity: 1; }

.branch-head {
  position: relative;
  z-index: 1;
  border-radius: 8px;
  transition: background 0.16s var(--ease);
}
.branch-head:hover { background: var(--bg-soft); }

.branch-toggle {
  display: grid;
  grid-template-columns: 16px 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 14px 11px 10px;
  text-align: left;
  border-radius: 8px;
}

.chevron {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  transition: transform 0.24s var(--ease), color 0.18s var(--ease);
}
.branch-toggle:hover .chevron { color: var(--text-dim); }
.branch[data-open="false"] .chevron { transform: rotate(-90deg); }

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--gold));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--gold)) 13%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .cat-dot { box-shadow: none; }
}

.branch-name {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
  font-size: 15px;
  font-weight: 550;
  letter-spacing: 0;
  color: var(--text);
}
.branch-index {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.branch-count {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.branch-count b { color: var(--text-dim); font-weight: 500; }

.branch-desc {
  padding: 2px 44px 12px 46px;
  margin-top: 0;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.65;
  font-weight: 400;
}

.leaves-wrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.32s var(--ease), opacity 0.24s var(--ease);
}
.branch[data-open="true"] .leaves-wrap {
  grid-template-rows: 1fr;
  opacity: 1;
}
.leaves-clip { overflow: hidden; min-height: 0; }

.leaves {
  position: relative;
  margin: 0;
  padding: 0 0 7px;
}

.leaf {
  position: relative;
  display: flex;
  align-items: stretch;
  margin-left: 34px;
  border-radius: 7px;
  transition: background 0.16s var(--ease);
}
.leaf::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--line);
}
.leaf:hover { background: var(--bg-soft); }
.leaf:has(.leaf-main:focus-visible) { background: var(--bg-soft); }
.leaf[hidden] { display: none; }

.leaf-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 9px 8px 9px 12px;
  text-align: left;
  border-radius: 7px 0 0 7px;
}

.leaf-title {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 400;
  transition: color 0.16s var(--ease);
}
.leaf:hover .leaf-title { color: var(--text); }

.leaf-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.source-badge::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--badge, var(--text-faint));
}
.source-badge[data-kind="hackerone"] { --badge: var(--hackerone); }
.source-badge[data-kind="research"] { --badge: var(--research); }
.source-badge[data-kind="github"] { --badge: var(--github); }
.source-badge[data-kind="video"] { --badge: var(--coral); }

.leaf-open {
  display: grid;
  place-items: center;
  width: 38px;
  border-radius: 0 7px 7px 0;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.16s var(--ease), color 0.16s var(--ease);
}
.leaf-open svg { width: 13px; height: 13px; }
.leaf:hover .leaf-open,
.leaf-open:focus-visible { opacity: 1; }
.leaf-open:hover { color: var(--gold); }

/* Empty state */
.empty-state {
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 15px;
}
.empty-state h3 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}
.empty-state p {
  margin-bottom: 20px;
  color: var(--text-faint);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Library
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--text-faint);
  font-size: 13px;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.tab:hover { color: var(--text-dim); background: var(--bg-soft); }
.tab[aria-pressed="true"] { color: var(--text); background: var(--bg-elev); }
.tab .tab-count {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
}
.tab[aria-pressed="true"] .tab-count { color: var(--gold); }

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  scroll-margin-top: calc(var(--head-h) + 24px);
}

.res-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 158px;
  padding: 18px 18px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.25s var(--ease);
}
.res-card:hover {
  background: var(--bg-soft);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.res-card[hidden] { display: none; }
.res-card.no-desc { min-height: 0; padding-bottom: 14px; }
.res-card.no-desc .res-host { margin-top: 6px; }

.lib-pager {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.lib-pager[hidden] { display: none; }
.pager-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pager-btn,
.pager-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-faint);
  background: transparent;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.pager-btn {
  gap: 5px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pager-btn svg { width: 12px; height: 12px; }
.pager-page {
  width: 32px;
  padding: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pager-btn:hover:not(:disabled),
.pager-page:hover {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--line-strong);
}
.pager-page.is-current {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}
.pager-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pager-status {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
}

.res-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.res-section {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.res-arrow {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-faint);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.2s var(--ease);
}
.res-arrow svg { width: 10px; height: 10px; }
.res-card:hover .res-arrow {
  color: var(--gold);
  border-color: var(--gold);
  transform: translate(1px, -1px);
}

.res-title {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.005em;
  font-weight: 600;
  color: var(--text);
}
.res-desc {
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.65;
  font-weight: 400;
}
.res-host {
  margin-top: auto;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 64px;
  align-items: start;
  padding-bottom: 110px;
}

.about-copy h2 { margin-bottom: 22px; }
.about-copy p {
  max-width: 560px;
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.75;
  font-weight: 400;
}
.about-copy p + p { margin-top: 14px; }
.about-copy a {
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.about-copy a:hover { color: var(--gold); border-color: var(--gold); }

.credits {
  padding: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.credits-label {
  margin-bottom: 16px;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.credits dl { display: grid; gap: 12px; }
.credits dl > div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.credits dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.credits dt {
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0;
  padding-top: 1px;
}
.credits dd { color: var(--text-dim); font-size: 12.5px; line-height: 1.6; }
.credits-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

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

.site-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line-soft);
}

.foot-credits {
  padding-top: 56px;
  padding-bottom: 42px;
  border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: calc(var(--head-h) + 12px);
}
.foot-credits-head {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 28px;
}
.foot-credits h2 {
  font-family: var(--sans);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
}
.foot-credits-note {
  max-width: 640px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.7;
}
.credit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 26px;
}
.credit-item {
  padding: 13px 0 14px;
  border-top: 1px solid var(--line-soft);
}
.credit-name {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  transition: color 0.18s var(--ease);
}
.credit-name:hover { color: var(--gold); }
.credit-role {
  display: block;
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.55;
}
.foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 30px;
  padding-bottom: 34px;
}
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand .brand-mark { width: 24px; height: 24px; }
.foot-brand p {
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
}
.foot-brand p span {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 400;
}
.foot-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.foot-nav a {
  color: var(--text-faint);
  font-size: 11.5px;
  transition: color 0.18s var(--ease);
}
.foot-nav a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Detail drawer
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 4, 5, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s linear 0.3s;
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease); }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  background: var(--bg-elev);
  border-left: 1px solid var(--line);
  box-shadow: var(--drawer-shadow);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.38s var(--ease), visibility 0s linear 0.38s;
}
.drawer.is-open { transform: translateX(0); visibility: visible; transition: transform 0.38s var(--ease); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-path {
  overflow: hidden;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 30px 26px 36px;
  overscroll-behavior: contain;
}

.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.drawer-class {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-title {
  font-family: var(--sans);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  overflow-wrap: break-word;
}

.drawer-desc {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
  font-weight: 400;
  margin-bottom: 26px;
}

.drawer-meta {
  display: grid;
  gap: 0;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
  margin-bottom: 28px;
}
.drawer-meta > div {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-meta dt {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-top: 2px;
}
.drawer-meta dd {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.drawer-meta dd.mono { font-size: 11px; color: var(--text-faint); }

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.drawer-note {
  margin-top: 16px;
  color: var(--text-faint);
  font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   Reveal animation
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

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

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
    gap: 24px;
    min-height: 560px;
    padding-top: 56px;
    padding-bottom: 64px;
  }
  .hero-art { max-width: 400px; opacity: 0.9; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { gap: 40px; }
  .credit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .wrap { padding-inline: 22px; }
  .main-nav { display: none; }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 48px;
    padding-bottom: 24px;
    min-height: 0;
  }
  .hero-copy { max-width: 100%; }
  .hero-art {
    position: absolute;
    top: 40px;
    right: -140px;
    width: 380px;
    max-width: none;
    opacity: 0.42;
    z-index: 0;
    pointer-events: none;
  }
  .hero { position: relative; overflow-x: hidden; overflow-x: clip; }
  .hero-copy { position: relative; z-index: 1; }
  .hero h1 { font-size: clamp(30px, 9.2vw, 44px); }
  .stats { margin-top: 36px; }
  .section { padding-top: 60px; padding-bottom: 60px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 18px; }
  .tree-controls { padding-bottom: 0; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .chips { flex-wrap: wrap; }
  .tree { padding: 8px 6px 12px; }
  .tree-shell { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .tree-shell .tree { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); }
  .about { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-credits-head { grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
  .credit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager-pages { display: none; }
  .pager-btn { height: 36px; padding: 0 14px; }
}

@media (max-width: 560px) {
  .head-inner { gap: 12px; }
  .brand-text strong { display: none; }
  .brand-text span { font-size: 9.5px; letter-spacing: 0.09em; }
  .brand-text span::before { content: "Biscuit Security "; }
  .gh-btn span, .gh-btn .arrow { display: none; }
  .gh-btn { width: 34px; padding: 0; justify-content: center; }
  .search-trigger span { display: none; }
  .search-trigger { width: 34px; padding: 0; justify-content: center; }
  .search-trigger kbd { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 18px 0; }
  .stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats > div:nth-child(3), .stats > div:nth-child(4) { padding-top: 14px; border-top: 1px solid var(--line-soft); }
  .stats dd { font-size: 26px; }
  .branch-desc { display: none; }
  .branch-index { display: none; }
  .branch-name > span { min-width: 0; overflow-wrap: anywhere; }
  .branch-toggle { padding: 11px 10px; grid-template-columns: 14px 8px minmax(0, 1fr) auto; gap: 9px; }
  .leaf { margin-left: 25px; }
  .leaf-main { padding: 9px 6px 9px 10px; }
  .leaf-title { font-size: 12.5px; }
  .leaf-meta .source-badge { display: none; }
  .leaf-open { width: 30px; opacity: 0.5; }
  .library-grid { grid-template-columns: minmax(0, 1fr); }
  .res-card { min-height: 0; }
  .foot-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .drawer-body { padding: 24px 20px 30px; }
  .btn { height: 40px; }
  .hero-art { display: none; }
}

@media (max-width: 560px) {
  .search-kbd { display: none; }
  .foot-credits { padding-top: 44px; padding-bottom: 34px; }
  .credit-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .credit-item {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .credit-name { display: inline; font-size: 12px; }
  .credit-role { display: none; }
  .chips,
  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 8px;
  }
  .chip { width: 100%; height: 36px; justify-content: flex-start; }
  .tab { width: 100%; justify-content: flex-start; }
  .tab { padding: 10px 12px; }
  .mini-btn { padding: 10px 12px; }
  .leaf-main { min-height: 44px; }
  .drawer-head { padding: 16px 18px; }
  .drawer-head .icon-btn { width: 40px; height: 40px; }
}

@media (max-width: 380px) {
  .head-inner { gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-text span::before { content: "Biscuit "; }
  .head-actions { gap: 5px; }
  .search-trigger,
  .icon-btn,
  .gh-btn { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hero-art { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; }
}
