/* Canra — spec-native dark theme. Tokens → base → components → landing → responsive. */

:root {
  /* --- Surfaces (deepened, layered) --- */
  --bg: #0b0b0f;
  --bg-2: #0e0e14;
  --bg-surface: #14141b;
  --bg-card: #181820;
  --bg-card-hover: #1f1f2a;
  --bg-input: #121219;
  --bg-code: #0a0a0e;

  /* --- Borders & text --- */
  --border: #26262f;
  --border-strong: #34343f;
  --text: #ECECEF;
  --text-muted: #9a9aa6;
  --text-dim: #61616d;

  /* --- Brand accents --- */
  --accent: #c084fc;          /* purple — primary */
  --accent-dim: #9333ea;
  --accent-2: #38e0d4;        /* teal — secondary */
  --accent-2-dim: #14b8a6;
  --accent-soft: rgba(192, 132, 252, 0.14);
  --accent-ring: rgba(192, 132, 252, 0.45);
  --gradient-brand: linear-gradient(105deg, #c084fc 0%, #a855f7 38%, #38e0d4 100%);
  --gradient-brand-soft: linear-gradient(105deg, rgba(192,132,252,0.18), rgba(56,224,212,0.14));

  /* --- Status --- */
  --green: #4ade80;
  --yellow: #facc15;
  --red: #f87171;
  --blue: #60a5fa;

  /* --- Type --- */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 26px;
  --text-2xl: 34px;
  --text-3xl: 44px;
  --text-4xl: 60px;

  /* --- Spacing --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  /* --- Shape & depth --- */
  --max-width: 1120px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --glow: 0 0 0 1px var(--accent-ring), 0 8px 30px rgba(192, 132, 252, 0.18);
}

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

html {
  scroll-behavior: smooth;
}

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

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

a:hover {
  text-decoration: underline;
}

code, pre {
  font-family: var(--font-mono);
}

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

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

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid var(--bg);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #44444f;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* --- Navbar --- */

.navbar {
  background: color-mix(in srgb, var(--bg-surface) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-5);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 60px;
  gap: var(--sp-5);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo:hover {
  text-decoration: none;
}

.nav-logo svg {
  display: block;
  height: 26px;
  width: 26px;
}

.nav-logo .logo-word {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.nav-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.nav-search input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-search input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
}

.nav-link {
  color: var(--text-muted);
  font-size: var(--text-sm);
  transition: color 0.15s;
}

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

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gradient-brand);
  border: none;
  color: #11061f;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 26px rgba(168, 85, 247, 0.35);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.btn-lg {
  padding: 13px 24px;
  font-size: var(--text-base);
}

/* --- Hero (landing) --- */

.landing {
  padding-bottom: var(--sp-9);
}

.hero {
  position: relative;
  text-align: center;
  padding: var(--sp-9) 0 var(--sp-8);
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  max-width: 100%;
  height: 520px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%);
  filter: blur(8px);
  z-index: -1;
  pointer-events: none;
}

.hero h1 {
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: var(--sp-5);
}

.hero-sub {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto var(--sp-6);
  line-height: 1.6;
}

.hero-search {
  max-width: 580px;
  margin: 0 auto var(--sp-5);
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hero-search input:focus {
  border-color: var(--accent-dim);
  box-shadow: var(--glow);
}

.hero-ctas {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Stats strip --- */

.stats-strip {
  display: flex;
  justify-content: center;
  gap: var(--sp-8);
  flex-wrap: wrap;
  padding: var(--sp-6) var(--sp-5);
  margin: 0 auto var(--sp-9);
  max-width: 760px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
    var(--gradient-brand-soft) border-box;
  border: 1px solid transparent;
}

.stat {
  text-align: center;
}

.stat-num {
  display: block;
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Section scaffolding (landing) --- */

.landing-section {
  margin-bottom: var(--sp-9);
}

.landing-section > .section-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--sp-2);
  text-align: center;
}

.landing-section > .section-lede {
  color: var(--text-muted);
  text-align: center;
  max-width: 560px;
  margin: 0 auto var(--sp-6);
}

/* --- How it works --- */

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.how-step {
  position: relative;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.how-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-md);
  margin-bottom: var(--sp-3);
}

