/* Advoke CV — System Color Scheme Support (prefers-color-scheme) */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) {
    color-scheme: dark;

    --theme-bg: #0B1120;
    --theme-bg-warm: #0F172A;
    --theme-bg-soft: #131C2E;
    --theme-bg-subtle: #1A2539;
    --theme-surface: #0F172A;
    --theme-surface-raised: #1A2539;
    --theme-surface-sunken: #05090F;

    --theme-border: #29344A;
    --theme-border-strong: #3B4964;
    --theme-border-subtle: #1E293B;

    --theme-text: #F1F5F9;
    --theme-text-secondary: #CBD5E1;
    --theme-text-muted: #94A3B8;
    --theme-text-subtle: #64748B;
    --theme-text-inverse: #0B1120;

    --theme-accent: #FFC933;
    --theme-accent-hover: #FFDA6B;
    --theme-accent-active: #FFE799;
    --theme-accent-soft: rgba(255, 201, 51, 0.14);
    --theme-accent-tint: rgba(255, 201, 51, 0.06);
    --theme-accent-text: #0B1120;

    --theme-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --theme-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
    --theme-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
    --theme-shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.2);
    --theme-shadow-xl: 0 20px 32px rgba(0, 0, 0, 0.55), 0 8px 16px rgba(0, 0, 0, 0.3);
    --theme-shadow-accent: 0 8px 24px rgba(255, 201, 51, 0.35);

    --theme-header-bg: rgba(11, 17, 32, 0.85);
    --theme-header-bg-scrolled: rgba(11, 17, 32, 0.95);
    --theme-footer-bg: #0F172A;

    --theme-overlay: rgba(0, 0, 0, 0.7);
    --theme-overlay-strong: rgba(0, 0, 0, 0.85);

    --theme-input-bg: #0F172A;
    --theme-input-bg-filled: #1A2539;
    --theme-input-border: #3B4964;
    --theme-input-border-focus: #FFC933;

    --theme-select-bg: #0F172A;
    --theme-select-option-bg: #1A2539;
    --theme-select-option-text: #F1F5F9;

    --theme-code-bg: #1A2539;
    --theme-code-text: #FFDA6B;
    --theme-pre-bg: #05090F;
    --theme-pre-text: #CBD5E1;

    --theme-link: #FFDA6B;
    --theme-link-hover: #FFE799;

    --theme-selection-bg: rgba(255, 201, 51, 0.4);
    --theme-selection-text: #FFFFFF;

    --theme-scrollbar-track: transparent;
    --theme-scrollbar-thumb: #3B4964;
    --theme-scrollbar-thumb-hover: #64748B;

    --theme-skeleton-base: #1A2539;
    --theme-skeleton-highlight: #29344A;

    --color-bg: var(--theme-bg);
    --color-bg-warm: var(--theme-bg-warm);
    --color-bg-soft: var(--theme-bg-soft);
    --color-bg-subtle: var(--theme-bg-subtle);
    --color-surface: var(--theme-surface);
    --color-surface-raised: var(--theme-surface-raised);
    --color-surface-sunken: var(--theme-surface-sunken);
    --color-border: var(--theme-border);
    --color-border-strong: var(--theme-border-strong);
    --color-border-subtle: var(--theme-border-subtle);
    --color-text: var(--theme-text);
    --color-text-secondary: var(--theme-text-secondary);
    --color-text-muted: var(--theme-text-muted);
    --color-text-subtle: var(--theme-text-subtle);
    --color-text-inverse: var(--theme-text-inverse);
    --color-accent: var(--theme-accent);
    --color-accent-hover: var(--theme-accent-hover);
    --color-accent-active: var(--theme-accent-active);
    --color-accent-soft: var(--theme-accent-soft);
    --color-accent-tint: var(--theme-accent-tint);
    --color-accent-text: var(--theme-accent-text);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) body {
    background-color: var(--theme-bg);
    color: var(--theme-text);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .site-header {
    background-color: var(--theme-header-bg);
    border-bottom-color: var(--theme-border-subtle);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .site-header.is-scrolled {
    background-color: var(--theme-header-bg-scrolled);
    border-bottom-color: var(--theme-border);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .site-footer {
    background-color: var(--theme-footer-bg);
    border-top-color: var(--theme-border-subtle);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .card,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .template-card,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .feature-card,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .hub-card,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-section,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-entry {
    background-color: var(--theme-surface);
    border-color: var(--theme-border);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) input,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) textarea,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) select {
    background-color: var(--theme-input-bg);
    color: var(--theme-text);
    border-color: var(--theme-input-border);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .resume {
    background-color: #FFFFFF;
    color: #0F172A;
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-preview__canvas {
    background-color: var(--theme-bg-subtle);
    background-image:
      radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-sidebar {
    background-color: var(--theme-surface-raised);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-toolbar,
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-panel__header {
    background-color: var(--theme-surface);
    border-color: var(--theme-border-subtle);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-mobile-tabs {
    background-color: var(--theme-surface);
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) .editor-mobile-nav {
    background-color: var(--theme-surface);
    border-top-color: var(--theme-border-subtle);
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) {
    color-scheme: light;
  }
}

@media (prefers-contrast: more) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) {
    --theme-border: #000000;
    --theme-border-strong: #000000;
    --theme-text-muted: #000000;
    --theme-text-subtle: #333333;
    --focus-ring-width: 3px;
    --focus-ring-offset: 3px;
    --focus-ring-color: #000000;
  }
}

@media (prefers-contrast: less) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) {
    --theme-border-subtle: #E8EDF3;
    --theme-text-muted: #6A7280;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]):not([data-theme="high-contrast"]) {
    --theme-border: #FFFFFF;
    --theme-border-strong: #FFFFFF;
    --theme-border-subtle: #666666;
    --theme-text-muted: #E5E7EB;
    --theme-text-subtle: #D1D5DB;
    --theme-accent: #FFDA6B;
    --theme-accent-hover: #FFE799;
    --focus-ring-color: #FFFFFF;
  }
}

@media print {
  :root,
  :root:not([data-theme]),
  [data-theme="light"],
  [data-theme="dark"],
  [data-theme="high-contrast"],
  :root[data-theme] {
    color-scheme: light !important;
  }

  html,
  body {
    background-color: #FFFFFF !important;
    color: #000000 !important;
  }

  .resume {
    background-color: #FFFFFF !important;
    color: #000000 !important;
  }
}

.no-transitions * {
  transition: none !important;
  animation: none !important;
}

.theme-transition {
  transition:
    background-color var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .theme-transition {
    transition: none;
  }
}