/* ═══════════════════════════════════
   QASRA — Dark Theme (app-like forest)
   Toggle: html[data-theme="dark"]
   Palette inspired by app/style.css
   ═══════════════════════════════════ */

html[data-theme="dark"] {
  color-scheme: dark;

  /* Text that was dark → light (headings, body ink) */
  --ink: #f4f0e8;

  /* Surfaces that were light → deep forest */
  --parchment: #0f1c16;
  --cream: #13241b;
  --mint: #1a3226;
  --stone: #2a4035;

  /* Secondary text */
  --ash: #9aada2;
  --charcoal: #c5d4cc;

  /* Deep base for true dark regions (heroes / footer) */
  --ink-deep: #0a1410;
  --forest-deep: #0d1b12;
}

html[data-theme="dark"] body {
  background: var(--ink-deep);
  color: #e4efe8;
}

/* ── Regions that must stay deep dark (used --ink as bg) ── */
html[data-theme="dark"] .section--dark,
html[data-theme="dark"] .page-hero,
html[data-theme="dark"] .hero,
html[data-theme="dark"] .app-hero,
html[data-theme="dark"] .app-cta,
html[data-theme="dark"] .legacy,
html[data-theme="dark"] .legacy-num,
html[data-theme="dark"] .ai-home-side,
html[data-theme="dark"] .app-home-phone,
html[data-theme="dark"] .wa-home {
  background: var(--ink-deep);
}

html[data-theme="dark"] .app-cat.active,
html[data-theme="dark"] .app-cat:hover {
  background: var(--ink-deep);
  border-color: var(--gold);
  color: var(--gold);
}

html[data-theme="dark"] .page-hero::after {
  background: linear-gradient(
    180deg,
    rgba(10, 20, 16, 0.25) 0%,
    rgba(10, 20, 16, 0.08) 30%,
    rgba(10, 20, 16, 0.75) 70%,
    rgba(10, 20, 16, 1) 100%
  );
}

/* Light text on deep regions (parchment token is now dark surface) */
html[data-theme="dark"] .section-title--light,
html[data-theme="dark"] .page-hero-content h1,
html[data-theme="dark"] .hero-title,
html[data-theme="dark"] .app-hero h1,
html[data-theme="dark"] .app-cta h2,
html[data-theme="dark"] .ai-home-side h3,
html[data-theme="dark"] .stat-inline-number--light,
html[data-theme="dark"] .legacy-card:not(.legacy-card--light) h3,
html[data-theme="dark"] .legacy-card:not(.legacy-card--light) h4,
html[data-theme="dark"] .legacy-card:not(.legacy-card--light) strong,
html[data-theme="dark"] .legacy h2,
html[data-theme="dark"] .model-card--dark h3 {
  color: #f4f0e8;
}

html[data-theme="dark"] .dropcap::first-letter,
html[data-theme="dark"] .intro-right p:first-of-type::first-letter {
  color: var(--gold);
}

/* Cards / surfaces */
html[data-theme="dark"] .card,
html[data-theme="dark"] .svc {
  background: #13241b;
  border-color: rgba(201, 168, 76, 0.12);
}

html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .svc:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .card-icon {
  background: rgba(30, 77, 53, 0.45);
}

html[data-theme="dark"] .card-icon svg {
  stroke: var(--gold);
}

html[data-theme="dark"] .card-detail {
  border-top-color: #2a4035;
}

html[data-theme="dark"] .value-item,
html[data-theme="dark"] .legacy-card--light,
html[data-theme="dark"] .quote-block--light,
html[data-theme="dark"] .focus-item {
  background: #13241b;
  border-color: rgba(201, 168, 76, 0.1);
}

html[data-theme="dark"] .faq-item {
  border-bottom-color: #2a4035;
}

html[data-theme="dark"] .gallery-item {
  background: #1a3226;
}

/* Contact / forms */
html[data-theme="dark"] .contact-icon {
  background: #13241b;
  border-color: #2a4035;
}

html[data-theme="dark"] .contact-icon svg {
  stroke: var(--gold);
}

html[data-theme="dark"] .form input,
html[data-theme="dark"] .form textarea,
html[data-theme="dark"] .form select {
  background: #13241b;
  border-color: #2a4035;
  color: #f4f0e8;
}

html[data-theme="dark"] .form input::placeholder,
html[data-theme="dark"] .form textarea::placeholder {
  color: #6b7f74;
}

html[data-theme="dark"] .form input:focus,
html[data-theme="dark"] .form textarea:focus,
html[data-theme="dark"] .form select:focus {
  border-color: var(--gold);
}

