/*
 * AVTF Outpost — Design Tokens  (single source of truth)
 * ─────────────────────────────────────────────────────────────
 * TO CHANGE THE FONT : update --font-family-base only (line ~18)
 * TO CHANGE THE SCALE: update --type-scale and sizes regenerate
 * ─────────────────────────────────────────────────────────────
 */

/* ── 1. FONT LOADING ─────────────────────────────────────────
   Font is loaded via <link> tags in each HTML file (faster than @import).
   To swap the font for the whole project:
     Step 1 — Update the Google Fonts URL in index.html, editor.html, preview.html
     Step 2 — Update --font-family-base below
   
    Current font: JetBrains Mono
   Google Fonts URL pattern:
     https://fonts.googleapis.com/css2?family=FAMILY_NAME:ital,wght@WEIGHTS&display=swap
   
   Quick swap options:
     JetBrains Mono : family=JetBrains+Mono:ital,wght@0,100..800;1,100..800
     Fira Code      : family=Fira+Code:wght@300..700
     IBM Plex Mono  : family=IBM+Plex+Mono:ital,wght@0,100;0,400;0,700;1,400
     Space Mono     : family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700
     Inter (sans)   : family=Inter:wght@300..700  → also remove "monospace" fallback below
*/

:root {
  /* ── 2. FONT FAMILY ──────────────────────────────────────── */
  --font-family-base: 'JetBrains Mono', 'Courier New', monospace;
  --font-family-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Aliases */
  --font: var(--font-family-base);
  --font-mono: var(--font-family-mono);

  /* ── 3. TYPE SCALE ───────────────────────────────────────── */
  --type-2xs: 9px;
  --type-xs: 10px;
  --type-sm: 12px;
  --type-base: 13px;
  --type-md: 14px;
  --type-lg: 16px;
  --type-xl: 18px;
  --type-2xl: 22px;
  --type-3xl: 28px;
  --type-4xl: 36px;

  /* Legacy aliases */
  --size-xxs: var(--type-2xs);
  --size-xs: var(--type-xs);
  --size-sm: var(--type-sm);
  --size-base: var(--type-base);
  --size-md: var(--type-md);
  --size-lg: var(--type-lg);
  --size-xl: var(--type-xl);
  --size-2xl: var(--type-2xl);
  --size-3xl: var(--type-3xl);

  /* ── 4. FONT WEIGHTS ─────────────────────────────────────── */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ── 5. LINE-HEIGHT & LETTER-SPACING ─────────────────────── */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-loose: 2;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* ── 6. RADIUS & SHADOWS (Shadcn-like) ────────────────────── */
  --radius-sm: 0.3rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* ── 7. THEME: DARK (Default) ────────────────────────────── */
  --bg-base: #0a0a0a;
  --bg-panel: #111111;
  --bg-raised: #1a1a1a;
  --bg-elevated: #262626;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --bg-ash: #0d0d0d;
  --bg-ash-grey: #1f1f1f;
  --bg-glass: rgba(10, 10, 10, 0.85);

  --border: #262626;
  --border-subtle: #1a1a1a;
  --border-hover: #404040;
  --border-active: #525252;

  --overlay: rgba(0, 0, 0, 0.85);
  --overlay-blur: 4px;
  --border-focus: var(--accent);
  --border-glass: rgba(255, 255, 255, 0.08);

  --text-primary: #ffffff;
  --text-secondary: #e5e5e5;
  --text-muted: #a3a3a3;
  --text-disabled: #737373;
  --text-inverse: #0a0a0a;

  --accent: #e11d48;
  --accent-dim: rgba(225, 29, 72, 0.15);
  --accent-glow: rgba(225, 29, 72, 0.3);
  --accent-hover: #f43f5e;
  --accent-active: #be123c;
  --accent-text: #fb7185;

  --success: #10b981;
  --success-dim: rgba(16, 185, 129, 0.15);
  --success-hover: #34d399;
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.15);

  /* Hotspot types */
  --hs-navigate: var(--accent);
  --hs-info: var(--warning);
  --hs-url: var(--success);
  --hs-image: #d946ef;
  --hs-video: #f43f5e;
  --hs-audio: #8b5cf6;

  /* Legacy radius support */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

