/* ==========================================================================
   Upala Spiritual Luxury Design System & Theme Stylesheet
   Pure Zero-Build CSS3 with Tailwind-compatible Utilities & Responsive Tokens
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-display: 'Outfit', 'Playfair Display', sans-serif;

  /* Spiritual Luxury Gold Palette */
  --color-gold-primary: #d4af37;
  --color-gold-light: #fbeea4;
  --color-gold-bright: #ffd700;
  --color-gold-amber: #f59e0b;
  --color-gold-dark: #997a15;
  --color-crimson: #8b0000;
  --color-crimson-light: #c0392b;

  /* Dark Theme Tokens (Default) */
  --bg-primary: #0a0c12;
  --bg-surface: rgba(16, 20, 30, 0.75);
  --bg-glass: rgba(10, 12, 18, 0.65);
  --bg-glass-strong: rgba(10, 12, 18, 0.88);
  --text-primary: #fbf8ee;
  --text-secondary: #dcd1bd;
  --text-muted: #9e9382;
  --border-gold: rgba(212, 175, 55, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --glow-gold: 0 0 25px rgba(212, 175, 55, 0.22);
}

html.light {
  --bg-primary: #f7f4ea;
  --bg-surface: rgba(255, 255, 255, 0.82);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-glass-strong: rgba(255, 255, 255, 0.92);
  --text-primary: #1a160d;
  --text-secondary: #3b3221;
  --text-muted: #6b5e46;
  --border-gold: rgba(180, 140, 30, 0.35);
  --border-subtle: rgba(0, 0, 0, 0.1);
  --glow-gold: 0 0 25px rgba(180, 140, 30, 0.15);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(circle at 50% 20%, rgba(212, 175, 55, 0.08) 0%, transparent 60%),
                    radial-gradient(circle at 80% 80%, rgba(139, 0, 0, 0.06) 0%, transparent 50%),
                    url("/img/under_construction_bg.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  position: relative;
  overflow-x: hidden;
}

/* Background Overlay */
.bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 18, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  z-index: 0;
}

html.light .bg-overlay {
  background: rgba(247, 244, 234, 0.7);
}

/* Typography Utility */
h1, h2, h3, .font-serif {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

.gradient-text-gold {
  background: linear-gradient(135deg, #fff3c4 0%, #fbeea4 30%, #d4af37 70%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light .gradient-text-gold {
  background: linear-gradient(135deg, #7c5c00 0%, #b8860b 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Navigation Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.3s ease;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #b8860b, #d4af37, #ffd700);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a160d;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(to right, #fff4cc, #d4af37);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light .brand-title {
  background: linear-gradient(to right, #805b00, #b8860b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Nav Links */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--color-gold-bright);
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Language Switcher Buttons */
.lang-switcher {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  padding: 0.25rem;
  gap: 0.15rem;
}

html.light .lang-switcher {
  background: rgba(255, 255, 255, 0.5);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: linear-gradient(135deg, #d4af37, #f59e0b);
  color: #0d0f17;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.35);
}

/* Theme Toggle Button */
.btn-icon-toggle {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-icon-toggle:hover {
  background: rgba(212, 175, 55, 0.15);
  transform: translateY(-1px);
}

/* Hamburger Menu Button */
.btn-hamburger {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Mobile Menu Panel */
.mobile-menu-panel {
  display: none;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem;
  transition: all 0.3s ease;
}

.mobile-menu-panel a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: background 0.2s ease;
}

.mobile-menu-panel a:hover {
  background: rgba(212, 175, 55, 0.15);
}

/* ==========================================================================
   Main Hero Section
   ========================================================================== */
.main-wrapper {
  flex: 1;
  position: relative;
  z-index: 10;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3.5rem;
}

@media (min-width: 768px) {
  .main-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2.5rem;
  }
}

/* Glassmorphism Card */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-gold);
  border-radius: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), var(--glow-gold);
  transition: all 0.3s ease;
}

.hero-main-card {
  width: 100%;
  padding: 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .hero-main-card {
    padding: 3.5rem;
  }
}

@media (min-width: 768px) {
  .hero-main-card {
    flex: 1 1 55%;
    max-width: calc(60% - 1.25rem);
    min-height: 24rem;
    justify-content: center;
  }
}

.spiritual-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.12);
  color: var(--color-gold-bright);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 700;
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 2.75rem;
  }
}

