/* ══════════════════════════════════════════════════════════
   BUILD WITH VIBE – SHARED DESIGN SYSTEM
   Zentrale Design-Tokens und Basis-Komponenten fuer alle
   Kurs-Visuals. Wird von allen HTML-Seiten importiert.
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════
   DESIGN TOKENS  (Dark = default)
   ══════════════════════════════════════════ */
:root {
  /* Background & Surface */
  --bg: #050510;
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.14);

  /* Glass – white overlay levels (dark mode) */
  --glass-2: rgba(255,255,255,0.02);
  --glass-3: rgba(255,255,255,0.03);
  --glass-4: rgba(255,255,255,0.04);
  --glass-5: rgba(255,255,255,0.05);
  --glass-7: rgba(255,255,255,0.07);
  --glass-8: rgba(255,255,255,0.08);
  --glass-10: rgba(255,255,255,0.10);
  --glass-12: rgba(255,255,255,0.12);
  --glass-15: rgba(255,255,255,0.15);
  --glass-20: rgba(255,255,255,0.20);
  --glass-30: rgba(255,255,255,0.30);

  /* Text hierarchy */
  --text: #ffffff;
  --text-secondary: #a3a3a3;
  --text-muted: #8a8a8a;
  --text-faint: #818181;

  /* Brand / Phase colors */
  --orange: #ff6f00;
  --orange-soft: #ffb77e;
  --orange-bg: rgba(255,111,0,0.08);
  --orange-border: rgba(255,111,0,0.22);
  --neck: #d4a054;
  --p1: #8bc34a;
  --p2: #42a5f5;
  --p3: #ab47bc;
  --red: #e53935;

  /* Semantic aliases */
  --accent: var(--orange);
  --green: var(--p1);
  --blue: var(--p2);
  --purple: var(--p3);

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Inter Tight', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Layout */
  --page-pad: var(--space-5) 28px var(--space-4);
  --radius-sm: var(--space-2);
  --radius-md: var(--space-3);
  --radius-lg: var(--space-4);

  /* Transitions */
  --ease-default: 0.25s ease;
  --ease-fast: 0.15s ease;

  /* Background effects */
  --grid-line: rgba(255,255,255,0.3);
  --grid-opacity: 0.06;
  --glow-color: rgba(255,111,0,0.03);
}

/* ══════════════════════════════════════════
   LIGHT MODE OVERRIDES
   ══════════════════════════════════════════ */
[data-theme="light"] {
  color-scheme: light;
  --bg: #eaeff5;
  --surface: rgba(0,0,0,0.025);
  --surface-hover: rgba(0,0,0,0.04);
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.16);

  --glass-2: rgba(0,0,0,0.02);
  --glass-3: rgba(0,0,0,0.025);
  --glass-4: rgba(0,0,0,0.03);
  --glass-5: rgba(0,0,0,0.04);
  --glass-7: rgba(0,0,0,0.05);
  --glass-8: rgba(0,0,0,0.06);
  --glass-10: rgba(0,0,0,0.07);
  --glass-12: rgba(0,0,0,0.10);
  --glass-15: rgba(0,0,0,0.12);
  --glass-20: rgba(0,0,0,0.16);
  --glass-30: rgba(0,0,0,0.10);

  --text: #1a1a2e;
  --text-secondary: #3d3d54;
  --text-muted: #5d5d72;
  --text-faint: #5d5d72;

  --orange: #c05000;
  --orange-soft: #c47030;
  --orange-bg: rgba(229,98,0,0.08);
  --orange-border: rgba(229,98,0,0.25);
  --neck: #a07830;
  --p1: #558b2f;
  --p2: #1976d2;
  --p3: #8e24aa;
  --red: #c62828;

  --grid-line: rgba(0,0,0,0.08);
  --grid-opacity: 0.25;
  --glow-color: rgba(25,118,210,0.06);
}

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

