/* ============================================================
   THE CONCORDE AGENCY — main.css
   Global variables, reset, typography, layout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Cinzel:wght@400;600;700&family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Rajdhani:wght@300;400;500;600;700&display=swap');

/* ── CSS CUSTOM PROPERTIES ── */
:root {
  /* Alert Level Colors — changed dynamically by JS */
  --alert-green:  #1a4a2e;
  --alert-yellow: #4a3a00;
  --alert-orange: #4a1e00;
  --alert-red:    #4a0000;
  --alert-black:  #0a0a0a;

  /* Current alert (default: green) */
  --alert-current: var(--alert-green);
  --alert-accent:  #2dff6e;
  --alert-glow:    rgba(45,255,110,0.15);

  /* Core palette */
  --bg-base:      #060809;
  --bg-surface:   #0c0f12;
  --bg-elevated:  #111518;
  --bg-overlay:   rgba(6,8,9,0.96);

  --border-dim:   rgba(255,255,255,0.06);
  --border-mid:   rgba(255,255,255,0.12);
  --border-gold:  rgba(201,168,76,0.3);
  --border-alert: rgba(45,255,110,0.2);

  --gold:         #c9a84c;
  --gold-light:   #e8c97a;
  --gold-dim:     rgba(201,168,76,0.12);

  --text-primary:   #c8d0d8;
  --text-secondary: #6e7a85;
  --text-dim:       #3a4450;
  --text-gold:      #c9a84c;
  --text-alert:     #2dff6e;
  --text-danger:    #ff3333;
  --text-warning:   #ffaa00;

  /* Fonts */
  --font-mono:    'Share Tech Mono', monospace;
  --font-display: 'Cinzel', serif;
  --font-body:    'EB Garamond', serif;
  --font-ui:      'Rajdhani', sans-serif;

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

  /* Layout */
  --nav-width:     260px;
  --header-height: 64px;
  --max-content:   1100px;

  /* Effects */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;

  --shadow-sm:   0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:   0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.8);
  --shadow-gold: 0 0 20px rgba(201,168,76,0.15);
  --shadow-alert:0 0 20px var(--alert-glow);

  /* Transitions */
  --trans-fast:   0.15s ease;
  --trans-mid:    0.3s ease;
  --trans-slow:   0.6s ease;
  --trans-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Alert Level Themes */
body.alert-green  { --alert-accent:#2dff6e; --alert-glow:rgba(45,255,110,0.15);  --border-alert:rgba(45,255,110,0.2);   --text-alert:#2dff6e;  }
body.alert-yellow { --alert-accent:#ffdd00; --alert-glow:rgba(255,221,0,0.15);   --border-alert:rgba(255,221,0,0.2);    --text-alert:#ffdd00; }
body.alert-orange { --alert-accent:#ff8800; --alert-glow:rgba(255,136,0,0.15);   --border-alert:rgba(255,136,0,0.2);    --text-alert:#ff8800; }
body.alert-red    { --alert-accent:#ff2222; --alert-glow:rgba(255,34,34,0.18);   --border-alert:rgba(255,34,34,0.25);   --text-alert:#ff2222; }
body.alert-black  { --alert-accent:#aa88ff; --alert-glow:rgba(170,136,255,0.12); --border-alert:rgba(170,136,255,0.18); --text-alert:#aa88ff; }

/* ── RESET ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 16px; scroll-behavior: smooth; height: 100%; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100%;
  overflow-x: hidden;
  cursor: none;
}

body.booting { overflow: hidden; }

/* ── CUSTOM CURSOR ── */
#cursor-dot, #cursor-ring {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: opacity var(--trans-fast);
}

#cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--alert-accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--alert-accent);
}

#cursor-ring {
  width: 28px;
  height: 28px;
  border: 1px solid var(--alert-accent);
  border-radius: 50%;
  opacity: 0.5;
  transition: width 0.2s, height 0.2s, opacity 0.2s, border-color 0.3s;
}

#cursor-ring.hovering {
  width: 44px;
  height: 44px;
  opacity: 0.8;
  border-color: var(--gold);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── SELECTION ── */
::selection { background: rgba(201,168,76,0.25); color: var(--gold-light); }

/* ── NOISE TEXTURE OVERLAY ── */
#noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

#scan-lines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* ── CANVAS ── */
#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── LAYOUT ── */
#app {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  min-height: 100vh;
}

/* ── HEADER ── */
#site-header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-dim);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: var(--space-5);
}

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

.header-logo-mark {
  width: 36px;
  height: 36px;
  position: relative;
}

