/* ============================================================
   CHA NK/SARS — Base: Variables, Reset, Typography
   Sovereign Intelligence Dark Aesthetic
   ============================================================ */

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

:root {
  /* Surfaces */
  --bg-primary:    #0A0C0F;
  --bg-secondary:  #111418;
  --bg-tertiary:   #161B22;
  --bg-elevated:   #1C2128;
  --bg-hover:      #1E2530;

  /* Accent Colours */
  --cyan:          #00D4FF;
  --cyan-dim:      rgba(0, 212, 255, 0.12);
  --cyan-soft:     rgba(0, 212, 255, 0.06);
  --cyan-glow:     rgba(0, 212, 255, 0.25);
  --orange:        #FF6B35;
  --orange-dim:    rgba(255, 107, 53, 0.15);
  --purple:        #C084FC;
  --purple-dim:    rgba(192, 132, 252, 0.15);
  --purple-glow:   rgba(192, 132, 252, 0.3);
  --green:         #22C55E;
  --green-dim:     rgba(34, 197, 94, 0.12);
  --red:           #EF4444;
  --red-dim:       rgba(239, 68, 68, 0.15);
  --amber:         #F59E0B;
  --amber-dim:     rgba(245, 158, 11, 0.12);
  --slate:         #64748B;
  --slate-dim:     rgba(100, 116, 139, 0.15);

  /* Borders */
  --border:        rgba(0, 212, 255, 0.12);
  --border-soft:   rgba(0, 212, 255, 0.06);
  --border-strong: rgba(0, 212, 255, 0.25);

  /* Text */
  --text-primary:   #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted:     #475569;
  --text-dim:       #334155;

  /* Typography */
  --font-display: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  --font-body:    'Inter', 'DM Sans', system-ui, sans-serif;
  --font-code:    'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --nav-height:    60px;
  --sidebar-width: 280px;
  --panel-width:   320px;
  --canvas-height: calc(100vh - var(--nav-height));

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

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition: 150ms ease;
  --transition-slow: 300ms ease;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--cyan); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-primary); }

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  outline: none;
  background: none;
}

ul, ol { list-style: none; }

img { display: block; max-width: 100%; }

input, select, textarea {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-dim);
}

/* ── Typography ─────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.714rem; color: var(--cyan); }
h2 { font-size: 1.286rem; color: var(--text-primary); }
h3 { font-size: 1.071rem; color: var(--text-secondary); }
h4 { font-size: 0.929rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }

p { color: var(--text-secondary); margin-bottom: var(--space-3); }

code, .mono {
  font-family: var(--font-code);
  font-size: 0.857em;
  font-variant-ligatures: contextual;
}

/* ── Navigation ─────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  z-index: 1000;
  gap: var(--space-6);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--cyan-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.05em;
}

.nav-brand-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-brand-sub {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  line-height: 1;
}

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

.nav-link {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--cyan);
  background: var(--cyan-dim);
  border: 1px solid var(--border);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.nav-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
  50%       { opacity: 0.6; box-shadow: 0 0 12px var(--green); }
}

.nav-status-text {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Page Wrapper ───────────────────────────── */
.page-wrapper {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.page-header {
  padding: var(--space-6) 0 var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--space-6);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.143rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 20px;
  background: var(--cyan);
  border-radius: 2px;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-1);
  margin-left: 19px;
}

/* ── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate); }

/* ── Selection ──────────────────────────────── */
::selection { background: var(--cyan-dim); color: var(--cyan); }

/* ── Hex Grid Background Pattern ───────────────── */
.hex-bg {
  position: relative;
  overflow: hidden;
}
.hex-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'%3E%3Cpath d='M30 2 L56 17 L56 37 L30 52 L4 37 L4 17 Z' fill='none' stroke='%2300D4FF' stroke-width='0.3' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 60px 52px;
  pointer-events: none;
  z-index: 0;
}

/* ── Scanning Line Animation ────────────────── */
@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

.scanline {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-dim), var(--cyan-glow), var(--cyan-dim), transparent);
  animation: scanline 8s linear infinite;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── Utility ────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.gap-4       { gap: var(--space-4); }
.gap-6       { gap: var(--space-6); }
.mt-4        { margin-top: var(--space-4); }
.mb-4        { margin-bottom: var(--space-4); }
.text-cyan   { color: var(--cyan); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-display); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