.how-step h3 {
  font-size: var(--text-md);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.how-step p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
}

/* --- Code example --- */

.code-example {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-code);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.code-titlebar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.code-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
}
.code-dot.r { background: #ff5f57; }
.code-dot.y { background: #febc2e; }
.code-dot.g { background: #28c840; }

.code-title {
  margin-left: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.code-example pre {
  margin: 0;
  padding: var(--sp-5);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.75;
}

.code-example code { color: var(--text-muted); }
.code-example .c-prompt { color: var(--accent-2); }
.code-example .c-cmd { color: var(--text); }
.code-example .c-comment { color: var(--text-dim); }
.code-example .c-str { color: var(--green); }
.code-example .c-key { color: var(--accent); }

/* --- Featured specs / generic spec sections --- */

.specs-section {
  padding-bottom: var(--sp-8);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.section-header h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.section-link {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.section-link:hover { color: var(--accent); }

.spec-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

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

/* --- Spec Card --- */

.spec-card {
  position: relative;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.spec-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-ring);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-ring);
  transform: translateY(-2px);
  text-decoration: none;
}

.spec-card-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin-bottom: 6px;
}

.spec-name {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--accent);
}

.spec-version {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-dim);
}

.spec-card-title {
  font-size: var(--text-sm);
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 500;
}

.spec-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spec-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.meta-item {
  font-size: var(--text-xs);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-star { color: var(--yellow); }

.meta-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* --- Badges --- */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-stable { background: rgba(74, 222, 128, 0.14); color: var(--green); }
.badge-draft { background: rgba(250, 204, 21, 0.14); color: var(--yellow); }
.badge-owner { background: var(--accent-soft); color: var(--accent); }
.badge-admin { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.badge-member { background: var(--bg-card); color: var(--text-muted); }

/* --- Tags --- */

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

a.tag:hover {
  border-color: var(--accent-ring);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- Closing CTA band --- */

.cta-band {
  position: relative;
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
    var(--gradient-brand) border-box;
  overflow: hidden;
}

.cta-band h2 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--sp-3);
}

.cta-band p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto var(--sp-5);
}

.cta-band .hero-ctas { justify-content: center; }

/* --- Spec Detail Page --- */

.spec-detail {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-7);
  padding: var(--sp-7) 0 var(--sp-8);
}

/* A grid track's implicit min-width is `auto`, so an unbreakable child (a long
   install-code URL, a wide markdown code line) forces the track — and the whole
   page — wider than the viewport. `min-width: 0` lets the columns shrink so the
   overflow-x:auto on inner code blocks scrolls them locally instead. */
.spec-detail-main,
.spec-detail-sidebar {
  min-width: 0;
}

.spec-detail-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  flex-wrap: wrap;
}

.spec-detail-header h1 {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
}

.spec-detail-title {
  font-size: var(--text-lg);
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.spec-detail-desc {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: var(--sp-6);
}

.detail-section {
  margin-bottom: var(--sp-6);
}

.detail-section h2 {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.api-list {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.fn-name, .type-name {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--accent);
}

.type-name { color: var(--blue); }

/* Install block */

.install-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
}

.install-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 6px;
}

.install-label:not(:first-child) { margin-top: var(--sp-3); }

.install-code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  overflow-x: auto;
}

.install-code code {
  font-size: var(--text-sm);
  color: var(--accent-2);
}

.spec-download { margin-top: var(--sp-4); display: inline-block; }

/* Rendered spec body (markdown -> HTML, see website/markdown.js) */

.spec-markdown {
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}

