/* ============================================================================
   AXIOM AI 1.0 — "The Singularity" Design System
   Foundation · Tokens · Utilities
   ============================================================================ */

/* --- Google Fonts ------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&family=Roboto+Mono:wght@300;400;500;600;700&display=swap');

/* ============================================================================
   CSS RESET
   ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* MathJax v3 — SVG rendering, no CSS conflicts with resets.
   Only need: color for dark theme, overflow for long formulas. */
mjx-container {
  color: inherit !important;
}
mjx-container svg {
  display: inline !important;
  max-width: 100%;
}
/* Display math centering */
mjx-container[display="true"] {
  display: block !important;
  text-align: center;
  margin: 1em 0;
  padding: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  font-weight: 600;
}

p {
  overflow-wrap: break-word;
}

/* ============================================================================
   DESIGN TOKENS — CSS CUSTOM PROPERTIES
   ============================================================================ */
:root {
  /* ── Dynamic Background ─────────────────────────────────────────────────── */
  --bg-primary: var(--bg-deep-space);
  --bg-secondary: var(--bg-surface-elevated);
  --text-main: var(--text-primary);
  --sidebar-bg: rgba(10, 10, 18, 0.55);
  --footer-bg: linear-gradient(to top, rgba(18, 18, 18, 0.95), rgba(18, 18, 18, 0.6));
  --footer-border: rgba(0, 212, 255, 0.05);
  --result-bg: rgba(147, 112, 219, 0.15); /* Purple for Dark Mode */
}

body.theme-light {
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FB;
  --text-main: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: 1px solid rgba(0, 0, 0, 0.06);
  --glass-border-color: rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --footer-bg: #FFFFFF;
  --footer-border: rgba(0, 0, 0, 0.06);
  --glass-bg-light: #FFFFFF;
  --chat-bg: #FFFFFF;
  --chat-border: rgba(0, 0, 0, 0.08);
  --result-bg: #F3E8FF;

  /* Glossy/shiny font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

:root {
  /* ── Colour Palette ─────────────────────────────────────────────────────── */
  --bg-deep-space:        #0a0a12;
  --bg-surface:           #13131f;
  --bg-surface-elevated:  #1a1a2a;
  --bg-surface-hover:     #22223a;

  --accent-primary:       #6366f1;
  --accent-primary-rgb:   99, 102, 241;
  --accent-secondary:     #06b6d4;
  --accent-secondary-rgb: 6, 182, 212;

  --chat-bg:              #0e0e18;
  --chat-border:          rgba(255, 255, 255, 0.06);

  --verification-green:   #00FF88;
  --verification-rgb:     0, 255, 136;
  --warning-amber:        #FFB800;
  --warning-rgb:          255, 184, 0;
  --error-red:            #FF3366;
  --error-rgb:            255, 51, 102;

  --text-primary:         #e2e4f0;
  --text-secondary:       #8b8fa8;
  --text-muted:           #50546e;
  --text-inverse:         #050510;

  /* ── Glassmorphism ──────────────────────────────────────────────────────── */
  --glass-bg:             rgba(10, 10, 30, 0.7);
  --glass-bg-heavy:       rgba(10, 10, 30, 0.85);
  --glass-bg-light:       rgba(10, 10, 30, 0.45);
  --glass-blur:           20px;
  --glass-border:         1px solid rgba(0, 212, 255, 0.1);
  --glass-border-color:   rgba(0, 212, 255, 0.1);
  --glass-border-hover:   rgba(0, 212, 255, 0.25);
  --glass-shadow:         0 8px 32px rgba(0, 0, 0, 0.4);

  /* ── Typography ─────────────────────────────────────────────────────────── */
  --font-heading:         'Outfit', 'Inter', system-ui, sans-serif;
  --font-body:            'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:            'Roboto Mono', 'Fira Code', monospace;

  --fs-xs:                0.85rem;    
  --fs-sm:                0.95rem;  
  --fs-base:              1.15rem;       
  --fs-md:                1.3rem;   
  --fs-lg:                1.65rem;     
  --fs-xl:                2.1rem;       
  --fs-2xl:               2.6rem;     
  --fs-3xl:               3.2rem;       

  /* ── Spacing ────────────────────────────────────────────────────────────── */
  --space-xs:             4px;
  --space-sm:             8px;
  --space-md:             16px;
  --space-lg:             24px;
  --space-xl:             32px;
  --space-2xl:            48px;
  --space-3xl:            64px;

  /* ── Border Radius ──────────────────────────────────────────────────────── */
  --radius-sm:            6px;
  --radius-md:            12px;
  --radius-lg:            24px;
  --radius-pill:          999px;
  --radius-circle:        50%;

  /* ── Transitions ────────────────────────────────────────────────────────── */
  --ease-smooth:          cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring:          cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-decel:           cubic-bezier(0, 0, 0.2, 1);
  --transition-fast:      150ms var(--ease-smooth);
  --transition-base:      300ms var(--ease-smooth);
  --transition-slow:      500ms var(--ease-smooth);
  --transition-glacial:   800ms var(--ease-decel);

  /* ── Z-Index Scale ──────────────────────────────────────────────────────── */
  --z-grid:               0;
  --z-canvas:             1;
  --z-content:            10;
  --z-header:             100;
  --z-footer:             100;
  --z-modal:              200;
  --z-tooltip:            300;
  --z-overlay:            400;
}

/* ============================================================================
   BASE / BODY STYLES
   ============================================================================ */
body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================================================
   SELECTION STYLING
   ============================================================================ */
