/* =========================================================================
   THEME — codename "Aurora"
   Crypto / cyberpunk-neon admin aesthetic, dark only (v1).
   This file owns design tokens, the global background, and base resets.
   Page CSS imports tokens via :root custom properties.
   ========================================================================= */

:root {
  /* ---- Surfaces (deepest → highest) ---------------------------------- */
  --ink-0: #05070D;          /* page void */
  --ink-1: #0A0E1A;          /* base canvas */
  --ink-2: #0F1525;          /* surface (cards) */
  --ink-3: #161D33;          /* surface elevated */
  --ink-4: #1F2A4A;          /* surface hover */

  /* ---- Lines ---------------------------------------------------------- */
  --line: #1F2A4A;
  --line-bright: #2D3F6B;
  --line-glow: rgba(0, 229, 255, 0.35);

  /* ---- Text ----------------------------------------------------------- */
  --text: #E6ECFF;
  --text-dim: #A8B3D6;
  --text-mute: #6B7AA3;
  --text-disabled: #3F4A6B;

  /* ---- Accents (electric) -------------------------------------------- */
  --neon-cyan: #00E5FF;
  --neon-cyan-soft: rgba(0, 229, 255, 0.15);
  --neon-violet: #B14CFF;
  --neon-violet-soft: rgba(177, 76, 255, 0.18);
  --neon-pink: #FF3D8A;
  --neon-pink-soft: rgba(255, 61, 138, 0.18);
  --neon-orange: #FF8A3D;
  --neon-orange-soft: rgba(255, 138, 61, 0.18);

  /* ---- Semantic ------------------------------------------------------- */
  --ok: #3DFFB0;
  --ok-soft: rgba(61, 255, 176, 0.15);
  --warn: #FFC857;
  --warn-soft: rgba(255, 200, 87, 0.15);
  --danger: #FF4D6D;
  --danger-soft: rgba(255, 77, 109, 0.15);
  --info: #5BD4FF;
  --info-soft: rgba(91, 212, 255, 0.15);

  /* ---- Gradients ------------------------------------------------------ */
  --grad-aurora: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-violet) 50%, var(--neon-pink) 100%);
  --grad-cyan: linear-gradient(135deg, var(--neon-cyan) 0%, #5BD4FF 100%);
  --grad-violet: linear-gradient(135deg, var(--neon-violet) 0%, var(--neon-pink) 100%);

  /* ---- Typography ----------------------------------------------------- */
  --font-display: "Space Grotesk", "Inter", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", "Fira Code", ui-monospace, Menlo, monospace;

  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-18: 1.125rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-48: 3rem;
  --fs-64: 4rem;
  --fs-96: 6rem;

  --lh-tight: 1.1;
  --lh-snug: 1.3;
  --lh-normal: 1.5;
  --lh-loose: 1.7;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.12em;
  --tracking-widest: 0.25em;

  /* ---- Spacing -------------------------------------------------------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* ---- Radii ---------------------------------------------------------- */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-full: 9999px;

  /* ---- Shadows / glow ------------------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --glow-cyan: 0 0 24px rgba(0, 229, 255, 0.45), 0 0 6px rgba(0, 229, 255, 0.7);
  --glow-cyan-sm: 0 0 12px rgba(0, 229, 255, 0.4);
  --glow-violet: 0 0 24px rgba(177, 76, 255, 0.45), 0 0 6px rgba(177, 76, 255, 0.7);
  --glow-pink: 0 0 24px rgba(255, 61, 138, 0.45), 0 0 6px rgba(255, 61, 138, 0.7);
  --glow-danger: 0 0 16px rgba(255, 77, 109, 0.5);

  /* ---- Motion --------------------------------------------------------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 480ms;

  /* ---- Layout --------------------------------------------------------- */
  --container: 1280px;
  --nav-h: 64px;
}

/* =========================================================================
   RESET / BASE
   ========================================================================= */

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11", "tnum";
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

body { position: relative; }

a { color: var(--neon-cyan); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: #5BF0FF; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  margin: 0;
  color: var(--text);
}

p { margin: 0 0 var(--sp-4) 0; color: var(--text-dim); }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: 0.95em; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-1); }
::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--line-bright); }