.header-logo-mark svg {
  width: 100%;
  height: 100%;
}

.header-title-block {
  display: flex;
  flex-direction: column;
}

.header-agency-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--gold-light);
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 0 20px rgba(201,168,76,0.3);
}

.header-tagline {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-secondary);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

/* Alert Level Indicator */
.alert-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border: 1px solid var(--border-alert);
  border-radius: var(--radius-sm);
  background: var(--alert-glow);
  cursor: pointer;
  transition: all var(--trans-mid);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-alert);
}

.alert-indicator:hover {
  background: rgba(255,255,255,0.05);
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alert-accent);
  box-shadow: 0 0 8px var(--alert-accent);
  animation: alertPulse 2s ease-in-out infinite;
}

@keyframes alertPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Clearance Badge */
.clearance-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  background: var(--gold-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-gold);
  cursor: pointer;
  transition: all var(--trans-mid);
}

.clearance-badge:hover { background: rgba(201,168,76,0.2); }

/* ── SIDEBAR NAV ── */
#sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-dim);
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
}

.nav-section {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-dim);
}

.nav-section:last-child { border-bottom: none; flex: 1; }

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: var(--space-2) var(--space-5);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--trans-fast);
  position: relative;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.nav-item.active {
  color: var(--text-alert);
  background: var(--alert-glow);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--alert-accent);
  box-shadow: 0 0 8px var(--alert-accent);
}

.nav-item-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity var(--trans-fast);
}

.nav-item:hover .nav-item-icon,
.nav-item.active .nav-item-icon { opacity: 1; }

.nav-item-badge {
  margin-left: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
}

.nav-item.active .nav-item-badge {
  border-color: var(--border-alert);
  color: var(--text-alert);
}

/* ── MAIN CONTENT ── */
#main-content {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - var(--header-height));
}

.page-view {
  display: none;
  min-height: 100%;
  padding: var(--space-6);
  animation: pageIn 0.4s ease both;
}

.page-view.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── PAGE HEADERS ── */
.page-header {
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.page-title-block {}

.page-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-alert);
  margin-bottom: var(--space-2);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold-light);
  text-shadow: var(--shadow-gold);
  line-height: 1;
}

.page-subtitle {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: var(--space-2);
  letter-spacing: 0.03em;
}

/* ── TYPOGRAPHY ── */
h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 600; color: var(--gold-light); letter-spacing: 0.08em; }
h2 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; color: var(--text-primary); letter-spacing: 0.06em; }
h3 { font-family: var(--font-ui); font-size: 1.1rem; font-weight: 600; color: var(--text-primary); letter-spacing: 0.05em; text-transform: uppercase; }
h4 { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-gold); letter-spacing: 0.1em; text-transform: uppercase; }

p { margin-bottom: var(--space-3); line-height: 1.8; }
p:last-child { margin-bottom: 0; }

a { color: var(--text-alert); text-decoration: none; transition: color var(--trans-fast); }
a:hover { color: var(--gold-light); }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-alert);
  background: rgba(45,255,110,0.06);
  padding: 1px 6px;
  border-radius: 2px;
}

/* ── UTILITY CLASSES ── */
.text-gold      { color: var(--text-gold); }
.text-alert     { color: var(--text-alert); }
.text-danger    { color: var(--text-danger); }
.text-warning   { color: var(--text-warning); }
.text-dim       { color: var(--text-secondary); }
.text-mono      { font-family: var(--font-mono); }
.text-display   { font-family: var(--font-display); }
.text-ui        { font-family: var(--font-ui); }
.text-center    { text-align: center; }
.text-small     { font-size: 0.85rem; }
.text-xs        { font-size: 0.75rem; }

.flex           { display: flex; }
.flex-col       { display: flex; flex-direction: column; }
.items-center   { align-items: center; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.gap-1          { gap: var(--space-1); }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.gap-5          { gap: var(--space-5); }
.gap-6          { gap: var(--space-6); }

.grid-2         { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.grid-3         { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-auto      { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-7 { margin-bottom: var(--space-7); }

.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.w-full { width: 100%; }

.hidden { display: none !important; }
.invisible { visibility: hidden; opacity: 0; }
.flex-wrap { flex-wrap: wrap; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  #app { grid-template-columns: 220px 1fr; }
  :root { --nav-width: 220px; }
}

@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; }
  #sidebar { display: none; position: fixed; z-index: 200; top: var(--header-height); left: 0; height: calc(100vh - var(--header-height)); width: 260px; }
  #sidebar.mobile-open { display: flex; }
  #main-content { grid-column: 1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-view { padding: var(--space-4); }
}
