/* Dark theme + switch (Webloom) */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1022;
  --bg-soft: #151937;
  --surface: rgba(26, 30, 62, 0.8);
  --surface-strong: #1a1e3d;
  --surface-tint: rgba(34, 39, 78, 0.92);
  --text: #eef0ff;
  --muted: #aab1d8;
  --line: rgba(170, 180, 245, 0.16);
  --accent: #ff7b7b;
  --accent-strong: #ff6b9d;
  --accent-cool: #43d9d3;
  --accent-sun: #ffc95f;
  --accent-lilac: #a594ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.35);
  --dk-card: linear-gradient(180deg, rgba(31, 36, 74, 0.92), rgba(22, 26, 57, 0.9));
  --dk-chip: rgba(32, 37, 76, 0.78);
  --dk-feat: linear-gradient(135deg, rgba(255, 107, 157, 0.16), rgba(165, 148, 255, 0.14)), linear-gradient(180deg, rgba(31, 36, 74, 0.95), rgba(22, 26, 57, 0.95));
}

html[data-theme="dark"] body {
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 107, 107, 0.13), transparent 24%),
    radial-gradient(circle at 88% 14%, rgba(54, 200, 196, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(143, 124, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #0d1022 0%, #10142b 55%, #0d1022 100%);
}

html[data-theme="dark"] body::before { background: radial-gradient(circle, rgba(143, 124, 255, 0.22), transparent 70%); }
html[data-theme="dark"] body::after { background: radial-gradient(circle, rgba(255, 191, 71, 0.12), transparent 72%); }
html[data-theme="dark"] .hero::before { background: linear-gradient(135deg, rgba(255, 107, 107, 0.07), rgba(54, 200, 196, 0.05)); }

html[data-theme="dark"] :is(.hero-metrics li, .timeline-card, .panel-card, .about-card, .expertise-card, .service-card, .request-card, .pricing-card, .mini-card, .quote-card, .booking-form, .certificate-card, .cta-card, .review-card, .policy-card, .testimonial-card, .blog-card, .article-content, .service-seo-card, .service-intro-card, .service-content, .compact-cta-card, .thank-you-card, .glass, .cert-gallery-button) {
  background: var(--dk-card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] :is(.pricing-card.featured, .service-card.featured, .accent-card) {
  background: var(--dk-feat);
  border-color: rgba(255, 107, 157, 0.28);
}

html[data-theme="dark"] :is(.topbar, .portrait-badge, .eyebrow:not(.eyebrow-highlight), .contact-chip, .button-secondary, .carousel-button, .homepage-jump-nav, .direction-chips a, .menu-toggle, .pricing-label, .second-photo-image, .webloom-credit) {
  background: var(--dk-chip);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .topbar { background: rgba(18, 21, 46, 0.72); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] :is(.contact-chip:hover, .contact-chip:focus-visible, .carousel-button:hover, .carousel-button:focus-visible) { background: rgba(48, 54, 104, 0.9); }
html[data-theme="dark"] .homepage-jump-nav a { background: rgba(36, 41, 84, 0.7); color: var(--text); }
html[data-theme="dark"] .homepage-jump-nav .jump-primary { background: var(--accent); color: #fff; }

html[data-theme="dark"] .portrait-frame {
  background: radial-gradient(circle at top right, rgba(255, 191, 71, 0.18), transparent 24%), linear-gradient(160deg, #2a2144 0%, #1d2347 52%, #16314a 100%);
  border-color: var(--line);
}
html[data-theme="dark"] .credentials-media { background: radial-gradient(circle at top left, rgba(54, 200, 196, 0.16), transparent 24%), linear-gradient(145deg, #1d2347 0%, #2a2144 100%); }
html[data-theme="dark"] .cert-gallery-image { background: linear-gradient(145deg, #1d2347, #2a2144); }
html[data-theme="dark"] :is(.article-note, .article-cta) { background: rgba(40, 45, 90, 0.7); color: var(--muted); }
html[data-theme="dark"] :is(.cert-lightbox-title, .cert-lightbox-close, .cert-lightbox-nav) { background: rgba(26, 30, 62, 0.94); color: var(--text); }

html[data-theme="dark"] .booking-form :is(input, textarea, select) { background: rgba(13, 16, 34, 0.7); border-color: var(--line); color: var(--text); }
html[data-theme="dark"] .booking-form :is(input, textarea)::placeholder { color: #8a90b8; }

html[data-theme="dark"] .footer,
html[data-theme="dark"] .footer-credit { border-top-color: var(--line); }
html[data-theme="dark"] .webloom-credit { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .webloom-credit:hover,
html[data-theme="dark"] .webloom-credit:focus-visible { border-color: rgba(182, 238, 74, 0.5); box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .webloom-credit .wl-light { display: none; }
html[data-theme="dark"] .webloom-credit .wl-dark { display: block; }

/* Switch */
.theme-toggle {
  position: relative;
  order: 5;
  flex: 0 0 auto;
  width: 62px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(63, 80, 129, 0.16);
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe9b8, #ffd1a1);
  box-shadow: 0 8px 20px rgba(114, 104, 170, 0.14);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.theme-toggle .tt-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(31, 35, 64, 0.25);
  transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.2, 1), background 0.3s ease;
}
.theme-toggle svg { position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; transition: opacity 0.25s ease, transform 0.3s ease; }
.theme-toggle .tt-moon { opacity: 0; transform: rotate(-40deg) scale(0.6); }
html[data-theme="dark"] .theme-toggle { background: linear-gradient(135deg, #2b2f66, #171a3d); border-color: var(--line); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .theme-toggle .tt-thumb { transform: translateX(28px); background: #e9ebff; }
html[data-theme="dark"] .theme-toggle .tt-sun { opacity: 0; transform: rotate(40deg) scale(0.6); }
html[data-theme="dark"] .theme-toggle .tt-moon { opacity: 1; transform: none; }

@media (min-width: 981px) {
  .topbar { gap: 16px; }
  .topbar .nav { flex-wrap: nowrap; gap: 14px; }
  .topbar .nav a { white-space: nowrap; }
}

@media (max-width: 980px) {
  .theme-toggle { order: 0; margin: 6px 0 0 auto; }
  html[data-theme="dark"] .nav { background: rgba(18, 21, 46, 0.97); border-color: var(--line); }
  html[data-theme="dark"] .nav a { background: rgba(32, 37, 76, 0.8); border-color: var(--line); }
}

@media (max-width: 640px) {
  .theme-toggle { width: 54px; height: 30px; margin-top: 8px; }
  .theme-toggle .tt-thumb { width: 22px; height: 22px; }
  .theme-toggle svg { width: 14px; height: 14px; top: 4px; left: 4px; }
  html[data-theme="dark"] .theme-toggle .tt-thumb { transform: translateX(24px); }
  .topbar .brand-copy strong { white-space: normal; overflow: visible; text-overflow: clip; }
}

/* Переключатель на всех страницах */
.theme-toggle--float{position:fixed;right:14px;bottom:84px;z-index:2147483000;box-shadow:0 6px 18px rgba(11,18,32,.28);}
@media (max-width:980px){.theme-toggle{position:fixed!important;right:14px;bottom:84px;left:auto;top:auto;margin:0!important;z-index:2147483000;box-shadow:0 6px 18px rgba(11,18,32,.28);}}