::selection {
  background: rgba(51, 119, 255, 0.3);
  color: inherit;
}

::-moz-selection {
  background: rgba(51, 119, 255, 0.3);
  color: inherit;
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

/* Webkit (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: none;
}

/* ============================================================================
   UTILITY CLASSES — GLASS & GLOW
   ============================================================================ */

/* --- Glass Panel --------------------------------------------------------- */
.glass-panel {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base);
}

.glass-panel:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--glass-shadow),
              0 0 20px rgba(var(--accent-primary-rgb), 0.05);
}

.glass-panel--elevated {
  background: var(--glass-bg-heavy);
  box-shadow: var(--glass-shadow),
              0 16px 48px rgba(0, 0, 0, 0.3);
}

.glass-panel--subtle {
  background: var(--glass-bg-light);
  border-color: rgba(var(--accent-primary-rgb), 0.05);
}

/* --- Glow Text ----------------------------------------------------------- */
.glow-text {
  color: var(--accent-primary);
  text-shadow:
    0 0 7px rgba(var(--accent-primary-rgb), 0.6),
    0 0 20px rgba(var(--accent-primary-rgb), 0.3),
    0 0 42px rgba(var(--accent-primary-rgb), 0.15);
}

.glow-text--secondary {
  color: var(--accent-secondary);
  text-shadow:
    0 0 7px rgba(var(--accent-secondary-rgb), 0.6),
    0 0 20px rgba(var(--accent-secondary-rgb), 0.3),
    0 0 42px rgba(var(--accent-secondary-rgb), 0.15);
}

.glow-text--verification {
  color: var(--verification-green);
  text-shadow:
    0 0 7px rgba(var(--verification-rgb), 0.6),
    0 0 20px rgba(var(--verification-rgb), 0.3);
}

/* --- Neon Border --------------------------------------------------------- */
.neon-border {
  border: 1px solid rgba(var(--accent-primary-rgb), 0.4);
  box-shadow:
    0 0 5px rgba(var(--accent-primary-rgb), 0.1),
    inset 0 0 5px rgba(var(--accent-primary-rgb), 0.05);
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base);
}

.neon-border:hover {
  border-color: rgba(var(--accent-primary-rgb), 0.7);
  box-shadow:
    0 0 15px rgba(var(--accent-primary-rgb), 0.2),
    0 0 30px rgba(var(--accent-primary-rgb), 0.1),
    inset 0 0 10px rgba(var(--accent-primary-rgb), 0.05);
}

.neon-border--secondary {
  border-color: rgba(var(--accent-secondary-rgb), 0.4);
  box-shadow:
    0 0 5px rgba(var(--accent-secondary-rgb), 0.1),
    inset 0 0 5px rgba(var(--accent-secondary-rgb), 0.05);
}

/* --- Badge --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--text-secondary);
  background: rgba(var(--accent-primary-rgb), 0.08);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.15);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: all var(--transition-base);
}

.badge:hover {
  background: rgba(var(--accent-primary-rgb), 0.14);
  border-color: rgba(var(--accent-primary-rgb), 0.3);
  color: var(--text-primary);
}

.badge__icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.badge--success {
  color: var(--verification-green);
  background: rgba(var(--verification-rgb), 0.08);
  border-color: rgba(var(--verification-rgb), 0.2);
}

.badge--warning {
  color: var(--warning-amber);
  background: rgba(var(--warning-rgb), 0.08);
  border-color: rgba(var(--warning-rgb), 0.2);
}

.badge--error {
  color: var(--error-red);
  background: rgba(var(--error-rgb), 0.08);
  border-color: rgba(var(--error-rgb), 0.2);
}

/* --- Tier Label ---------------------------------------------------------- */
.tier-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.06);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.tier-label--truth {
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.06);
  border-color: rgba(var(--accent-primary-rgb), 0.2);
}

.tier-label--proof {
  color: var(--accent-secondary);
  background: rgba(var(--accent-secondary-rgb), 0.06);
  border-color: rgba(var(--accent-secondary-rgb), 0.2);
}

.tier-label--source {
  color: var(--verification-green);
  background: rgba(var(--verification-rgb), 0.06);
  border-color: rgba(var(--verification-rgb), 0.2);
}

.tier-label__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-circle);
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* ============================================================================
   LAYOUT UTILITIES
   ============================================================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.container--narrow {
  max-width: 800px;
}

.container--wide {
  max-width: 1440px;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

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

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-xs  { gap: var(--space-xs); }
.gap-sm  { gap: var(--space-sm); }
.gap-md  { gap: var(--space-md); }
.gap-lg  { gap: var(--space-lg); }
.gap-xl  { gap: var(--space-xl); }

.text-center { text-align: center; }
.text-mono   { font-family: var(--font-mono); }
.text-heading { font-family: var(--font-heading); }

.text-xs   { font-size: var(--fs-xs); }
.text-sm   { font-size: var(--fs-sm); }
.text-base { font-size: var(--fs-base); }
.text-md   { font-size: var(--fs-md); }
.text-lg   { font-size: var(--fs-lg); }
.text-xl   { font-size: var(--fs-xl); }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent-primary); }

.w-full   { width: 100%; }
.h-full   { height: 100%; }
.h-screen { min-height: 100vh; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }

.overflow-hidden { overflow: hidden; }

.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;
}

/* ============================================================================
   FOCUS VISIBLE — Accessibility
   ============================================================================ */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ============================================================================
   REDUCED MOTION — Accessibility
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