/* Legal / privacy page — links & note readable on dark forest */
html[data-theme="dark"] .legal-doc a {
  color: var(--gold-bright);
}
html[data-theme="dark"] .legal-doc a:hover {
  color: var(--gold);
}
html[data-theme="dark"] .legal-doc .legal-note {
  background: #13241b;
  color: #c5d4cc;
  border-left-color: var(--gold);
}
html[data-theme="dark"] .legal-doc code {
  background: #1a3226;
  color: #f4f0e8;
}
html[data-theme="dark"] .legal-doc h2,
html[data-theme="dark"] .legal-doc h3 {
  color: #f4f0e8;
}
html[data-theme="dark"] .legal-doc p,
html[data-theme="dark"] .legal-doc li,
html[data-theme="dark"] .legal-doc ul {
  color: #c5d4cc;
}
html[data-theme="dark"] .legal-doc .legal-meta {
  color: #9aada2;
}

/* Director / intro portrait frames */
html[data-theme="dark"] .director-photo,
html[data-theme="dark"] .intro-portrait-frame {
  background:
    linear-gradient(#0f1c16, #0f1c16) padding-box,
    linear-gradient(145deg, var(--gold-bright), var(--gold-dim) 45%, var(--gold) 100%) border-box;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.2),
    0 12px 36px rgba(0, 0, 0, 0.4);
}

/* Footer — same family as page, but clearly a new band */
html[data-theme="dark"] .footer {
  /* Deeper than page sections (#0a1410 / #0f1c16 / #13241b) so it reads as “end of page” */
  background: #0c1812;
  /* Gold hairline + soft lift so the seam is obvious */
  border-top: 1px solid rgba(201, 168, 76, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
}

html[data-theme="dark"] .footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(12rem, 40vw);
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 168, 76, 0.55),
    transparent
  );
  pointer-events: none;
}

html[data-theme="dark"] .footer-tagline {
  color: rgba(255, 255, 255, 0.62);
}

html[data-theme="dark"] .footer-links a,
html[data-theme="dark"] .footer-contact a,
html[data-theme="dark"] .footer-contact li {
  color: rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] .footer-social a {
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.8);
}

html[data-theme="dark"] .footer-bottom {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.48);
}

/* Marquee stays gold with dark text for contrast */
html[data-theme="dark"] .marquee span,
html[data-theme="dark"] .marquee-dot {
  color: #0a1410;
}

/* Gold buttons keep dark label */
html[data-theme="dark"] .btn-gold,
html[data-theme="dark"] .store-btn--gold {
  color: #0a1410;
}

/* ── Nav: scrolled = app-style dark glass ── */
html[data-theme="dark"] .nav.scrolled {
  background: rgba(10, 20, 16, 0.92) !important;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(58, 125, 92, 0.18);
}

html[data-theme="dark"] .nav.scrolled .nav-logo {
  color: var(--gold) !important;
}

html[data-theme="dark"] .nav.scrolled .nav-links a {
  color: rgba(255, 255, 255, 0.85) !important;
}

html[data-theme="dark"] .nav.scrolled .nav-links a:hover,
html[data-theme="dark"] .nav.scrolled .nav-links a.is-active {
  color: var(--gold) !important;
}

html[data-theme="dark"] .nav.scrolled .nav-cta {
  border-color: rgba(201, 168, 76, 0.45) !important;
  color: var(--gold) !important;
  background: transparent !important;
}

html[data-theme="dark"] .nav.scrolled .nav-cta:hover {
  background: var(--gold) !important;
  color: #0a1410 !important;
}

html[data-theme="dark"] .nav.scrolled .nav-toggle span {
  background: var(--gold) !important;
}

/* Stats borders etc. */
html[data-theme="dark"] .stats {
  border-color: rgba(255, 255, 255, 0.06);
}

/* ═══ Theme toggle button ═══ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 0.75rem;
  flex-shrink: 0;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.08);
  color: var(--gold);
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.25s ease;
  position: relative;
  z-index: 2;
  padding: 0;
  font: inherit;
}

.nav:not(.scrolled) .theme-toggle {
  border-color: rgba(201, 168, 76, 0.45);
  background: rgba(0, 0, 0, 0.22);
  color: var(--gold);
}

.theme-toggle:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: var(--gold);
  transform: scale(1.05);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Moon path looks better slightly filled */
.theme-toggle .icon-moon {
  fill: currentColor;
  stroke: none;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

.nav-inner {
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .theme-toggle {
    margin-left: 0.35rem;
    width: 36px;
    height: 36px;
  }

  html[data-theme="dark"] .nav {
    background: rgba(10, 20, 16, 0.92);
  }

  html[data-theme="dark"] .nav.scrolled {
    background: rgba(10, 20, 16, 0.96) !important;
  }

  html[data-theme="dark"] .nav-links.open {
    background: rgba(10, 20, 16, 0.98);
  }
}

/* Page-specific dark cards (AI etc.) — token remap covers most;
   ensure dark variants keep readable text */
html[data-theme="dark"] .model-card--dark {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .model-card--dark p {
  color: rgba(255, 255, 255, 0.65);
}

/* Smooth theme switch (optional polish) */
html {
  transition: color 0.2s ease, background-color 0.2s ease;
}
