/* ==========================================================================
   Win3 Academy - Core Design System
   Design tokens, CSS reset, theme variables, typography, base styles
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* --------------------------------------------------------------------------
   Font Declarations
   -------------------------------------------------------------------------- */
/* Poppins + Caveat loaded via Google Fonts <link> in index.html */
/* PacificaCondensed loaded via @font-face in index.html <style> block */

/* --------------------------------------------------------------------------
   Design Tokens - Dark Theme (Default)
   -------------------------------------------------------------------------- */
:root,
[data-theme="dark"] {
  /* Fonts */
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-handwriting: 'Caveat', cursive;
  --font-logo: 'PacificaCondensed', cursive;

  /* Spacing Scale */
  --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: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  --transition-theme: 0.3s ease;

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-sidebar: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;

  /* Backgrounds */
  --bg-page: #1A1A1A;
  --bg-primary: #2C2726;
  --bg-secondary: #3D3736;
  --bg-card: rgba(45, 39, 38, 0.55);
  --bg-card-hover: rgba(45, 39, 38, 0.75);

  /* Text */
  --text-primary: #F4F0EC;
  --text-secondary: #CCCCCC;
  --text-muted: #888888;
  --text-dim: #666666;

  /* Accents */
  --accent-gold: #BC8034;
  --accent-gold-light: #D4A04A;
  --accent-gold-dark: #8B5E2F;
  --accent-orange: #D96935;
  --accent-green: #4CAF50;
  --accent-blue: #6495ED;
  --accent-red: #E74C3C;

  /* Gold Opacity Scale */
  --gold-10: rgba(188, 128, 52, 0.1);
  --gold-15: rgba(188, 128, 52, 0.15);
  --gold-20: rgba(188, 128, 52, 0.2);
  --gold-25: rgba(188, 128, 52, 0.25);
  --gold-35: rgba(188, 128, 52, 0.35);

  /* Borders */
  --border-subtle: var(--gold-15);
  --border-card: var(--gold-20);
  --border-active: #BC8034;

  /* Glass Effect */
  --glass-bg: rgba(45, 39, 38, 0.55);
  --glass-border: 1px solid var(--gold-20);
  --glass-blur: blur(20px);
  --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Logo */
  --logo-circle-stroke: #BC8034;
  --logo-circle-width: 1.5px;
  --logo-ring: rgba(188, 128, 52, 0.25);
  --logo-dot: #F5F0EB;
  --logo-text: #BC8034;

  /* Phase Colors (Win3 Kurs) */
  --phase-be: #6495ED;
  --phase-do: #4CAF50;
  --phase-make: #BC8034;

  /* Effects */
  --effects-enabled: 1;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.3);

  /* Scrollbar */
  --scrollbar-track: #2C2726;
  --scrollbar-thumb: #BC8034;
  --scrollbar-thumb-hover: #D4A04A;
}

/* --------------------------------------------------------------------------
   Design Tokens - Light Theme
   -------------------------------------------------------------------------- */
[data-theme="light"] {
  /* Backgrounds */
  --bg-page: #F8F6F3;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F0EDE8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);

  /* Text */
  --text-primary: #2C2726;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-dim: #AAAAAA;

  /* Accents */
  --accent-gold: #8B5E2F;
  --accent-gold-light: #BC8034;
  --accent-gold-dark: #6B4520;
  --accent-orange: #D96935;
  --accent-green: #388E3C;
  --accent-blue: #3B6FCF;
  --accent-red: #C0392B;

  /* Borders */
  --border-subtle: rgba(44, 39, 38, 0.08);
  --border-card: rgba(44, 39, 38, 0.12);
  --border-active: #8B5E2F;

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(44, 39, 38, 0.1);
  --glass-blur: blur(20px);
  --glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);

  /* Logo */
  --logo-circle-stroke: #2C2726;
  --logo-circle-width: 2px;
  --logo-ring: rgba(188, 128, 52, 0.25);
  --logo-dot: #BC8034;
  --logo-text: #2C2726;

  /* Effects */
  --effects-enabled: 0;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

  /* Scrollbar */
  --scrollbar-track: #F0EDE8;
  --scrollbar-thumb: #8B5E2F;
  --scrollbar-thumb-hover: #BC8034;
}

/* --------------------------------------------------------------------------
   Body & App Shell
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  transition: background var(--transition-theme), color var(--transition-theme);
  overflow-x: hidden;
}

#app {
  position: relative;
  z-index: 5;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

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

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* --------------------------------------------------------------------------
   Selection Styling
   -------------------------------------------------------------------------- */
::selection {
  background: rgba(188, 128, 52, 0.35);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(188, 128, 52, 0.35);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
  transition: color var(--transition-theme);
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
}

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

h5 {
  font-size: 1.1rem;
  font-weight: 500;
}

h6 {
  font-size: 1rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Paragraphs */
p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
  transition: color var(--transition-theme);
}

p:last-child {
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--accent-gold);
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Strong / Bold */
strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

/* Emphasis */
em, i {
  font-style: italic;
}

/* Small text */
small {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Code */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--accent-gold-light);
  transition: background var(--transition-theme), color var(--transition-theme);
}

pre {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow-x: auto;
  transition: background var(--transition-theme);
}

pre code {
  padding: 0;
  background: none;
}

/* Blockquote */
blockquote {
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--accent-gold);
  background: var(--bg-card);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-secondary);
  transition: background var(--transition-theme), border-color var(--transition-theme);
}

blockquote p {
  margin-bottom: 0;
}

/* Handwriting font utility */
.font-handwriting {
  font-family: var(--font-handwriting);
}

/* Logo font utility */
.font-logo {
  font-family: var(--font-logo);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

/* Text colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-gold { color: var(--accent-gold); }
.text-orange { color: var(--accent-orange); }
.text-green { color: var(--accent-green); }
.text-blue { color: var(--accent-blue); }
.text-red { color: var(--accent-red); }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Font weights */
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Font sizes */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }

/* Flexbox helpers */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.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); }
.gap-2xl { gap: var(--space-2xl); }

/* Spacing */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.p-2xl { padding: var(--space-2xl); }

/* Width / overflow */
.w-full { width: 100%; }
.max-w-full { max-width: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Transitions for theme changes on generic elements */
.theme-transition {
  transition: background var(--transition-theme),
              color var(--transition-theme),
              border-color var(--transition-theme),
              box-shadow var(--transition-theme);
}

/* Visually hidden (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: 0;
}

/* Truncate text */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Line clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
