/**
 * Light / dark source of truth. Loaded last.
 * Only html[data-aqua-theme="light"|"dark"] — no mixed leftover surfaces.
 */

html[data-aqua-theme="light"] {
  color-scheme: light;
  --as-bg: #f3f4f6;
  --as-surface: #ffffff;
  --as-surface-2: #f0f0f1;
  --as-text: #17141f;
  --as-muted: #6f687d;
  --as-line: #e0e0e2;
  --as-header: #ffffff;
  --as-footer: #11101a;
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #17141f;
  --ink-2: #3f3f46;
  --mute: #6f687d;
  --line: #e0e0e2;
  --header-surface: #ffffff;
  --footer-surface: #11101a;
  --dk-canvas: #f3f4f6;
  --dk-card: #ffffff;
  --dk-ink: #17141f;
  --dk-mute: #6f687d;
  --dk-line: #e0e0e2;
  --dk-search: #f0f0f1;
}

html[data-aqua-theme="dark"] {
  color-scheme: dark;
  --as-bg: #0b0d12;
  --as-surface: #161a22;
  --as-surface-2: #1c222b;
  --as-text: #eef2f6;
  --as-muted: #9aa3ad;
  --as-line: rgba(255, 255, 255, 0.1);
  --as-header: #12151c;
  --as-footer: #10131a;
  --bg: #0b0d12;
  --card: #161a22;
  --ink: #eef2f6;
  --ink-2: #c9d2dc;
  --mute: #9aa3ad;
  --line: rgba(255, 255, 255, 0.1);
  --header-surface: #12151c;
  --footer-surface: #10131a;
  --dk-canvas: #0b0d12;
  --dk-card: #161a22;
  --dk-ink: #eef2f6;
  --dk-mute: #9aa3ad;
  --dk-line: rgba(255, 255, 255, 0.1);
  --dk-search: #1c222b;
}

html[data-aqua-theme="light"] body,
html[data-aqua-theme="light"] body.aqua-dk,
html[data-aqua-theme="dark"] body,
html[data-aqua-theme="dark"] body.aqua-dk {
  background: var(--as-bg) !important;
  color: var(--as-text) !important;
  background-image: none !important;
}

html[data-aqua-theme="light"] body::before,
html[data-aqua-theme="dark"] body::before {
  display: none !important;
}

html[data-aqua-theme="light"] .site-header,
html[data-aqua-theme="dark"] .site-header,
html[data-aqua-theme="light"] body.aqua-dk .site-header,
html[data-aqua-theme="dark"] body.aqua-dk .site-header {
  background: var(--as-header) !important;
  border-bottom-color: var(--as-line) !important;
  color: var(--as-text) !important;
}

html[data-aqua-theme="light"] .site-footer,
html[data-aqua-theme="dark"] .site-footer {
  background: var(--as-footer) !important;
  color: #d9d3e4 !important;
  border-top-color: var(--as-line) !important;
}

html[data-aqua-theme="light"] .product-card,
html[data-aqua-theme="light"] .cat-card,
html[data-aqua-theme="light"] .feature-card,
html[data-aqua-theme="light"] .post-card,
html[data-aqua-theme="light"] .panel,
html[data-aqua-theme="light"] .hero.hero-pro,
html[data-aqua-theme="light"] .account-card,
html[data-aqua-theme="light"] .faq-item,
html[data-aqua-theme="light"] .ticket-card,
html[data-aqua-theme="light"] .auth-card,
html[data-aqua-theme="dark"] .product-card,
html[data-aqua-theme="dark"] .cat-card,
html[data-aqua-theme="dark"] .feature-card,
html[data-aqua-theme="dark"] .post-card,
html[data-aqua-theme="dark"] .panel,
html[data-aqua-theme="dark"] .hero.hero-pro,
html[data-aqua-theme="dark"] .account-card,
html[data-aqua-theme="dark"] .faq-item,
html[data-aqua-theme="dark"] .ticket-card,
html[data-aqua-theme="dark"] .auth-card {
  background: var(--as-surface) !important;
  color: var(--as-text) !important;
  border-color: var(--as-line) !important;
}

html[data-aqua-theme="light"] .header-search input,
html[data-aqua-theme="dark"] .header-search input,
html[data-aqua-theme="light"] .header-search-panel input,
html[data-aqua-theme="dark"] .header-search-panel input {
  background: var(--as-surface-2) !important;
  color: var(--as-text) !important;
  border-color: var(--as-line) !important;
}

html[data-aqua-theme="light"] .nav-main a,
html[data-aqua-theme="dark"] .nav-main a,
html[data-aqua-theme="light"] .muted,
html[data-aqua-theme="dark"] .muted,
html[data-aqua-theme="light"] .meta,
html[data-aqua-theme="dark"] .meta {
  color: var(--as-muted) !important;
}

html[data-aqua-theme="light"] h1,
html[data-aqua-theme="light"] h2,
html[data-aqua-theme="light"] h3,
html[data-aqua-theme="dark"] h1,
html[data-aqua-theme="dark"] h2,
html[data-aqua-theme="dark"] h3,
html[data-aqua-theme="light"] .brand,
html[data-aqua-theme="dark"] .brand,
html[data-aqua-theme="light"] .brand-name,
html[data-aqua-theme="dark"] .brand-name {
  color: var(--as-text) !important;
}

html[data-aqua-theme="light"] .icon-btn,
html[data-aqua-theme="dark"] .icon-btn,
html[data-aqua-theme="light"] .user-chip,
html[data-aqua-theme="dark"] .user-chip {
  background: var(--as-surface) !important;
  color: var(--as-text) !important;
  border-color: var(--as-line) !important;
}

html[data-aqua-theme="light"] .site-content,
html[data-aqua-theme="dark"] .site-content {
  background: transparent !important;
  color: var(--as-text) !important;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-aqua-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-aqua-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 480px) {
  .header-actions .theme-toggle {
    display: grid !important;
  }
}