.spec-markdown h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: var(--sp-6) 0 var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.spec-markdown h3 { font-size: var(--text-md); font-weight: 700; margin: var(--sp-5) 0 var(--sp-2); }
.spec-markdown h4 { font-size: var(--text-base); font-weight: 700; margin: var(--sp-4) 0 var(--sp-2); }
.spec-markdown p { margin: 0 0 var(--sp-3); color: var(--text-muted); }
.spec-markdown ul, .spec-markdown ol { margin: 0 0 var(--sp-3) var(--sp-5); color: var(--text-muted); }
.spec-markdown li { margin-bottom: 4px; }
.spec-markdown a { color: var(--accent); }
.spec-markdown a:hover { text-decoration: underline; }
.spec-markdown hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
.spec-markdown code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-code);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent-2);
}

.spec-markdown pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  overflow-x: auto;
  margin: 0 0 var(--sp-4);
}

.spec-markdown pre code { background: none; padding: 0; color: var(--text); font-size: var(--text-sm); }

/* External vectors */

.external-vectors {
  list-style: none;
  padding: 0;
}

.external-vectors li { padding: 4px 0; }
.external-vectors code { font-size: var(--text-sm); color: var(--text-muted); }

/* --- Sidebar --- */

.spec-detail-sidebar {
  border-left: 1px solid var(--border);
  padding-left: var(--sp-6);
}

.sidebar-section { margin-bottom: var(--sp-6); }

.sidebar-section h3 {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: var(--sp-3);
}

.ref-list { list-style: none; padding: 0; margin: 0; }
.ref-list li { font-size: var(--text-sm); color: var(--text-muted); padding: 2px 0; }
.ref-list a.ref-link { color: var(--accent); text-decoration: none; }
.ref-list a.ref-link:hover { text-decoration: underline; }

.view-spec-link { font-size: var(--text-sm); font-weight: 600; }

/* Spec detail tabs (Overview / Version History). Both panels are server-rendered;
   spec-tabs.js toggles visibility. */
