/* ============================================
   Dark / Light theme - Marriage Invitation
   Uses data-theme on <html>: "light" | "dark"
   ============================================ */

/* Default: light theme */
:root,
[data-theme="light"] {
  --theme-bg: #f8faf9;
  --theme-bg-card: #ffffff;
  --theme-text: #1a1a1a;
  --theme-text-muted: #4a4a4a;
  --theme-border: rgba(0, 153, 107, 0.2);
  --theme-header-bg: #ffffff;
  --theme-header-border: rgba(4, 107, 56, 0.2);
  --theme-accent: #046b38;
  --theme-accent-hover: #035a2e;
  --theme-shadow: rgba(0, 0, 0, 0.08);
  --theme-sea-overlay: rgba(122, 170, 221, 0.5);
}

/* Dark theme - glassmorphism */
[data-theme="dark"] {
  --theme-bg: #0f1114;
  --theme-bg-card: rgba(28, 32, 38, 0.65);
  --theme-glass: rgba(255, 255, 255, 0.06);
  --theme-glass-border: rgba(255, 255, 255, 0.08);
  --theme-text: #e8eaed;
  --theme-text-muted: #9aa0a6;
  --theme-border: rgba(0, 179, 128, 0.35);
  --theme-header-bg: rgba(20, 24, 28, 0.75);
  --theme-header-border: rgba(255, 255, 255, 0.06);
  --theme-accent: #00b380;
  --theme-accent-hover: #00d99a;
  --theme-shadow: rgba(0, 0, 0, 0.4);
  --theme-sea-overlay: rgba(15, 20, 28, 0.6);
}

/* Apply theme to body and main areas - support both html and body attribute */
html[data-theme="dark"],
html[data-theme="dark"] body,
body[data-theme="dark"] {
  background: var(--theme-bg) !important;
  color: var(--theme-text);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6 {
  color: var(--theme-text);
}

html[data-theme="dark"] .banner-wrapper,
body[data-theme="dark"] .banner-wrapper {
  background-color: var(--theme-bg) !important;
}

/* Glassmorphism: content cards */
html[data-theme="dark"] .content-box,
body[data-theme="dark"] .content-box {
  background: var(--theme-bg-card) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--theme-glass-border);
  border-left: 4px solid var(--theme-accent);
  box-shadow: 0 8px 32px var(--theme-shadow);
}

html[data-theme="dark"] .pro,
body[data-theme="dark"] .pro {
  background: var(--theme-bg-card) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--theme-glass-border);
  box-shadow: 0 8px 32px var(--theme-shadow);
}

/* Dark theme: make Welcome graphic clearly visible */
html[data-theme="dark"] .welcome,
body[data-theme="dark"] .welcome {
  padding: 1.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] .welcome img,
body[data-theme="dark"] .welcome img {
  filter: brightness(0.95) contrast(1.15);
}

html[data-theme="dark"] .contact,
html[data-theme="dark"] .add,
body[data-theme="dark"] .contact,
body[data-theme="dark"] .add {
  background: var(--theme-bg-card) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--theme-glass-border);
  color: var(--theme-text);
}

html[data-theme="dark"] .contact a,
html[data-theme="dark"] .add a,
body[data-theme="dark"] .contact a,
body[data-theme="dark"] .add a {
  color: var(--theme-accent) !important;
}

html[data-theme="dark"] .green,
body[data-theme="dark"] .green {
  color: var(--theme-accent) !important;
}

/* Glassmorphism: header & menu */
html[data-theme="dark"] .header,
body[data-theme="dark"] .header {
  background: var(--theme-header-bg) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--theme-glass-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .menu,
body[data-theme="dark"] .menu {
  background: var(--theme-header-bg) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--theme-glass-border);
}

html[data-theme="dark"] .menu-link,
body[data-theme="dark"] .menu-link {
  color: var(--theme-text);
}

html[data-theme="dark"] .menu-link.active,
html[data-theme="dark"] .brand,
body[data-theme="dark"] .menu-link.active,
body[data-theme="dark"] .brand {
  color: var(--theme-accent) !important;
}

html[data-theme="dark"] .brand span,
body[data-theme="dark"] .brand span {
  color: #e8a0a0 !important;
}

html[data-theme="dark"] button,
html[data-theme="dark"] .event-button,
body[data-theme="dark"] button,
body[data-theme="dark"] .event-button {
  background-color: var(--theme-accent) !important;
  color: #fff;
}

