/* =====================================================================
   RelicTek / BΛD — Tokenized Design System
   ---------------------------------------------------------------------
   Single source of truth for color, type, spacing, glass fill, border,
   and motion. Consumed via <link rel="stylesheet" href="/css/design-system">
   by every EJS page that server.js renders. Existing class names on the
   pages map to these tokens; the legacy per-page :root blocks are gone.
   ===================================================================== */

:root {
  /* ── Cosmic dark matter — deeper void ── */
  --ink-cosmic-dark-matter: #070709;
  --ink-deep: #0c0c14;
  --ink-glass-fill: rgba(7, 7, 9, 0.62);
  --ink-glass-border: rgba(184, 115, 51, 0.35);
  --ink-glass-border-data: rgba(0, 229, 255, 0.35);
  --ink-glass-elevated: rgba(12, 12, 20, 0.78);

  /* ── High-voltage primary + secondary accents ── */
  --hv-neon-yellow: #FCEE09;
  --hv-neon-yellow-dim: #C9A227;
  --relicosmic-blue: #2952FF;
  --relicosmic-blue-dim: #6B85FF;
  --icy-cyan: #00E5FF;
  --icy-cyan-dim: #0091A8;
  --copper: #B87333;
  --threat-red: #FF4D4D;

  /* ── State colors ── */
  --state-warn: #FF9500;
  --state-critical: #FF5500;
  --state-success: #00E676;

  /* ── Text ── */
  --text-primary: #ffffff;
  --text-secondary: #d0d0e0;
  --text-tertiary: #888899;

  /* ── Legacy aliases — kept so existing class names resolve unchanged.
       Original gold #FFD700 / cyan #00D4FF are preserved per-token so the
       existing transitions, gradient linears, and inline rgba() values
       continue to look the same. The new tokens (--hv-neon-yellow,
       --icy-cyan) are used explicitly where the plan calls for migration. */
  --gold: #FFD700;
  --gold-dim: #C9A227;
  --gold-bright: #FFE44D;
  --cyan: #00D4FF;
  --cyan-dim: #0091A8;
  --dark: #050507;
  --dark-card: #0c0c14;
  --dark-border: #1a1a2e;
  --white: #ffffff;
  --gray: #888899;
  --gray-light: #aaaabc;
  --red: #FF6B6B;
  --green: #00E676;
  --green-dim: #00964A;
  --purple: #C084FC;
  --orange: #FF5500;
  --orange-dim: rgba(255, 85, 0, 0.2);

  /* ── Attention-mode binding ── */
  --attention-human: #FFD700;
  --attention-agent: #00D4FF;
  --attention-current: var(--attention-human);
  --attention-current-dim: var(--gold-dim);
  --attention-glow: rgba(255, 215, 0, 0.4);

  /* ── Typography tokens ── */
  --font-display: 'Space Grotesk', 'Orbitron', sans-serif;
  --font-body: 'Inter', 'Rajdhani', sans-serif;
  --font-mono-metric: 'JetBrains Mono', 'Orbitron', monospace;

  /* ── Letter-spacing scale ── */
  --tracking-eyebrow: 0.2em;
  --tracking-nav: 0.12em;
  --tracking-header: 0.04em;

  /* ── Spacing scale (8px modular grid — Clear Street Standard) ── */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;
  --space-7: 128px;
  --space-8: 192px;

  /* ── Type scale (massive readable typography) ── */
  --type-display: clamp(2.4rem, 6.5vw, 5.25rem);
  --type-h1: clamp(1.8rem, 3.6vw, 2.75rem);
  --type-h2: clamp(1.4rem, 2.4vw, 1.9rem);
  --type-metric: clamp(1.6rem, 2.6vw, 2.4rem);
  --type-body-lg: 1.1rem;
  --type-body: 0.95rem;
  --type-eyebrow: 0.7rem;
  --type-micro: 0.55rem;

  /* ── Container + grid ── */
  --container-wide: 1320px;
  --container-prose: 720px;
  --grid-gap: var(--space-3);

  /* ── Motion tokens ── */
  --ease-institutional: cubic-bezier(0.2, 0.7, 0.2, 1);
  --motion-fast: 140ms;
  --motion-base: 280ms;
}

/* Audience-mode accent swap — mirrored from layout.ejs so non-layout
   pages behave identically when the attention-mode cookie is set. */
.product-card[data-tier] { --tier-accent: var(--attention-current); }

html[data-mode="human"] {
  --attention-current: var(--attention-human);
  --attention-current-dim: var(--gold-dim);
  --attention-glow: rgba(255, 215, 0, 0.4);
}

html[data-mode="agent"] {
  --attention-current: var(--attention-agent);
  --attention-current-dim: var(--cyan-dim);
  --attention-glow: rgba(0, 212, 255, 0.4);
}

/* Copy variants — identical-character-count siblings, swapped by mode.
   No-JS fallback: human wins on first paint. */