html {
  color-scheme: dark;
}
html, body {
  height: 100%;
}

/* ── Focus ring for keyboard navigation ── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) {
  outline: none;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════
   PAGE LAYOUT (100vh, no scroll – default)
   Override with .page-scroll for scrollable pages
   ══════════════════════════════════════════ */
.page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: var(--page-pad);
  position: relative;
  overflow: hidden;
}
.page-scroll {
  height: auto;
  min-height: 100vh;
  overflow: visible;
}

/* Constrain prose width for readability on wide screens */
.page-scroll > *:not(.bwv-header):not(.grid-bg):not(.glow-bg):not(.see-also) {
  max-width: 65ch;
}

/* ══════════════════════════════════════════
   BACKGROUND EFFECTS
   ══════════════════════════════════════════ */

/* Subtle grid (blueprint-style) */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grid-opacity);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Radial glow accent */
.glow-bg {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1000px;
  height: 600px;
  background: radial-gradient(ellipse, var(--glow-color) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════════════
   SHARED HEADER
   ══════════════════════════════════════════ */
.bwv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-5);
  border-radius: 10px;
  background: var(--glass-2);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.bwv-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--orange) 0%, rgba(255,111,0,0.3) 60%, transparent 100%);
  border-radius: 10px 10px 0 0;
}
.bwv-header h1 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}
.bwv-header h1 .vibe {
  color: var(--orange);
}
.bwv-header .subtitle {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 500;
  margin-left: var(--space-4);
}
.bwv-header-left {
  display: flex;
  align-items: center;
}
.bwv-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Back-link in header for sub-pages */
.bwv-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  margin-right: 14px;
  padding: 3px 8px;
  border-radius: 6px;
  transition: color var(--ease-fast), background var(--ease-fast);
}
.bwv-header .back-link:hover {
  color: var(--text);
  background: var(--glass-4);
}
.bwv-header .back-link svg {
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   NAV-BACK LINK (reusable across pages)
   ══════════════════════════════════════════ */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  transition: color var(--ease-fast), background var(--ease-fast);
}
.nav-back:hover {
  color: var(--text);
  background: var(--glass-4);
}
.nav-back svg {
  flex-shrink: 0;
}

/* Floating back-link (top-left, for fullscreen visuals) */
.nav-back-float {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 50;
}

/* ══════════════════════════════════════════
   SHARED CARD
   ══════════════════════════════════════════ */
.bwv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* ══════════════════════════════════════════
   SECTION LABELS (uppercase small caps)
   ══════════════════════════════════════════ */
.bwv-label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

/* ══════════════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════════════ */
.bwv-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--glass-5);
  border: 1px solid var(--glass-8);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
}
.bwv-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--glass-5);
  border: 1px solid var(--glass-8);
  color: var(--text-secondary);
}

/* Phase-colored pills */
.bwv-pill-orange { background: rgba(255,111,0,0.12); color: var(--orange); border-color: rgba(255,111,0,0.3); }
.bwv-pill-green  { background: rgba(139,195,74,0.12); color: var(--p1); border-color: rgba(139,195,74,0.3); }
.bwv-pill-blue   { background: rgba(66,165,245,0.12); color: var(--p2); border-color: rgba(66,165,245,0.3); }
.bwv-pill-purple { background: rgba(171,71,188,0.12); color: var(--p3); border-color: rgba(171,71,188,0.3); }

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.bwv-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--glass-7);
  background: var(--glass-2);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease-default), border-color var(--ease-default), color var(--ease-default);
  white-space: nowrap;
  user-select: none;
}
.bwv-btn:hover {
  background: var(--glass-5);
  border-color: var(--glass-12);
  color: var(--text-secondary);
}
.bwv-btn:active {
  transform: scale(0.97);
}
.bwv-btn.active {
  background: rgba(255,111,0,0.07);
  border-color: rgba(255,111,0,0.22);
  color: var(--orange);
}

