/**
 * OPERATIC - Enhanced Operatic Theme System
 * Personal AI Control Center
 * Aesthetic: Terminal interface, control center, hacker workstation
 */

/* ==================== CSS VARIABLES ==================== */

:root {
  /* Operatic Light - Clean control center interface */
  --bg-primary: #FAFAFA;
  --bg-secondary: #F0F0F0;
  --bg-tertiary: #E8E8E8;
  --bg-overlay: rgba(250, 250, 250, 0.98);
  --bg-console: #FFFFFF;

  --text-primary: #0D0D0D;
  --text-secondary: #2D2D2D;
  --text-tertiary: #5D5D5D;
  --text-muted: #8D8D8D;

  --accent-primary: #00C896;
  --accent-hover: #00B385;
  --accent-subtle: rgba(0, 200, 150, 0.1);
  --accent-glow: rgba(0, 200, 150, 0.3);

  --border-primary: #D0D0D0;
  --border-secondary: #B8B8B8;
  --border-accent: #00C896;
  --border-glow: rgba(0, 200, 150, 0.5);

  --ascii-color: #4D4D4D;
  --ascii-bright: #0D0D0D;
  --ascii-accent: #00C896;

  --success: #00E676;
  --warning: #FFC107;
  --error: #FF5252;
  --info: #00BCD4;
  --critical: #FF1744;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 20px -4px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(0, 200, 150, 0.4);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --scanline-opacity: 0.03;
  --crt-flicker: 0;

  /* Theme indicator colors (static, for theme selector preview) */
  --theme-color-light: #00C896;
  --theme-color-light-glow: rgba(0, 200, 150, 0.5);
  --theme-color-dark: #00FF41;
  --theme-color-dark-glow: rgba(0, 255, 65, 0.6);
  --theme-color-matrix: #00FF00;
  --theme-color-matrix-glow: rgba(0, 255, 0, 0.7);
  --theme-color-cyberpunk: #00FFFF;
  --theme-color-cyberpunk-alt: #FF00FF;
  --theme-color-cyberpunk-glow: rgba(0, 255, 255, 0.7);
  --theme-color-amber: #FFD700;
  --theme-color-amber-glow: rgba(255, 215, 0, 0.6);
}

[data-theme="dark"] {
  /* Operatic Dark - Classic terminal console with green phosphor */
  --bg-primary: #0A0A0A;
  --bg-secondary: #121212;
  --bg-tertiary: #1A1A1A;
  --bg-overlay: rgba(10, 10, 10, 0.98);
  --bg-console: #000000;

  --text-primary: #00FF41;
  --text-secondary: #00E63B;
  --text-tertiary: #00CC35;
  --text-muted: #008A23;

  --accent-primary: #00FF41;
  --accent-hover: #33FF66;
  --accent-subtle: rgba(0, 255, 65, 0.1);
  --accent-glow: rgba(0, 255, 65, 0.4);

  --border-primary: #1F3A1F;
  --border-secondary: #2A4A2A;
  --border-accent: #00FF41;
  --border-glow: rgba(0, 255, 65, 0.6);

  --ascii-color: #00B831;
  --ascii-bright: #00FF41;
  --ascii-accent: #33FF66;

  --success: #00FF41;
  --warning: #FFA000;
  --error: #FF1744;
  --info: #00E5FF;
  --critical: #FF0000;

  --shadow-sm: 0 0 8px rgba(0, 255, 65, 0.1);
  --shadow-md: 0 0 15px rgba(0, 255, 65, 0.15);
  --shadow-lg: 0 0 25px rgba(0, 255, 65, 0.2);
  --shadow-glow: 0 0 30px rgba(0, 255, 65, 0.5);

  --scanline-opacity: 0.08;
  --crt-flicker: 0.02;
}