[data-mode-copy] { display: none; }
html:not([data-mode]) [data-mode-copy="human"],
html[data-mode="human"] [data-mode-copy="human"] { display: inline; }
html:not([data-mode]) [data-mode-copy="agent"] { display: none; }
html[data-mode="agent"] [data-mode-copy="agent"] { display: inline; }

[data-mode-cta] { display: none; }
html:not([data-mode]) [data-mode-cta="human"],
html[data-mode="human"] [data-mode-cta="human"] { display: inline-block; }
html:not([data-mode]) [data-mode-cta="agent"],
html[data-mode="agent"] [data-mode-cta="agent"] { display: inline-block; }

[data-mode-copy-block] { display: none; }
html:not([data-mode]) [data-mode-copy-block="human"],
html[data-mode="human"] [data-mode-copy-block="human"] { display: block; }
html:not([data-mode]) [data-mode-copy-block="agent"],
html[data-mode="agent"] [data-mode-copy-block="agent"] { display: block; }

/* ── Body baseline ─────────────────────────────────────────────────── */
html, body {
  background: var(--ink-cosmic-dark-matter);
  color: var(--text-primary);
}

/* ── Glass utilities (consumed everywhere — kills white cards) ────── */
.glass {
  background: var(--ink-glass-elevated);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--ink-glass-border);
  border-radius: 0.5rem;
}

.glass--data {
  border-color: var(--ink-glass-border-data);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.06) 0%, rgba(7, 7, 9, 0.72) 60%);
}

.glass--copper {
  border-color: var(--ink-glass-border);
}

/* ===== SLoQ TEMPORAL RADAR ===========================================
   Embedded inside the 5IR section as a sovereign command-center pillar.
   Glassmorphism on Cosmic Dark Matter, copper border that pulses to
   ReliCosmic Blue on the 2500ms cadence. Reduced-motion users get the
   static border without the sweep + fade-in. */
.sloq-container {
  position: relative;
  background: var(--ink-glass-elevated);
  border: 1px solid var(--copper);
  border-radius: 0.75rem;
  padding: 20px 24px;
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  max-width: 720px;
  margin: 32px auto 0;
  text-align: left;
  overflow: hidden;
}

/* The border sweep rides an absolute pseudo-element so the 1px rule above
   stays structurally intact — the ::after overlay tints around it. */
.sloq-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  border: 1px solid var(--copper);
  pointer-events: none;
  animation: sloqBorderPulse 2.5s linear infinite;
}

@keyframes sloqBorderPulse {
  0%, 100% { border-color: var(--copper); }
  50%      { border-color: var(--relicosmic-blue); }
}

.sloq-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.sloq-glyph {
  color: var(--copper);
  font-size: 1rem;
  transition: color 200ms ease;
  margin-right: 8px;
}

.sloq-container:hover .sloq-glyph { color: var(--relicosmic-blue); }

.sloq-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.sloq-status {
  font-family: var(--font-mono-metric);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  text-transform: uppercase;
  color: var(--icy-cyan);
  white-space: nowrap;
}

.sloq-status[data-state="secure"] { color: var(--hv-neon-yellow); }
.sloq-status[data-state="locked"]  { color: var(--relicosmic-blue); border-color: var(--relicosmic-blue); }
.sloq-status[data-state="pulse"]   { color: var(--copper); }
.sloq-status[data-state="init"]    { color: var(--gray); border-color: rgba(136, 136, 153, 0.4); }

.sloq-log-window {
  margin-top: 16px;
  max-height: 220px;
  overflow: hidden;
}

.sloq-log {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono-metric);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--hv-neon-yellow);
}

.sloq-log li {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: sloqFadeIn 300ms ease-out;
}

.sloq-log li[data-tone="cyan"] { color: var(--icy-cyan); }
.sloq-log li[data-tone="red"]   { color: var(--threat-red); }
.sloq-log li[data-tone="muted"] { color: var(--gray); opacity: 0.75; }

/* Breach state — any telemetry tick flagged anomaly flips the copper
   border sweep to --threat-red so the radar reads as compromised. The
   ::after overlay animation is preserved but rebound to a red-only
   keyframe so the running `sloqBorderPulse` keyframe (which sets
   border-color explicitly) cannot mask the breach color. */
.sloq-container[data-breach="true"] {
  border-color: var(--threat-red);
}
.sloq-container[data-breach="true"]::after {
  border-color: var(--threat-red);
  animation-name: sloqBorderPulseBreach;
}

@keyframes sloqBorderPulseBreach {
  0%, 100% { border-color: var(--threat-red); }
  50%      { border-color: var(--threat-red); }
}

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

.sloq-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono-metric);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--icy-cyan-dim);
  text-transform: uppercase;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .sloq-container::after { animation: none; }
  .sloq-log li { animation: none; }
  .sloq-glyph { transition: none; }
}
