/**
 * VectoSync Design System — Dark Mode & Light Mode Overrides
 * Default theme is dark. Light mode activates via [data-theme="light"] on <html>.
 * Depends on: variables.css
 */

/* ─── Theme Transition ────────────────────────────────────────────────────── */

html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ─── Light Mode Token Overrides ──────────────────────────────────────────── */

[data-theme="light"] {
  /* Backgrounds */
  --vs-bg:          #f8fafc;
  --vs-bg-card:     #ffffff;
  --vs-bg-elevated: #f1f5f9;
  --vs-bg-subtle:   #f0f4f8;

  /* Text */
  --vs-text:         #0f172a;
  --vs-text-muted:   #475569;
  --vs-text-subtle:  #94a3b8;
  --vs-text-inverse: #ffffff;

  /* Borders */
  --vs-border:        rgba(0, 0, 0, 0.08);
  --vs-border-strong: rgba(0, 0, 0, 0.15);

  /* Glass */
  --vs-glass:        rgba(255, 255, 255, 0.7);
  --vs-glass-border: rgba(0, 0, 0, 0.10);
  --vs-glass-hover:  rgba(255, 255, 255, 0.85);

  /* Shadows — lighter for light mode */
  --vs-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --vs-shadow:    0 4px 24px rgba(0, 0, 0, 0.08);
  --vs-shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.10);
}

/* ─── Light Mode Component Overrides ─────────────────────────────────────── */

/* Navigation */
[data-theme="light"] .vs-nav {
  background: rgba(248, 250, 252, 0.85);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .vs-nav.scrolled {
  background: rgba(248, 250, 252, 0.97);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .vs-nav__menu {
  background: #ffffff;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Code blocks */
[data-theme="light"] .vs-code-block {
  background: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .vs-code-block__header {
  background: rgba(0, 0, 0, 0.03);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .vs-code-block pre {
  background: #f8f9fa;
  color: #24292e;
}

[data-theme="light"] .vs-code-block__expand {
  background: linear-gradient(to bottom, transparent, rgba(248, 249, 250, 0.95));
}

/* Prose inline code */
[data-theme="light"] .vs-prose code {
  background: rgba(1, 118, 211, 0.08);
  color: #0176D3;
}

/* Skeleton loader */
[data-theme="light"] .vs-skeleton {
  background: linear-gradient(
    90deg,
    #ffffff 25%,
    #f1f5f9 50%,
    #ffffff 75%
  );
  background-size: 200% 100%;
}

/* Search overlay */
[data-theme="light"] .vs-search-overlay {
  background: rgba(248, 250, 252, 0.75);
}

/* Selection */
[data-theme="light"] ::selection {
  background: rgba(1, 118, 211, 0.15);
  color: #0f172a;
}

/* Scrollbar (Webkit) */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

/* ─── Scrollbar Theming (Global) ──────────────────────────────────────────── */

:root {
  scrollbar-width: thin;
  scrollbar-color: var(--vs-border-strong) transparent;
}

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

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

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

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

/* ─── Print Styles ────────────────────────────────────────────────────────── */

@media print {
  :root {
    --vs-bg:       #ffffff;
    --vs-bg-card:  #ffffff;
    --vs-text:     #000000;
    --vs-text-muted: #333333;
    --vs-border:   #cccccc;
  }

  .vs-nav,
  .vs-progress-bar,
  .vs-theme-toggle,
  .vs-social-share,
  .vs-toc,
  .vs-toast-container {
    display: none !important;
  }

  .vs-main {
    padding-top: 0;
  }

  .vs-article-layout {
    grid-template-columns: 1fr;
  }

  .vs-prose a::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }

  .vs-code-block {
    border: 1px solid #ccc;
    break-inside: avoid;
  }
}

/* ─── Reduced Motion ──────────────────────────────────────────────────────── */

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

  html {
    transition: none;
  }

  .vs-progress-bar {
    transition: none;
  }
}

/* ─── High Contrast Mode ──────────────────────────────────────────────────── */

@media (forced-colors: active) {
  .vs-btn,
  .vs-card,
  .vs-badge,
  .vs-tag {
    border: 1px solid ButtonText;
  }

  .vs-nav {
    border-bottom: 1px solid ButtonText;
  }
}