html[data-theme="dark"] button:hover,
html[data-theme="dark"] .event-button:hover,
body[data-theme="dark"] button:hover,
body[data-theme="dark"] .event-button:hover {
  background-color: var(--theme-accent-hover) !important;
}

html[data-theme="dark"] .map a,
body[data-theme="dark"] .map a {
  background: linear-gradient(135deg, var(--theme-accent), var(--theme-accent-hover)) !important;
  color: #fff !important;
}

html[data-theme="dark"] .content-box h2,
html[data-theme="dark"] .content-box li,
html[data-theme="dark"] .pro p,
html[data-theme="dark"] .pro h2,
body[data-theme="dark"] .content-box h2,
body[data-theme="dark"] .content-box li,
body[data-theme="dark"] .pro p,
body[data-theme="dark"] .pro h2 {
  color: var(--theme-text);
}

html[data-theme="dark"] .content-box li::before,
body[data-theme="dark"] .content-box li::before {
  background-color: var(--theme-accent);
}

html[data-theme="dark"] .timeline::after,
body[data-theme="dark"] .timeline::after {
  background: var(--theme-text-muted);
}

html[data-theme="dark"] .timeline .row::after,
body[data-theme="dark"] .timeline .row::after {
  background-color: var(--theme-bg-card);
  border-color: var(--theme-accent);
}

html[data-theme="dark"] .card-header,
body[data-theme="dark"] .card-header {
  background: var(--theme-accent) !important;
}

/* Dark: grass ground – darker greens */
html[data-theme="dark"] .home-hero-footer.grass-ground,
body[data-theme="dark"] .home-hero-footer.grass-ground {
  background: linear-gradient(180deg, rgba(20, 35, 22, 0.5) 0%, rgba(15, 45, 20, 0.8) 35%, rgba(10, 35, 15, 0.95) 100%) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html[data-theme="dark"] .home-hero-footer .blade,
body[data-theme="dark"] .home-hero-footer .blade {
  background: linear-gradient(180deg, transparent 0%, rgba(25, 70, 30, 0.85) 20%, rgba(20, 55, 22, 0.9) 100%);
}

/* Dark: flying hearts – softer so they show on dark bg */
html[data-theme="dark"] .hearts li::before,
html[data-theme="dark"] .hearts li::after,
body[data-theme="dark"] .hearts li::before,
body[data-theme="dark"] .hearts li::after {
  background: var(--heart-color);
}
html[data-theme="dark"] .hearts li:nth-child(odd)::before,
html[data-theme="dark"] .hearts li:nth-child(odd)::after,
body[data-theme="dark"] .hearts li:nth-child(odd)::before,
body[data-theme="dark"] .hearts li:nth-child(odd)::after {
  --heart-color: rgba(255, 140, 160, 0.5);
}
html[data-theme="dark"] .hearts li:nth-child(even)::before,
html[data-theme="dark"] .hearts li:nth-child(even)::after,
body[data-theme="dark"] .hearts li:nth-child(even)::before,
body[data-theme="dark"] .hearts li:nth-child(even)::after {
  --heart-color: rgba(255, 180, 195, 0.45);
}

html[data-theme="dark"] .page-loader,
body[data-theme="dark"] .page-loader {
  background: var(--theme-bg) !important;
}

html[data-theme="dark"] .page-loader .txt,
body[data-theme="dark"] .page-loader .txt {
  color: var(--theme-text);
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--theme-bg-card);
  color: var(--theme-text);
  box-shadow: 0 4px 12px var(--theme-shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px var(--theme-shadow);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

html[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .theme-toggle {
  background: var(--theme-bg-card) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--theme-glass-border);
  color: var(--theme-accent);
}

html[data-theme="dark"] .floating-controls .audio-controls button,
body[data-theme="dark"] .floating-controls .audio-controls button {
  background: var(--theme-bg-card) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--theme-glass-border);
  color: var(--theme-accent);
}

/* Floating controls wrapper (main page: play + theme) */
.floating-controls {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.floating-controls .audio-controls {
  position: static;
  bottom: auto;
  right: auto;
}

@media (max-width: 767px) {
  .theme-toggle {
    width: 42px;
    height: 42px;
  }
  .floating-controls {
    bottom: 90px;
    right: 16px;
    gap: 10px;
  }
}
