
/* ============================================================
   THEME SYSTEM — 3 Themes
   Theme 1: Dark Gold (default)
   Theme 2: Navy & Gold
   Theme 3: Light Modern
   Applied via html[data-theme="1|2|3"]
   ============================================================ */

/* ── Theme 1: Dark Gold ── (same as :root defaults, ensures explicit override) */
html[data-theme="1"] {
  --bg-primary:    #080808;
  --bg-secondary:  #0d0d0d;
  --bg-card:       rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --gold:          #C9A84C;
  --gold-light:    #E8C97D;
  --gold-dark:     #8B6914;
  --gold-glow:     rgba(201, 168, 76, 0.25);
  --white:         #FFFFFF;
  --white-80:      rgba(255,255,255,0.8);
  --white-60:      rgba(255,255,255,0.6);
  --white-30:      rgba(255,255,255,0.3);
  --white-10:      rgba(255,255,255,0.1);
  --white-05:      rgba(255,255,255,0.05);
  --border:        rgba(255,255,255,0.08);
  --border-gold:   rgba(201,168,76,0.25);
  --shadow-gold:   0 20px 60px rgba(201, 168, 76, 0.15);
  --shadow-card:   0 8px 40px rgba(0, 0, 0, 0.4);
}

/* ── Theme 2: Navy & Gold ── */
html[data-theme="2"] {
  --bg-primary:    #05101F;
  --bg-secondary:  #091828;
  --bg-card:       rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --gold:          #D4AF37;
  --gold-light:    #F0D060;
  --gold-dark:     #9A7B1A;
  --gold-glow:     rgba(212, 175, 55, 0.28);
  --white:         #FFFFFF;
  --white-80:      rgba(255,255,255,0.85);
  --white-60:      rgba(255,255,255,0.6);
  --white-30:      rgba(255,255,255,0.3);
  --white-10:      rgba(255,255,255,0.1);
  --white-05:      rgba(255,255,255,0.05);
  --border:        rgba(80, 140, 220, 0.12);
  --border-gold:   rgba(212, 175, 55, 0.3);
  --shadow-gold:   0 20px 60px rgba(212, 175, 55, 0.2);
  --shadow-card:   0 8px 40px rgba(0, 0, 30, 0.55);
}