[data-theme="matrix"] {
  /* Matrix Theme - Digital rain terminal mode */
  --bg-primary: #000000;
  --bg-secondary: #001100;
  --bg-tertiary: #002200;
  --bg-overlay: rgba(0, 0, 0, 0.98);
  --bg-console: #000000;

  --text-primary: #00FF00;
  --text-secondary: #00DD00;
  --text-tertiary: #00BB00;
  --text-muted: #007700;

  --accent-primary: #00FF00;
  --accent-hover: #33FF33;
  --accent-subtle: rgba(0, 255, 0, 0.1);
  --accent-glow: rgba(0, 255, 0, 0.5);

  --border-primary: #003300;
  --border-secondary: #004400;
  --border-accent: #00FF00;
  --border-glow: rgba(0, 255, 0, 0.7);

  --ascii-color: #00AA00;
  --ascii-bright: #00FF00;
  --ascii-accent: #66FF66;

  --success: #00FF00;
  --warning: #FFFF00;
  --error: #FF0000;
  --info: #00FFFF;
  --critical: #FF0000;

  --shadow-sm: 0 0 10px rgba(0, 255, 0, 0.2);
  --shadow-md: 0 0 20px rgba(0, 255, 0, 0.3);
  --shadow-lg: 0 0 35px rgba(0, 255, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(0, 255, 0, 0.6);

  --scanline-opacity: 0.12;
  --crt-flicker: 0.04;
}

[data-theme="cyberpunk"] {
  /* Cyberpunk Theme - Neon terminal with magenta/cyan */
  --bg-primary: #0D0221;
  --bg-secondary: #1A0B3D;
  --bg-tertiary: #2D1459;
  --bg-overlay: rgba(13, 2, 33, 0.98);
  --bg-console: #000000;

  --text-primary: #FF00FF;
  --text-secondary: #DD00DD;
  --text-tertiary: #BB00BB;
  --text-muted: #880088;

  --accent-primary: #00FFFF;
  --accent-hover: #33FFFF;
  --accent-subtle: rgba(0, 255, 255, 0.1);
  --accent-glow: rgba(0, 255, 255, 0.5);

  --border-primary: #4D1F7C;
  --border-secondary: #6929A8;
  --border-accent: #00FFFF;
  --border-glow: rgba(0, 255, 255, 0.7);

  --ascii-color: #BB00BB;
  --ascii-bright: #FF00FF;
  --ascii-accent: #00FFFF;

  --success: #00FF00;
  --warning: #FFD700;
  --error: #FF1493;
  --info: #00FFFF;
  --critical: #FF0066;

  --shadow-sm: 0 0 10px rgba(255, 0, 255, 0.2);
  --shadow-md: 0 0 20px rgba(0, 255, 255, 0.3);
  --shadow-lg: 0 0 35px rgba(255, 0, 255, 0.4);
  --shadow-glow: 0 0 40px rgba(0, 255, 255, 0.6);

  --scanline-opacity: 0.1;
  --crt-flicker: 0.03;
}

[data-theme="amber"] {
  /* Amber Theme - Vintage CRT terminal with amber phosphor */
  --bg-primary: #1A1000;
  --bg-secondary: #2A1800;
  --bg-tertiary: #3A2000;
  --bg-overlay: rgba(26, 16, 0, 0.98);
  --bg-console: #000000;

  --text-primary: #FFB000;
  --text-secondary: #FFA000;
  --text-tertiary: #FF9000;
  --text-muted: #CC7000;

  --accent-primary: #FFD700;
  --accent-hover: #FFED4E;
  --accent-subtle: rgba(255, 215, 0, 0.1);
  --accent-glow: rgba(255, 215, 0, 0.4);

  --border-primary: #3A2000;
  --border-secondary: #4A2800;
  --border-accent: #FFD700;
  --border-glow: rgba(255, 215, 0, 0.6);

  --ascii-color: #CC8800;
  --ascii-bright: #FFB000;
  --ascii-accent: #FFD700;

  --success: #00FF00;
  --warning: #FFD700;
  --error: #FF4500;
  --info: #FFB000;
  --critical: #FF0000;

  --shadow-sm: 0 0 8px rgba(255, 176, 0, 0.15);
  --shadow-md: 0 0 15px rgba(255, 176, 0, 0.25);
  --shadow-lg: 0 0 25px rgba(255, 176, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(255, 215, 0, 0.5);

  --scanline-opacity: 0.15;
  --crt-flicker: 0.05;
}

/* ==================== RESET & BASE ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga', 'kern';
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-base), color var(--transition-base);
  min-height: 100vh;
  position: relative;
}

/* Brutalist: No background gradients, just clean solid colors */

/* ==================== TYPOGRAPHY ==================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
}

h2 {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

h3 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

h4 {
  font-size: 1.25rem;
  font-weight: 700;
}

h5 {
  font-size: 1.125rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* Monospace (terminal/code aesthetic) */
code, pre, .mono {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-variant-numeric: tabular-nums;
}

code {
  background-color: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

pre {
  background-color: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* ==================== SELECTION ==================== */

::selection {
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
}

::-moz-selection {
  background-color: var(--accent-subtle);
  color: var(--accent-primary);
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ==================== UTILITIES ==================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-narrow {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Spacing */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.mt-8 { margin-top: 4rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-6 { margin-bottom: 3rem; }
.mb-8 { margin-bottom: 4rem; }

.py-4 { padding-top: 2rem; padding-bottom: 2rem; }
.py-6 { padding-top: 3rem; padding-bottom: 3rem; }
.py-8 { padding-top: 4rem; padding-bottom: 4rem; }
.py-12 { padding-top: 6rem; padding-bottom: 6rem; }

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-mono { font-family: 'JetBrains Mono', monospace; }

/* ==================== ANIMATIONS ==================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes glitch {
  0%, 100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

.fade-in {
  animation: fadeIn var(--transition-slow) ease-out;
}

.slide-up {
  animation: slideUp var(--transition-slow) ease-out;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  .container,
  .container-wide,
  .container-narrow {
    padding: 0 1.5rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .container,
  .container-wide,
  .container-narrow {
    padding: 0 1rem;
  }
}

/* ==================== ACCESSIBILITY ==================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
*:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
