/* Light / dark mode. Light is the base look; dark swaps the light surfaces.
   The hero, header, summary cards and dark bands stay dark in both modes. */
:root {
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --ink: #0a0a0a;
  --on-ink: #ffffff;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #0b0d0c;
  --surface: #151917;
  --surface-2: #0f1211;
  --ink: #f2f5f3;
  --on-ink: #0a0a0a;
  --text-on-light: #eef2ef;
  --text-muted-light: #a7b0aa;
  --text-dim: #8d9791;
  --border-light: rgba(255, 255, 255, 0.12);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
:root[data-theme="dark"] .services,
:root[data-theme="dark"] .quote-section { background: var(--surface-2); }
:root[data-theme="dark"] .p-add[disabled] { background: #2a2f2c; color: #7d8680; }
:root[data-theme="dark"] .p-badge { background: #fff; color: #0a0a0a; }
:root[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .demo-banner { background: #3b3410; border-bottom-color: #5a4d14; color: #fde68a; }
:root[data-theme="dark"] .co-error { background: #3a1616; color: #fecaca; }
:root[data-theme="dark"] .p-badge.out { background: #4a1d1d; color: #fecaca; }
:root[data-theme="dark"] .p-badge.low { background: #4a3b12; color: #fde68a; }
:root[data-theme="dark"] .btn-outline:hover { border-color: var(--green); }


/* Light mode: bands that were dark become light; hero, header, footer and summary cards stay dark. */
:root[data-theme="light"] {
  --bg-dark: #f4f6f5;
  --bg-card: #ffffff;
  --bg-elevated: #eceff0;
  --text: #0d1410;
  --text-muted: #4b5563;
  --text-dim: #6b7280;
  --border: rgba(0, 0, 0, 0.1);
}
:root[data-theme="light"] :is(.hero, .header, .shop-hero, .quote-hero, .summary-card, .nav-links, .pv-item) {
  --text: #ffffff;
  --text-muted: #a3a3a3;
  --text-dim: #8a8a8a;
  --border: rgba(255, 255, 255, 0.1);
  --bg-dark: #0a0a0a;
  --bg-card: #141414;
  --bg-elevated: #1f1f1f;
}

/* The header is dark in both modes; the logo is black on transparent, so flip it there. */
.header .logo-img { filter: invert(1) hue-rotate(180deg); }
:root[data-theme="dark"] .footer .logo-img { filter: invert(1) hue-rotate(180deg); }

/* Toggle button */
.theme-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e5e7eb; cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.theme-toggle:hover { background: rgba(34, 197, 94, 0.18); border-color: var(--green, #22c55e); color: #fff; }
.theme-toggle:focus-visible { outline: 2px solid var(--green, #22c55e); outline-offset: 2px; }
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.nav-links .theme-li { display: flex; align-items: center; }
@media (max-width: 860px) { .nav-links .theme-li { padding: 6px 0; } }
@media (prefers-reduced-motion: no-preference) {
  body, .service-card, .p-card, .cart-drawer, .shop-dialog, .quote-card, .mode-tabs { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }
}
