/* =========================================================================
   EPOCH — design tokens
   Palette: deep-space void, aurora violet, plasma magenta, epoch gold.
   Type: Space Grotesk (display) / IBM Plex Sans (body) / IBM Plex Mono (data)
   ========================================================================= */

:root {
  --void: #08060f;
  --void-2: #0c0a18;
  --panel: #14101f;
  --panel-2: #1c1630;
  --aurora: #8b5cf6;
  --aurora-dim: rgba(139, 92, 246, 0.35);
  --plasma: #f2568c;
  --gold: #f5a623;
  --gold-dim: rgba(245, 166, 35, 0.35);
  --starlight: #f5f3ff;
  --dim: #9691b3;
  --dim-2: #6b6690;
  --line: rgba(139, 92, 246, 0.22);
  --ok: #4ade80;
  --bad: #f2568c;

  --font-display: "Space Grotesk", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--starlight);
  font-family: var(--font-body);
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
}

a { color: inherit; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: 0.01em; }

::selection { background: var(--aurora); color: var(--void); }

/* ---- starfield background canvas, fixed behind everything ---- */
#starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% -10%, #1b1330 0%, var(--void) 55%);
}

/* ---- top nav ---- */
.epoch-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(8, 6, 15, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.epoch-nav .brand {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--starlight);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.epoch-nav .brand .spark { color: var(--gold); }

.epoch-tabs { display: flex; gap: 10px; }

.epoch-tab {
  position: relative;
  padding: 9px 20px 9px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.epoch-tab::before { content: "// "; color: var(--aurora); opacity: 0.7; }
.epoch-tab:hover { color: var(--starlight); border-color: var(--aurora-dim); }
.epoch-tab.active {
  color: var(--void);
  background: var(--aurora);
  border-color: var(--aurora);
  font-weight: 600;
}
.epoch-tab.active::before { color: var(--void); }

main { position: relative; z-index: 1; min-height: calc(100vh - 68px); }

/* ---- generic panel / card ---- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--aurora);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 22px;
  border-radius: 3px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--void);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { box-shadow: 0 0 24px var(--gold-dim); transform: translateY(-1px); }
.btn.ghost {
  background: transparent;
  color: var(--starlight);
  border-color: var(--line);
}
.btn.ghost:hover { border-color: var(--aurora); box-shadow: 0 0 20px var(--aurora-dim); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.footer-note {
  text-align: center;
  padding: 40px 20px 60px;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* ---- flash messages ---- */
.flash-stack { position: fixed; top: 90px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.flash {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel);
  max-width: 320px;
}
.flash.ok { border-color: var(--ok); color: var(--ok); }
.flash.error { border-color: var(--bad); color: var(--bad); }

@media (max-width: 720px) {
  .epoch-nav { padding: 14px 16px; }
  .epoch-nav .brand { font-size: 15px; }
  .epoch-tab { padding: 8px 12px; font-size: 10px; }
}

/* ---- Profile menu ---- */
.epoch-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-menu {
  position: relative;
}

.profile-avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--aurora-dim);
  background: var(--panel);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s;
}
.profile-avatar-btn:hover { border-color: var(--aurora); }
.profile-avatar-btn img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.profile-initials {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--aurora);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 0;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 50;
}
.profile-dropdown.open { display: flex; }

.profile-dropdown-name {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}

.profile-dropdown-item {
  background: none;
  border: none;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--starlight);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.profile-dropdown-item:hover { background: rgba(139,92,246,0.1); }
.profile-dropdown-item.logout { color: var(--bad); }

/* ---- Light theme ---- */
[data-theme="light"] {
  --void: #f5f5f7;
  --void-2: #eeeef2;
  --panel: #ffffff;
  --panel-2: #f8f8fc;
  --starlight: #1a1a2e;
  --dim: #5a5a7a;
  --dim-2: #8888a8;
  --line: rgba(139, 92, 246, 0.18);
}

[data-theme="light"] #starfield { opacity: 0.08; }

[data-theme="light"] .epoch-nav {
  background: rgba(255,255,255,0.88);
}

[data-theme="light"] .profile-dropdown {
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="light"] .flash {
  background: #fff;
}
