/* ══════════════════════════════════════════════════════════
   Nessie Graph Explorer — Documentation Styles
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600&family=Syne:wght@400;500;600;700&display=swap');

/* ── Design Tokens ─────────────────────────────────────── */
:root {
  --bg:            #0c0d10;
  --bg-surface:    #111318;
  --bg-raised:     #181b22;
  --bg-hover:      #1e2129;
  --bg-active:     #23272f;
  --border:        #252830;
  --border-bright: #32363f;
  --accent:        #00d9ff;
  --accent-dim:    rgba(0,217,255,.12);
  --accent-glow:   rgba(0,217,255,.26);
  --green:         #3ddc84;
  --green-dim:     rgba(61,220,132,.12);
  --amber:         #ffb347;
  --amber-dim:     rgba(255,179,71,.12);
  --red:           #ff5f57;
  --red-dim:       rgba(255,95,87,.12);
  --text-1:        #dde1ec;
  --text-2:        #8b90a0;
  --text-3:        #454a58;
  --font-mono:     'JetBrains Mono', monospace;
  --font-ui:       'Syne', sans-serif;
  --sidebar-w:     260px;
  --header-h:      48px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,.025) 2px, rgba(0,0,0,.025) 4px
  );
}

/* ── Scrollbars ────────────────────────────────────────── */
::-webkit-scrollbar             { width: 5px; height: 5px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── App Shell ─────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Top Header ────────────────────────────────────────── */
#header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  margin-right: 4px;
}

.header-logo-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-1);
  letter-spacing: -.3px;
}

.header-logo-name em {
  font-style: normal;
  color: var(--accent);
}

.header-badge {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header-spacer { flex: 1; }

.header-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 11px;
  border-radius: 3px;
  transition: color .1s, background .1s;
}

.header-link:hover { color: var(--text-1); background: var(--bg-hover); }

.header-link svg { width: 13px; height: 13px; opacity: .7; }

/* ── Layout ────────────────────────────────────────────── */
#layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── Sidebar ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 16px 0;
  z-index: 100;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 8px 16px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  border-left: 2px solid transparent;
  transition: color .1s, background .1s, border-color .1s;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text-1);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-item .nav-icon {
  font-size: 10px;
  opacity: .6;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

/* ── Content ───────────────────────────────────────────── */
#content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

/* ── Typography ────────────────────────────────────────── */
h1 {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 24px;
  line-height: 1.3;
}

h2 {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 40px 0 16px;
}

h3 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 24px 0 10px;
}

h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

p {
  color: var(--text-1);
  margin-bottom: 12px;
  line-height: 1.7;
}

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

strong { color: var(--text-1); font-weight: 600; }
em { color: var(--text-2); font-style: italic; }

ul, ol {
  margin: 8px 0 16px 20px;
  color: var(--text-1);
  line-height: 1.8;
}

li { margin-bottom: 2px; }

/* ── Code ──────────────────────────────────────────────── */
code {
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 2px 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}

pre {
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 12px 0 20px;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-1);
  font-size: 11.5px;
  line-height: 1.65;
}

.code-label {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* Syntax highlights */
.kw  { color: #c084fc; }
.str { color: #86efac; }
.cmt { color: var(--text-3); font-style: italic; }
.fn  { color: #60a5fa; }
.num { color: #fb923c; }
.cls { color: #f9a8d4; }
.dec { color: var(--amber); }

/* ── Callouts ──────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  padding: 12px 16px;
  border-radius: 0 4px 4px 0;
  font-size: 12px;
  color: var(--text-1);
  margin: 16px 0;
}
.callout.warn  { border-color: var(--amber); background: var(--amber-dim); }
.callout.error { border-color: var(--red);   background: var(--red-dim); }
.callout.green { border-color: var(--green); background: var(--green-dim); }

.callout-title {
  font-weight: 600;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.callout.warn  .callout-title { color: var(--amber); }
.callout.error .callout-title { color: var(--red); }
.callout.green .callout-title { color: var(--green); }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-family: var(--font-mono);
}
.badge-accent  { background: var(--accent-dim);  color: var(--accent); }
.badge-green   { background: var(--green-dim);   color: var(--green); }
.badge-amber   { background: var(--amber-dim);   color: var(--amber); }
.badge-red     { background: var(--red-dim);     color: var(--red); }

/* ── Tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 12px 0 20px; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

th {
  background: var(--bg-surface);
  color: var(--text-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border-bright);
  text-align: left;
  font-weight: 500;
}

td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: top;
}

tr:hover td { background: var(--bg-hover); }

/* ── Cards ─────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  text-decoration: none;
  display: block;
  transition: border-color .15s, background .15s;
}
.card:hover {
  border-color: var(--border-bright);
  background: var(--bg-hover);
  text-decoration: none;
}

.card-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.card-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Steps ─────────────────────────────────────────────── */
.steps { margin: 16px 0 24px; }

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
}

.step::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: -10px;
  width: 1px;
  background: var(--border);
}

.step:last-child::before { display: none; }

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body { flex: 1; }
.step-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}

/* ── Diagram container ─────────────────────────────────── */
.diagram-wrap {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin: 16px 0 24px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.diagram-wrap svg {
  max-width: 100%;
  height: auto;
}

.diagram-caption {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  margin-top: -12px;
  margin-bottom: 20px;
  letter-spacing: .04em;
}

/* ── Tabs ──────────────────────────────────────────────── */
.tabs { margin: 16px 0; }

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.tab-btn {
  padding: 7px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .1s, border-color .1s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; padding-top: 16px; }
.tab-panel.active { display: block; }

/* ── Inline cmd ────────────────────────────────────────── */
.cmd {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  margin: 8px 0;
  position: relative;
}

.cmd::before {
  content: '$';
  color: var(--text-3);
  margin-right: 10px;
}

/* ── Action cards ──────────────────────────────────────── */
.action-list { margin: 12px 0 24px; }

.action-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.action-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.action-desc {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
}

.action-meta-item {
  color: var(--text-3);
}
.action-meta-item span {
  color: var(--text-2);
}

/* ── Plugin item ───────────────────────────────────────── */
.plugin-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.plugin-icon {
  width: 32px;
  height: 32px;
  background: var(--bg-active);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.plugin-info { flex: 1; }
.plugin-name {
  font-weight: 600;
  color: var(--text-1);
  font-size: 12px;
  margin-bottom: 3px;
}
.plugin-desc {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ── Hero section ──────────────────────────────────────── */
.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.hero-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero h1 {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 13px;
  color: var(--text-2);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 28px;
}

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

.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 3px;
  padding: 8px 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; text-decoration: none; }

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-2);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  padding: 8px 20px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .15s;
}
.btn-secondary:hover { color: var(--text-1); text-decoration: none; }

/* ── Feature grid ──────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 32px;
}

.feature-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
}

.feature-item-icon {
  font-size: 18px;
  margin-bottom: 8px;
}

.feature-item-title {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}

.feature-item-desc {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Inline separator ──────────────────────────────────── */
.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ── Mobile menu ───────────────────────────────────────── */
#menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  #sidebar {
    transform: translateX(-260px);
    width: 260px;
    transition: transform .2s cubic-bezier(.16,1,.3,1);
  }

  #sidebar.open {
    transform: translateX(0);
    --sidebar-w: 260px;
    box-shadow: 4px 0 32px rgba(0,0,0,.5);
  }

  #content { margin-left: 0; }
  #menu-toggle { display: block; }

  .page { padding: 24px 20px 60px; }
  h1 { font-size: 20px; }
  .hero h1 { font-size: 22px; }
  .card-grid, .feature-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .card-grid, .feature-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
}