.spec-tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  margin: var(--sp-4) 0 var(--sp-5);
}
.spec-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
}
.spec-tab:hover { color: var(--text); }
.spec-tab.is-active,
.spec-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.version-history {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.version-history th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.version-history td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.version-history .ver-actions a { color: var(--accent); text-decoration: none; margin-right: var(--sp-3); }
.version-history .ver-actions a:hover { text-decoration: underline; }

/* Publisher prefix on cards and the detail header (e.g. "alice/"). */
.spec-publisher { color: var(--text-dim); font-weight: 400; }
.meta-installs { color: var(--text-muted); }

/* --- Fork UI --- */
/* Fork button sits in the detail header; push it to the right of the title/version. */
.spec-fork-btn { margin-left: auto; }
/* "Forked from owner/name" back-pointer under the header. */
.spec-forked-from {
  font-size: var(--text-sm);
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
}
.spec-forked-from a { color: var(--accent); text-decoration: none; }
.spec-forked-from a:hover { text-decoration: underline; }

/* Forks tab panel: a list of links to each published fork. */
.fork-list { list-style: none; padding: 0; margin: 0; }
.fork-item {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.fork-item a { color: var(--accent); text-decoration: none; font-family: var(--font-mono); }
.fork-item a:hover { text-decoration: underline; }
.fork-item .fork-title { color: var(--text-muted); font-size: var(--text-sm); }
.fork-item .fork-stars { margin-left: auto; color: var(--text-dim); font-size: var(--text-sm); }

/* Fork banner + collision warning in the submit editor. */
.submit-fork-banner {
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle, rgba(168, 85, 247, 0.08));
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.submit-fork-banner .submit-fork-warn { color: var(--danger, #e5484d); font-weight: 600; }
.submit-fork-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}

.muted { color: var(--text-dim); font-size: var(--text-sm); }

/* --- Page header (hero-less inner pages) --- */

.page-header {
  padding: var(--sp-7) 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}

.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--sp-2);
}

.page-header .page-sub {
  color: var(--text-muted);
  font-size: var(--text-base);
}

.page-header code {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* --- Search Results --- */

.search-results { padding: var(--sp-6) 0 var(--sp-8); }

.search-results h1 {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-5);
}

.results-showing { color: var(--text-muted); font-size: var(--text-sm); margin-bottom: var(--sp-4); }

.no-results {
  color: var(--text-muted);
  font-size: var(--text-md);
  padding: var(--sp-8) 0;
  text-align: center;
}

/* --- Search Dropdown --- */

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-top: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.search-result {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 11px 15px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.search-result:last-child { border-bottom: none; }
.search-result:hover,
.search-result.active { background: var(--bg-card-hover); text-decoration: none; }

.sr-name { font-family: var(--font-mono); font-weight: 700; color: var(--accent); font-size: var(--text-sm); }
.sr-title {
  color: var(--text-muted);
  font-size: var(--text-sm);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-version { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-dim); flex-shrink: 0; }

/* --- Profiles --- */

.user-profile, .org-profile { padding: var(--sp-7) 0 var(--sp-8); }

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.profile-header h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.profile-username {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: var(--text-md);
}

.profile-heading {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-2, #1a1a22);
  flex-shrink: 0;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-bio { color: var(--text-muted); font-size: var(--text-base); margin-bottom: var(--sp-4); max-width: 640px; }

.profile-meta {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding-bottom: var(--sp-6);
  margin-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.profile-meta .meta-item { font-size: var(--text-sm); color: var(--text-muted); }
.profile-meta .meta-link:hover { color: var(--accent); }

.org-members-list { list-style: none; padding: 0; margin-bottom: var(--sp-6); }

.org-member {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.org-member:last-child { border-bottom: none; }

/* --- Keywords browse / tags listing --- */

.tags-listing, .tag-detail { padding: var(--sp-7) 0 var(--sp-8); }

.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}

.tag-browse-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.tag-browse-item:hover {
  border-color: var(--accent-ring);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.tag-browse-name { font-weight: 600; color: var(--text); }
.tag-browse-count { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-dim); }

.tag-detail-count { color: var(--text-muted); margin-bottom: var(--sp-5); }

/* --- Pagination --- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--sp-6);
}

.pagination-link, .pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: var(--bg-card);
}

a.pagination-link:hover { border-color: var(--accent-ring); color: var(--accent); text-decoration: none; }

.pagination-link.current {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent);
  font-weight: 700;
}

.pagination-link.disabled {
  color: var(--text-dim);
  opacity: 0.5;
  cursor: default;
}

.pagination-ellipsis { border: none; background: none; }

/* --- Footer --- */

.footer {
  border-top: 1px solid var(--border);
  padding: var(--sp-7) var(--sp-5);
  margin-top: var(--sp-9);
  position: relative;
}

.footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-brand);
  opacity: 0.5;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-brand svg { height: 20px; width: 20px; }

.footer-links { display: flex; gap: var(--sp-5); }

.footer-links a {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.footer-links a:hover { color: var(--text); }

/* --- Auth: nav + login/account --- */

/* Top-right user navigation menu (gravatar trigger + dropdown). */
.user-menu { position: relative; display: inline-flex; }
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 6px 2px 2px;
  cursor: pointer;
  color: var(--text-muted);
}
.user-menu-trigger:hover,
.user-menu-trigger[aria-expanded="true"] { border-color: var(--border); background: var(--bg-card); }
.user-menu-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
  background: var(--bg-card);
}
.user-menu-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
}
.user-menu-caret { color: var(--text-muted); flex: none; }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: 6px;
  z-index: 50;
}
.user-menu-dropdown[hidden] { display: none; }
.user-menu-header { padding: 6px 10px 4px; }
.user-menu-name { font-weight: 600; color: var(--text); font-size: var(--text-sm); word-break: break-all; }
.user-menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: var(--text-sm);
  text-decoration: none;
}
.user-menu-item:hover { background: var(--bg-input); }
.user-menu-item-button { background: none; border: none; font: inherit; cursor: pointer; }
.user-menu-logout { margin: 0; }