:root {
  /* ── 9. NAMED TEXT ROLES ──────────────────────────────────── */
  --text-display: var(--type-4xl) / var(--weight-bold) / var(--leading-tight);
  --text-h1: var(--type-3xl) / var(--weight-bold) / var(--leading-tight);
  --text-h2: var(--type-2xl) / var(--weight-semibold)/ var(--leading-tight);
  --text-h3: var(--type-xl) / var(--weight-semibold)/ var(--leading-snug);
  --text-h4: var(--type-lg) / var(--weight-semibold)/ var(--leading-snug);
  --text-label: var(--type-md) / var(--weight-medium) / var(--leading-tight);
  --text-body: var(--type-base)/ var(--weight-regular) / var(--leading-normal);
  --text-small: var(--type-sm) / var(--weight-regular) / var(--leading-snug);
  --text-micro: var(--type-xs) / var(--weight-medium) / var(--leading-tight);
  --text-badge: var(--type-2xs) / var(--weight-bold) / var(--leading-tight);
  --text-mono: var(--type-sm) / var(--weight-regular) / var(--leading-normal);

  /* ── 10. SPACING ────────────────────────────────────────── */
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 6px;
  --space-4: 8px;
  --space-5: 12px;
  --space-6: 16px;
  --space-7: 20px;

  --space-8: 24px;
  --space-9: 32px;
  --space-10: 40px;

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* ── 10. ELEVATION / SHADOWS ────────────────────────────────*/
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.60);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.75);

    /* ── 11. MOTION ─────────────────────────────────────────────*/
  --t: 0.15s ease;
  --t-slow: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Smooth theme transitions on theme-switchable properties */
html, body {
  transition: background-color 0.18s ease, color 0.18s ease;
}
[data-theme] .scene-card, [data-theme] .btn, [data-theme] .card,
[data-theme] input, [data-theme] select, [data-theme] textarea,
[data-theme] #controls .ctrl-btn, [data-theme] #sceneList,
[data-theme] #dashboard-view, [data-theme] .dashboard-header,
[data-theme] .project-card, [data-theme] .media-item {
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

/* ── 12. TYPOGRAPHIC UTILITIES ─────────────────────────────────
   Opt-in classes. Apply to any element to get a consistent
   text role without writing font-* properties inline.
*/

.text-display {
  font-size: var(--type-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-h1 {
  font-size: var(--type-3xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-h2 {
  font-size: var(--type-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.text-h3 {
  font-size: var(--type-xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

.text-h4 {
  font-size: var(--type-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

.text-label {
  font-size: var(--type-md);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
}

.text-body {
  font-size: var(--type-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
}

.text-small {
  font-size: var(--type-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
}

.text-micro {
  font-size: var(--type-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.text-badge {
  font-size: var(--type-2xs);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.text-mono {
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
}

/* Colour helpers */
.text-primary {
  color: var(--text-primary);
}

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

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

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

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

/* ── 13. BASE RESET ────────────────────────────────────────────
   Applies the font system to the entire document.
   All CSS files inherit from this; no per-file @import needed.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: var(--type-base);
}

body {
  font-family: var(--font-family-base);
  font-size: var(--type-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Native elements pick up the font automatically */
input,
textarea,
select,
button {
  font-family: inherit;
  font-size: inherit;
}

/* Headings reset — use .text-h* classes or var() for sizing */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-base);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin: 0;
}

/* ── 8. THEME: LIGHT ──────────────────────────────────────── */
[data-theme="light"] {
  --bg-base: #ffffff;
  --bg-panel: #fafafa;
  --bg-raised: #f5f5f5;
  --bg-elevated: #e5e5e5;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(0, 0, 0, 0.08);
  --bg-ash: #fdfdfd;
  --bg-ash-grey: #f0f0f0;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border: #e5e5e5;
  --border-subtle: #f0f0f0;
  --border-hover: #d4d4d4;
  --border-focus: var(--accent);
  --border-glass: rgba(0, 0, 0, 0.08);

  --text-primary: #000000;
  --text-secondary: #262626;
  --text-muted: #525252;
  --text-disabled: #737373;
  --text-inverse: #ffffff;

  --accent: #e11d48;
  --accent-dim: rgba(225, 29, 72, 0.1);
  --accent-glow: rgba(225, 29, 72, 0.2);
  --accent-hover: #fb7185;
  --accent-active: #be123c;
  --accent-text: #e11d48;

  --success: #10b981;
  --success-dim: rgba(16, 185, 129, 0.08);
  --success-hover: #34d399;
  --warning: #d97706;
  --warning-dim: rgba(217, 119, 6, 0.08);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.08);
  --info: #3b82f6;
  --info-dim: rgba(59, 130, 246, 0.08);

  --hs-navigate: var(--accent);
  --hs-info: #d97706;
  --hs-url: #059669;
  --hs-image: #c026d3;
  --hs-video: #e11d48;
  --hs-audio: #7c3aed;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}