/* ══════════════════════════════════════════
   LEGEND (footer bar)
   ══════════════════════════════════════════ */
.bwv-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  margin-top: 6px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.bwv-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  color: var(--text-faint);
}
.bwv-legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0.6;
}

/* ══════════════════════════════════════════
   UTILITY: 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;
}

/* ══════════════════════════════════════════
   UTILITY: skip-to-content link
   ══════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 10000;
  padding: 8px 16px;
  background: var(--orange);
  color: #1a1a2e;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

/* ══════════════════════════════════════════
   UTILITY: accent color classes
   ══════════════════════════════════════════ */
.c-orange { color: var(--orange); }
.c-green  { color: var(--p1); }
.c-blue   { color: var(--p2); }
.c-purple { color: var(--p3); }

/* ══════════════════════════════════════════
   SEE ALSO — cross-navigation footer
   ══════════════════════════════════════════ */
.see-also {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 10px 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
}
.see-also-label {
  font-size: 0.65rem;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.see-also a {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: color var(--ease-fast), background var(--ease-fast);
}
.see-also a:hover {
  color: var(--text);
  background: var(--glass-4);
}

/* ══════════════════════════════════════════
   THEME TOGGLE BUTTON
   ══════════════════════════════════════════ */
.bwv-theme-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--glass-5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease-default), border-color var(--ease-default);
  padding: 0;
  color: var(--text-muted);
}
.bwv-theme-toggle:hover {
  background: var(--glass-10);
  border-color: var(--orange-border);
  color: var(--text);
  transform: scale(1.08);
}
.bwv-theme-toggle:active {
  transform: scale(0.95);
}
.bwv-theme-toggle svg {
  width: 18px;
  height: 18px;
}
/* Sun icon: hidden in dark, visible in light */
.bwv-theme-toggle .icon-sun { display: none; }
.bwv-theme-toggle .icon-moon { display: block; }
[data-theme="light"] .bwv-theme-toggle .icon-sun { display: block; }
[data-theme="light"] .bwv-theme-toggle .icon-moon { display: none; }

/* Smooth theme transition on body */
body, .bwv-header, .bwv-card, .bwv-btn, .bwv-badge, .bwv-pill, .nav-back {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Light mode body: blue-gray gradient with depth */
[data-theme="light"] body {
  background:
    radial-gradient(ellipse at 20% 15%, rgba(25,118,210,0.06), transparent 45%),
    radial-gradient(ellipse at 80% 75%, rgba(139,155,180,0.08), transparent 40%),
    linear-gradient(160deg, #edf1f7 0%, #e4e9f2 40%, #eaeff5 100%);
}

/* ══════════════════════════════════════════
   HEADER LOGOS
   ══════════════════════════════════════════ */
/* Icon (left) */
.bwv-icon {
  height: 28px;
  width: auto;
  display: block;
}

/* Home link wrapping the icon on sub-pages */
.bwv-home-link {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 2px;
  transition: opacity var(--ease-fast), background var(--ease-fast);
}
.bwv-home-link:hover {
  opacity: 0.8;
  background: var(--glass-4);
}
.bwv-home-link:active {
  transform: scale(0.95);
}

/* Wordmark (right) */
.bwv-logo-wordmark {
  height: 22px;
  width: auto;
  opacity: 0.7;
  transition: opacity var(--ease-default);
}
.bwv-header:hover .bwv-logo-wordmark {
  opacity: 1;
}
[data-theme="light"] .bwv-logo-wordmark {
  filter: brightness(0);
}

/* ══════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .bwv-theme-toggle:hover { transform: none; }
  .bwv-theme-toggle svg { transition: none; }
  body, .bwv-header, .bwv-card, .bwv-btn, .bwv-badge, .bwv-pill, .nav-back {
    transition: none;
  }
}

/* ══════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════ */
@media print {
  body {
    background: var(--bg);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