.login {
  max-width: 420px;
  margin: var(--sp-9) auto;
  padding: 0 var(--sp-4);
  text-align: center;
}

.login h1 { font-size: var(--text-xl); font-weight: 800; margin-bottom: var(--sp-2); }
.login-sub { color: var(--text-muted); margin-bottom: var(--sp-6); }

.login-methods { display: flex; flex-direction: column; gap: var(--sp-3); }

.btn-oauth {
  width: 100%;
  padding: 12px 16px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-5) 0;
  color: var(--text-dim);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-email-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  text-align: left;
}

.login-email-form label { color: var(--text-muted); font-size: var(--text-sm); }

.login-email-form input {
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-base);
}

.login-email-form input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-notice {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: var(--sp-5);
  font-size: var(--text-sm);
  text-align: left;
}

.login-notice-ok { background: rgba(74, 222, 128, 0.1); border: 1px solid var(--green); color: var(--green); }
.login-notice-error { background: rgba(248, 113, 113, 0.1); border: 1px solid var(--red); color: var(--red); }

.login-devlink { margin-top: 10px; font-size: var(--text-sm); word-break: break-all; }
.login-devlink a { color: var(--accent); text-decoration: underline; }

/* Account / settings */

.account { max-width: 660px; margin: var(--sp-8) auto; padding: 0 var(--sp-4); }

.account h1 { font-size: var(--text-xl); font-weight: 800; margin-bottom: var(--sp-5); }

.account-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.account-section h2 { font-size: var(--text-md); margin-bottom: var(--sp-3); }

.account-section p { margin-bottom: var(--sp-2); }
.account-section strong { color: var(--text); font-weight: 600; }

.text-muted { color: var(--text-muted); font-size: var(--text-sm); }

.token-create {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}

.token-create input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-sm);
}

.token-create input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Danger zone — irreversible account deletion */

.danger-zone {
  border-color: #5b2330;
}

.danger-zone h2 { color: #f87171; }

.impact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.impact-list code {
  font-size: var(--text-sm);
  background: var(--bg-code);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.delete-account-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  max-width: 360px;
}

.delete-confirm-label { font-size: var(--text-sm); color: var(--text-muted); }

.delete-account-form input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: var(--text-sm);
}

.delete-account-form input:focus {
  outline: none;
  border-color: #b03a4a;
  box-shadow: 0 0 0 3px rgba(176, 58, 74, 0.25);
}

.delete-account-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Submit a spec --- */

.submit { padding: var(--sp-6) 0 var(--sp-8); max-width: 860px; }
.submit h1 { font-size: var(--text-2xl); font-weight: 800; margin-bottom: var(--sp-3); }
.submit-lede { color: var(--text-muted); margin-bottom: var(--sp-5); max-width: 640px; }
.submit-lede a { color: var(--accent); }

.submit-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.submit-hint { color: var(--text-muted); font-size: var(--text-sm); }

.submit-editor {
  width: 100%;
  min-height: 360px;
  padding: var(--sp-4);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.5;
  resize: vertical;
}
.submit-editor:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.submit-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }
.submit-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