/* Focus ring — universal */
:focus-visible {
  outline: 2px solid var(--neon-cyan);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* =========================================================================
   GLOBAL BACKGROUND  (reusable across every page)
   Drop <div class="aurora-bg"></div> as the first child of <body>.
   Fixed, behind everything, no pointer events, no layout impact.
   ========================================================================= */

.aurora-bg {
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(0, 229, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(177, 76, 255, 0.20), transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255, 61, 138, 0.06), transparent 70%),
    var(--ink-0);
}

.aurora-bg::before {
  /* grid */
  content: "";
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, rgba(45, 63, 107, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(45, 63, 107, 0.18) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, black 30%, transparent 100%);
  opacity: 0.55;
}

.aurora-bg::after {
  /* scanline / grain */
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.6;
  animation: aurora-flicker 8s var(--ease-in-out) infinite;
}

@keyframes aurora-flicker {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-bg::after { animation: none; }
}

/* =========================================================================
   UTILITIES
   ========================================================================= */

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-6); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--neon-cyan);
}

.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
  border: 0;
  margin: var(--sp-8) 0;
}

/* =========================================================================
   NAV DROPDOWN — sub-group label (AP-020)
   Non-clickable visual header that groups related items inside a
   .nav-dropdown-menu panel. Not a flyout, not interactive.
   ========================================================================= */
.nav-dropdown-group-label {
  display: block;
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  margin-top: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-mute);
  border-top: 1px solid var(--line);
  user-select: none;
}
.nav-dropdown-group-label:first-child { border-top: 0; margin-top: 0; }

/* Collapsible <details> wrapper around a sub-group of dropdown items.
   <summary> uses .nav-dropdown-group-label for its header look. */
.nav-dropdown-group { display: block; }
.nav-dropdown-group > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-dropdown-group > summary::-webkit-details-marker { display: none; }
.nav-dropdown-group > summary::after {
  content: "▸";
  font-size: var(--fs-10);
  color: var(--text-mute);
  margin-left: var(--sp-2);
  transition: transform 120ms ease;
}
.nav-dropdown-group[open] > summary::after { transform: rotate(90deg); }
.nav-dropdown-group > summary:hover { color: var(--text-1); }

/* Bifröst external-link button (nav) */
.btn-bifrost {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-wide);
  color: var(--text-mute);
}
.btn-bifrost:hover { color: var(--neon-cyan); }

/* =========================================================================
   AP-020 utility classes (replace inline styles)
   ========================================================================= */
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: end; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.ml-auto { margin-left: auto; }
.text-center { text-align: center; }
.p-0 { padding: 0; }
.p-4 { padding: var(--sp-4); }
.p-12 { padding: var(--sp-12); }
.overflow-hidden { overflow: hidden; }
.fs-12 { font-size: var(--fs-12); }
.full-bleed-pre { white-space: pre-wrap; margin: var(--sp-2) 0 0; }
.field-min-240 { min-width: 240px; }
.field-max-130 { max-width: 130px; }
.flex-1 { flex: 1; }
.w-150 { width: 150px; }
.w-100 { width: 100px; }
.col-30 { width: 30px; }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.dashboard-stat {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.dashboard-stat .label {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--text-mute);
}
.dashboard-stat .value {
  font-family: var(--font-display);
  font-size: var(--fs-32);
  font-weight: 600;
  color: var(--text);
  margin-top: var(--sp-2);
}
.dashboard-stat .value.warn { color: var(--warn); }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.quick-link-card {
  display: block;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.quick-link-card:hover {
  border-color: var(--neon-cyan);
  background: var(--ink-3);
  color: var(--text);
}
.quick-link-card .title {
  font-family: var(--font-display);
  font-size: var(--fs-18);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}
.quick-link-card .desc {
  font-size: var(--fs-13);
  color: var(--text-dim);
}

.break-all { word-break: break-all; }
.reason-block {
  white-space: pre-wrap;
  background: var(--ink-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  margin-top: var(--sp-2);
}
.fs-13 { font-size: var(--fs-13); }
.fs-tiny { font-size: 0.7rem; word-break: break-all; }
.ml-1 { margin-left: 4px; }
.rpc-presets-list {
  color: var(--text-mute);
  font-size: var(--fs-14);
  margin-left: var(--sp-6);
}