html[data-theme="2"] #navbar.scrolled {
  background: rgba(5, 16, 31, 0.97) !important;
}
html[data-theme="2"] .dropdown {
  background: rgba(9, 24, 40, 0.99) !important;
}
html[data-theme="2"] .mobile-menu {
  background: rgba(5, 16, 31, 0.99) !important;
}
html[data-theme="2"] .hero-bg {
  background-color: rgba(5, 16, 31, 0.88) !important;
  background-blend-mode: overlay !important;
}
html[data-theme="2"] .orb-1 {
  background: radial-gradient(circle, rgba(212,175,55,0.07) 0%, transparent 70%) !important;
}
html[data-theme="2"] .orb-2 {
  background: radial-gradient(circle, rgba(10,60,140,0.15) 0%, transparent 70%) !important;
}
html[data-theme="2"] .orb-3 {
  background: radial-gradient(circle, rgba(212,175,55,0.04) 0%, transparent 70%) !important;
}
html[data-theme="2"] #mouse-glow {
  background: radial-gradient(circle, rgba(212,175,55,0.05) 0%, transparent 70%) !important;
}
html[data-theme="2"] #page-loader {
  background: #05101F !important;
}
html[data-theme="2"] ::-webkit-scrollbar-track { background: #05101F; }
html[data-theme="2"] ::-webkit-scrollbar-thumb { background: #9A7B1A; }
html[data-theme="2"] ::-webkit-scrollbar-thumb:hover { background: #D4AF37; }

/* ── Theme 3: Light Modern ── */
html[data-theme="3"] {
  --bg-primary:    #F4F0E8;
  --bg-secondary:  #FFFFFF;
  --bg-card:       rgba(26, 40, 70, 0.05);
  --bg-card-hover: rgba(26, 40, 70, 0.09);
  --gold:          #A0720A;
  --gold-light:    #C49020;
  --gold-dark:     #6B4C00;
  --gold-glow:     rgba(160, 114, 10, 0.22);
  --white:         #1A2846;
  --white-80:      rgba(26, 40, 70, 0.85);
  --white-60:      rgba(26, 40, 70, 0.6);
  --white-30:      rgba(26, 40, 70, 0.3);
  --white-10:      rgba(26, 40, 70, 0.1);
  --white-05:      rgba(26, 40, 70, 0.05);
  --border:        rgba(26, 40, 70, 0.12);
  --border-gold:   rgba(160, 114, 10, 0.3);
  --shadow-gold:   0 20px 60px rgba(160, 114, 10, 0.18);
  --shadow-card:   0 8px 40px rgba(0, 0, 0, 0.1);
}

html[data-theme="3"] body {
  background: var(--bg-primary);
  color: var(--white);
}
html[data-theme="3"] #navbar.scrolled {
  background: rgba(244, 240, 232, 0.97) !important;
  box-shadow: 0 1px 0 rgba(26,40,70,0.1) !important;
}
html[data-theme="3"] .dropdown {
  background: rgba(255, 255, 255, 0.99) !important;
  border-color: rgba(26,40,70,0.12) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12) !important;
}
html[data-theme="3"] .dropdown li a {
  color: var(--white-80) !important;
}
html[data-theme="3"] .dropdown li a:hover {
  background: rgba(160,114,10,0.07) !important;
}
html[data-theme="3"] .mobile-menu {
  background: rgba(244, 240, 232, 0.99) !important;
  border-left-color: rgba(26,40,70,0.15) !important;
}
html[data-theme="3"] .mobile-close-btn {
  background: rgba(26,40,70,0.1) !important;
  border-color: rgba(26,40,70,0.2) !important;
  color: var(--white) !important;
}
html[data-theme="3"] .hero-bg {
  background-color: rgba(244, 240, 232, 0.84) !important;
  background-blend-mode: multiply !important;
}
/* Text contrast overlay for theme 3 */
html[data-theme="3"] .hero-gradient {
  background: linear-gradient(
    to right,
    rgba(244, 240, 232, 0.55) 0%,
    rgba(244, 240, 232, 0.25) 60%,
    transparent 100%
  ) !important;
}
html[data-theme="3"] .hero-grid {
  background-image:
    linear-gradient(rgba(26,40,70,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,40,70,0.03) 1px, transparent 1px) !important;
}
/* Ensure all hero text is dark and readable */
html[data-theme="3"] .hero-subtitle,
html[data-theme="3"] .hero-copy-stack,
html[data-theme="3"] .hero-stat-label,
html[data-theme="3"] .hero-stat-num {
  color: var(--white-80) !important;
}
html[data-theme="3"] .hero-badge {
  background: rgba(160,114,10,0.12) !important;
  border-color: rgba(160,114,10,0.35) !important;
}
html[data-theme="3"] .orb-1 {
  background: radial-gradient(circle, rgba(160,114,10,0.06) 0%, transparent 70%) !important;
  opacity: 0.6;
}
html[data-theme="3"] .orb-2 {
  background: radial-gradient(circle, rgba(26,40,100,0.06) 0%, transparent 70%) !important;
  opacity: 0.5;
}
html[data-theme="3"] .orb-3 {
  background: radial-gradient(circle, rgba(160,114,10,0.04) 0%, transparent 70%) !important;
  opacity: 0.4;
}
html[data-theme="3"] #mouse-glow {
  background: radial-gradient(circle, rgba(160,114,10,0.04) 0%, transparent 70%) !important;
}
html[data-theme="3"] #page-loader {
  background: #F4F0E8 !important;
}
html[data-theme="3"] .section-title { color: var(--white); }
/* btn-primary: use dark navy bg in theme 3 — gold is too light for readable text */
html[data-theme="3"] .btn-primary,
html[data-theme="3"] .nav-cta-btn {
  background: linear-gradient(135deg, #1A2846, #2A4070) !important;
  color: #FFFFFF !important;
}
html[data-theme="3"] .btn-primary::before {
  background: linear-gradient(135deg, #2A4070, #3A559A) !important;
}
html[data-theme="3"] .btn-primary:hover {
  box-shadow: 0 15px 40px rgba(26, 40, 70, 0.35) !important;
}
html[data-theme="3"] .nav-cta-btn:hover {
  box-shadow: 0 8px 25px rgba(26, 40, 70, 0.3) !important;
}
html[data-theme="3"] .btn-outline {
  color: var(--white) !important;
  border-color: var(--white-30) !important;
}
html[data-theme="3"] .btn-outline:hover {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
}
html[data-theme="3"] ::-webkit-scrollbar-track { background: #F4F0E8; }
html[data-theme="3"] ::-webkit-scrollbar-thumb { background: #6B4C00; }
html[data-theme="3"] ::-webkit-scrollbar-thumb:hover { background: #A0720A; }
/* Fix hardcoded white text in premium.css */
html[data-theme="3"] .hero-copy-stack p {
  color: rgba(26, 40, 70, 0.65) !important;
}
html[data-theme="3"] .hero-copy-stack p:hover {
  color: rgba(26, 40, 70, 0.85) !important;
}
/* Footer */
html[data-theme="3"] .site-footer {
  background: #EDE8DC !important;
  border-top-color: rgba(26,40,70,0.15) !important;
}
html[data-theme="3"] .footer-bottom {
  border-top-color: rgba(26,40,70,0.12) !important;
}
html[data-theme="3"] .footer-bottom p {
  color: var(--white-60) !important;
}
/* Footer for theme 2 */
html[data-theme="2"] .site-footer {
  background: #03080F !important;
}

/* ============================================================
   THEME SWITCHER WIDGET
   ============================================================ */
.theme-switcher {
  position: relative;
}

.theme-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  background: var(--white-05);
  border: 1px solid var(--border);
  color: var(--white-60);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.85rem;
}
.theme-toggle-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-glow);
}

.theme-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.3s ease;
  z-index: 2000;
  backdrop-filter: blur(20px);
}
html[data-theme="3"] .theme-panel {
  background: rgba(255,255,255,0.98) !important;
  border-color: rgba(26,40,70,0.12) !important;
}

.theme-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--white-60);
  margin-bottom: 12px;
  text-align: center;
}