.hero-subtitle {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 36rem;
}

/* 3D Canvas Visual Container */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 22rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .canvas-wrapper {
    flex: 1 1 35%;
    max-width: calc(40% - 1.25rem);
    height: 24rem;
  }
}

#canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  border-radius: 1.5rem;
  overflow: hidden;
}

#three-bg-canvas, #mock-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

/* Carousel Overlay on Canvas */
.carousel-overlay {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  pointer-events: none;
}

.carousel-book-info {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  text-align: center;
  pointer-events: auto;
}

.carousel-book-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-gold-light);
  margin-bottom: 0.25rem;
}

.carousel-book-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  pointer-events: auto;
}

.carousel-btn {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-gold);
  color: var(--color-gold-bright);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.carousel-btn:hover {
  background: var(--color-gold-primary);
  color: #0d0f17;
  transform: scale(1.08);
}

/* Carousel Dots */
.carousel-dots {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  pointer-events: auto;
}

.carousel-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: all 0.3s ease;
}

.carousel-dot.active {
  width: 1.5rem;
  border-radius: 9999px;
  background: var(--color-gold-primary);
  box-shadow: 0 0 8px var(--color-gold-primary);
}

/* Fallback Containers */
#webgl-fallback, #canvas-error, #canvas-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(139, 0, 0, 0.85);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  z-index: 10;
  text-align: center;
}

#canvas-loading {
  background: rgba(212, 175, 55, 0.85);
  color: #0d0f17;
  font-weight: 600;
}

/* ==========================================================================
   Full Width Section Wrappers
   ========================================================================== */
.full-section {
  width: 100%;
  flex: 1 1 100%;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 32rem;
  margin: 0 auto;
}

/* ==========================================================================
   Books Showcase Section
   ========================================================================== */
.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  width: 100%;
}

@media (min-width: 640px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.book-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(212, 175, 55, 0.25);
  border-color: rgba(212, 175, 55, 0.5);
}

.book-cover-container {
  width: 100%;
  height: 16rem;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-gold);
}

.book-cover-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.book-card:hover .book-cover-container img {
  transform: scale(1.05);
}

.book-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-gold-light);
}

.book-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Channels Section
   ========================================================================== */
.channel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .channel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .channel-grid-span-2-md {
    grid-column: span 2 / span 2;
  }
}

@media (min-width: 1024px) {
  .channel-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .channel-grid-span-2-lg {
    grid-column: span 2 / span 2;
  }
}

.channel-card-link {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.channel-card-link:hover {
  transform: translateY(-4px);
  border-color: var(--color-gold-bright);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.25);
}

.channel-icon-box {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(139, 0, 0, 0.2));
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.channel-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.channel-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-gold-light);
}

.channel-url {
  font-size: 0.825rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Action & Copy Bar
   ========================================================================== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #d4af37, #f59e0b);
  color: #0d0f17;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  color: var(--color-gold-bright);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border-gold);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(212, 175, 55, 0.15);
  transform: translateY(-2px);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 2rem 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  position: relative;
  z-index: 10;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Test Compatibility & Hidden Tech Attributes
   ========================================================================== */
.test-compat-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
}

/* Utility Animations */
.transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

.backdrop-blur {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.backdrop-blur-md {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.backdrop-blur-lg {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Responsive Media Queries */
@media (max-width: 767px) {
  .desktop-nav {
    display: none !important;
  }
  .btn-hamburger {
    display: flex !important;
  }
}

@media (min-width: 768px) {
  .btn-hamburger {
    display: none !important;
  }
  .mobile-menu-panel {
    display: none !important;
  }
}
