/* Shared theme layer: dark mode palette, theme toggle and hover polish.
   Loaded after each page's inline styles so its overrides win. */

:root {
  color-scheme: light;
  /* darker secondary text than the per-page #5c6f74 — better readability on light backgrounds */
  --slate: #44565c;
}

[data-theme="dark"] {
  color-scheme: dark;
  --deep: #e7eef0;
  --deep-2: #10262c;
  --teal: #6fa7af;
  --ink: #d4dfe1;
  --slate: #97acb0;
  --line: #21363c;
  --bg: #0c191d;
  --bg-warm: #102127;
  --bg-teal: #0e2026;
  --copper: #d98c5b;
  --copper-dk: #e39e72;
}

/* Smooth color change when switching themes (only on elements
   that have no transition of their own, to avoid clobbering them) */
body,
nav,
footer,
section,
.hero,
.page-hero,
.cta,
.exp-band,
.clouds,
.cat,
.svc,
.hero-card,
.toc,
.terms-meta,
.info,
.filter-bar {
  transition: background-color .35s ease, border-color .35s ease;
}

/* THEME TOGGLE */
.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: color .25s, border-color .25s, transform .4s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-toggle:hover {
  color: var(--copper);
  border-color: var(--copper);
  transform: rotate(40deg);
}

.theme-toggle svg {
  display: block;
}

.theme-toggle .ic-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .ic-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .ic-moon {
  display: none;
}

/* DARK SURFACES
   Sections that are dark slabs in the light theme stay dark, just a
   touch deeper than the page background, with a faint copper glow. */
[data-theme="dark"] .hero,
[data-theme="dark"] .page-hero,
[data-theme="dark"] .exp-band,
[data-theme="dark"] .cta {
  background:
    radial-gradient(ellipse 760px 400px at 82% 0%, rgba(217, 140, 91, .10), transparent 62%),
    #091518;
}

[data-theme="dark"] footer {
  background: #081014;
}

[data-theme="dark"] .nav-cta {
  background: #152c33;
}

[data-theme="dark"] .nav-cta:hover {
  background: var(--copper);
  color: #101a1e;
}

[data-theme="dark"] .btn-pri,
[data-theme="dark"] .submit {
  color: #10181b;
}

[data-theme="dark"] .hero-card {
  background: var(--bg-warm);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, .7);
}

[data-theme="dark"] .svc-card:hover {
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .6);
}

/* tools page */
[data-theme="dark"] .filter-bar {
  background: rgba(12, 25, 29, .92);
}

[data-theme="dark"] .cat-btn {
  background: var(--bg-warm);
}

[data-theme="dark"] .cat-btn.active {
  background: var(--copper);
  border-color: var(--copper);
  color: #101a1e;
}

[data-theme="dark"] .search-box input {
  background: var(--bg-warm);
  color: var(--ink);
}

[data-theme="dark"] .tech-item {
  background: var(--bg-warm);
}

/* on mobile the overlay renders inline and transparent; keep the dark
   slab only where it actually overlays the card */
@media (min-width: 881px) {
  [data-theme="dark"] .tech-item .overlay {
    background: #091518;
  }
}

[data-theme="dark"] .tech-item:hover {
  box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .65);
}

/* DARK-MODE ICON TREATMENTS
   .icon-inv  — solid dark monochrome logos: render pure white
   .icon-rev  — dark multicolor logos: flip lightness, keep hue
   .icon-chip — complex logos that can't be filtered: light chip behind */
[data-theme="dark"] img.icon-inv {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] img.icon-rev {
  filter: invert(1) hue-rotate(180deg);
}

[data-theme="dark"] img.icon-chip {
  background: #e6edee;
  border-radius: 8px;
  padding: 3px;
}

/* contact page */
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea {
  background: var(--bg-warm);
}

[data-theme="dark"] .info {
  background: #0d1f25;
  border: 1px solid var(--line);
}

[data-theme="dark"] .success .ic {
  color: #0c191d;
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }

  html {
    scroll-behavior: auto;
  }
}