.theme-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: var(--white-05);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.theme-option-btn:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
}
.theme-option-btn.active {
  border-color: var(--gold);
  background: var(--gold-glow);
}

.theme-swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.theme-swatch span {
  display: block;
}

/* Swatch colors per theme */
.swatch-1 span:nth-child(1) { background: #080808; }
.swatch-1 span:nth-child(2) { background: #C9A84C; }
.swatch-1 span:nth-child(3) { background: #1a1a1a; }
.swatch-1 span:nth-child(4) { background: #E8C97D; }

.swatch-2 span:nth-child(1) { background: #05101F; }
.swatch-2 span:nth-child(2) { background: #D4AF37; }
.swatch-2 span:nth-child(3) { background: #091828; }
.swatch-2 span:nth-child(4) { background: #F0D060; }

.swatch-3 span:nth-child(1) { background: #F4F0E8; }
.swatch-3 span:nth-child(2) { background: #A0720A; }
.swatch-3 span:nth-child(3) { background: #FFFFFF; }
.swatch-3 span:nth-child(4) { background: #1A2846; }

.theme-option-info {
  text-align: left;
}
.theme-option-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--white-80);
  display: block;
}
.theme-option-desc {
  font-size: 0.7rem;
  color: var(--white-60);
  display: block;
  margin-top: 2px;
}
html.rtl .theme-panel { right: auto; left: 0; }
html.rtl .theme-option-info { text-align: right; }

/* ============================================================
   MOBILE PERFORMANCE & POLISH
   ============================================================ */

/* Skeleton loader for images — shows while loading */
img {
  background: var(--bg-card);
}

/* Smooth image reveal on load */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.4s ease;
}
img[loading="lazy"].loaded {
  opacity: 1;
}

/* Prevent layout shift — images fill container before load */
.legacy-gallery-item,
.home-gallery-item,
.project-item,
.about-img-frame {
  background: var(--bg-card);
}

/* ── Mobile panel positioning ── */
@media (max-width: 768px) {
  .theme-panel {
    position: fixed;
    top: 70px;
    right: 12px;
    left: auto;
    width: calc(100vw - 24px);
    max-width: 280px;
  }

  /* Show lang toggle inside mobile menu only */
  .nav-actions .lang-toggle {
    display: none;
  }

  /* Better touch targets for theme buttons */
  .theme-option-btn {
    padding: 12px 14px;
  }

  /* Hero text always readable on mobile */
  .hero-subtitle {
    font-size: 0.95rem !important;
    line-height: 1.7 !important;
  }

  /* Mobile gallery images — ensure full coverage */
  .legacy-gallery-item img,
  .home-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Page hero smaller on mobile */
  .page-hero {
    padding: 120px 0 50px !important;
  }
}

@media (max-width: 480px) {
  .theme-panel {
    max-width: 260px;
  }

  /* More compact legacy card on small screens */
  .legacy-card {
    padding: 18px !important;
  }

  /* Stack gallery 1 col on smallest screens */
  .legacy-gallery-grid {
    grid-template-columns: 1fr !important;
  }
}