.submit-result {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
}
.submit-result ul { margin: var(--sp-2) 0 0 var(--sp-5); }
.submit-result li { margin-bottom: 4px; font-family: var(--font-mono); }
.submit-result a { color: var(--accent); }
.submit-result-ok { border-color: #2c5b3a; background: rgba(44, 91, 58, 0.15); }
.submit-result-error { border-color: #5b2330; background: rgba(91, 35, 48, 0.15); }

/* Structured editor form */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
.submit-form { display: flex; flex-direction: column; gap: var(--sp-5); }
.submit-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.submit-group legend { padding: 0 var(--sp-2); font-weight: 700; font-size: var(--text-sm); }
.submit-group legend em { color: var(--text-muted); font-weight: 400; }
.submit-field { display: flex; flex-direction: column; gap: 4px; }
.submit-field > span { font-size: var(--text-sm); }
.submit-field > span em { color: var(--text-muted); font-style: normal; }
.submit-field input {
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.submit-field input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-soft); }

.submit-repeat { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.submit-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-3);
  background: var(--bg-soft, rgba(127, 127, 127, 0.04));
}
.submit-row-head { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.submit-row-head .sec-heading { flex: 1; }
.submit-row-controls { display: flex; gap: 4px; }
.submit-row input, .submit-row textarea, .submit-row select {
  padding: var(--sp-2);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  width: 100%;
}
.submit-row textarea { resize: vertical; }
.submit-vector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); align-items: end; }
.submit-vector-grid label { display: flex; flex-direction: column; gap: 4px; }
.submit-vector-grid label > span { font-size: var(--text-xs, 0.75rem); color: var(--text-muted); }
.submit-vector-grid .vec-wide { grid-column: 1 / -1; }
.submit-nonascii { border-color: #b4862c !important; }

/* Preview view (where Publish lives) */
.submit-preview {
  margin-top: var(--sp-5);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.submit-preview-actions { display: flex; gap: var(--sp-3); justify-content: space-between; margin-bottom: var(--sp-4); }
.submit-preview-body { overflow-wrap: anywhere; }

/* "draft pending" badge on /my/specs */
.badge-draft {
  display: inline-block;
  margin-left: var(--sp-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--text-xs, 0.75rem);
  background: rgba(180, 134, 44, 0.18);
  border: 1px solid #b4862c;
  color: var(--text);
}

/* --- Admin dashboard --- */

.admin { padding: var(--sp-6) 0 var(--sp-8); }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.admin-header h1 { font-size: var(--text-2xl); font-weight: 800; }
.admin-section-title { font-size: var(--text-md); margin: var(--sp-6) 0 var(--sp-3); }
.admin-section-title .muted { font-weight: 400; font-size: var(--text-sm); }

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.admin-table th, .admin-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { color: var(--text-muted); font-weight: 600; background: var(--bg-card); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--accent); }
.admin-table .row-quarantined { background: rgba(91, 35, 48, 0.12); }

.btn-sm { padding: 4px 10px; font-size: var(--text-xs); }
.badge-danger { background: rgba(91, 35, 48, 0.4); color: #f87171; padding: 2px 8px; border-radius: var(--radius-full); font-size: var(--text-xs); }

.token-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.token-row:last-child { border-bottom: none; }

.token-reveal {
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 12px;
  word-break: break-all;
  margin: 12px 0;
}

/* --- Responsive --- */

@media (max-width: 1024px) {
  .how-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  main { padding: 0 var(--sp-4); }

  .hero { padding: var(--sp-8) 0 var(--sp-7); }
  .hero h1 { font-size: var(--text-3xl); letter-spacing: -1px; }
  .hero-sub { font-size: var(--text-md); }
  .hero-search input { font-size: var(--text-base); padding: 13px 16px; }

  .stats-strip { gap: var(--sp-6); padding: var(--sp-5); }
  .stat-num { font-size: var(--text-xl); }

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

  .spec-detail { grid-template-columns: 1fr; gap: var(--sp-6); }
  .spec-detail-sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: var(--sp-5);
  }

  .nav-inner { gap: var(--sp-3); height: 56px; }
  .nav-search { max-width: none; }
  .nav-logo .logo-word { display: none; }

  .footer-inner { flex-direction: column; text-align: center; }

  .cta-band h2 { font-size: var(--text-xl); }
}
