/* ==========================================================
     GLOBAL
  ========================================================== */

:root {
  --background: #f5f0e6;
  --text: #25231f;
  --gold: #a88954;
  --gold-dark: #876c3d;
  --gold-light: #c8ad78;
  --gold-rgb: 168, 137, 84;
  --serif: "Cormorant Garamond", Georgia, serif;
  --body-serif: "Libre Baskerville", Georgia, serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--background);
  color: var(--text);
}

body {
  font-family: var(--body-serif);
}

/* ==========================================================
     THREE.JS
  ========================================================== */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

canvas {
  display: block;
}

.setting-row[hidden] {
  display: none;
}

body.ar-active > :not(#scene) {
  visibility: hidden !important;
}

/* ==========================================================
     BACKGROUND
  ========================================================== */

.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;

  background:
    radial-gradient(
      circle at 72% 45%,
      rgba(200, 173, 120, 0.18),
      transparent 28%
    ),
    radial-gradient(
      circle at 50% 50%,
      rgba(214, 188, 133, 0.18),
      transparent 42%
    ),
    radial-gradient(
      circle at 85% 15%,
      rgba(200, 173, 120, 0.12),
      transparent 30%
    ),
    radial-gradient(
      circle at 15% 80%,
      rgba(200, 173, 120, 0.1),
      transparent 32%
    ),
    radial-gradient(
      circle at 25% 30%,
      rgba(255, 250, 238, 0.82),
      transparent 38%
    ),
    linear-gradient(120deg, #f5f0e6 0%, #f5f0e6 30%, #f3ecde 65%, #eee2c8 100%);
}

/* ==========================================================
     BRAND
  ========================================================== */

.brand {
  position: fixed;
  top: 24px;
  left: 36px;
  z-index: 20;
  display: flex;
  align-items: center;
}

.brand img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* ==========================================================
     TOP CONTROLS
  ========================================================== */

.top-controls {
  position: fixed;
  top: 27px;
  right: 29px;

  z-index: 30;

  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================
     MUSIC + LANGUAGE + SETTINGS + BELL BUTTONS
  ========================================================== */

.music-button,
.language-button,
.settings-button,
.bell-button {
  width: 54px;
  height: 54px;

  border-radius: 50%;

  border: 1px solid rgba(0, 0, 0, 0.14);

  background: rgba(255, 255, 255, 0.82);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  color: var(--gold);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: all 0.3s ease;

  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);

  flex: 0 0 54px;
}

.top-icon {
  width: 28px;
  height: 28px;
  object-fit: cover;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.story-speech-button .top-icon {
  width: 38px;
  height: 28px;
}

.music-button:hover,
.language-button:hover,
.settings-button:hover,
.bell-button:hover {
  border-color: var(--gold);
  transform: scale(1.06);
}

.music-button.active {
  box-shadow: 0 0 25px rgba(var(--gold-rgb), 0.25);
}

.language-button {
  font-size: 12px;
  width: 54px;
  letter-spacing: 0.5px;
  position: relative;
}

.settings-button {
  font-size: 19px;
}

/* ==========================================================
     BELL BUTTON
  ========================================================== */

.bell-button {
  position: relative;
}

.bell-icon {
  width: 19px;
  height: 19px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;

  transition: transform 0.25s ease;
}

.bell-button:hover .bell-icon {
  transform: scale(1.08);
}

.bell-button.ringing .bell-icon {
  animation: bellRing 0.65s ease;
}

@keyframes bellRing {
  0% {
    transform: rotate(0deg);
  }

  15% {
    transform: rotate(-14deg);
  }

  30% {
    transform: rotate(14deg);
  }

  45% {
    transform: rotate(-11deg);
  }

  60% {
    transform: rotate(9deg);
  }

  75% {
    transform: rotate(-5deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

/* ==========================================================
     PRAYER SOUND BUTTONS
  ========================================================== */

.prayer-sound-button {
  min-height: 50px;
  cursor: pointer;
}

.virtual-diya-button > span:not(.virtual-diya-icon) {
  display: none;
}

.prayer-sound-button.ringing .virtual-diya-icon {
  animation: bellRing 0.65s ease;
}

/* ==========================================================
     SETTINGS POPUP
  ========================================================== */

.settings-popup {
  position: fixed;
  top: 85px;
  right: 35px;

  width: 310px;

  padding: 18px;

  z-index: 100;

  background: rgba(255, 255, 255, 0.9);

  border: 1px solid rgba(0, 0, 0, 0.1);

  border-radius: 18px;

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.4);

  opacity: 0;
  visibility: hidden;

  transform: translateY(-14px) scale(0.97);
  will-change: opacity, transform;

  transition:
    opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.3s;
}

.settings-popup.show {
  opacity: 1;
  visibility: visible;

  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

/* ==========================================================
     SETTINGS HEADER
  ========================================================== */

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.settings-heading {
  display: flex;
  align-items: center;
  gap: 9px;

  color: var(--text);

  font-size: 16px;
  font-weight: 600;
}

.settings-heading-icon {
  width: 40px;
  height: 40px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 9px;

  background: rgba(var(--gold-rgb), 0.12);

  color: var(--gold);

  font-size: 16px;
}

.settings-close {
  width: 30px;
  height: 30px;

  border: none;

  border-radius: 8px;

  background: rgba(0, 0, 0, 0.05);

  color: #555;

  cursor: pointer;

  font-size: 15px;

  transition: all 0.2s ease;
}

.settings-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================
     SETTING ROW
  ========================================================== */

.setting-row {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 20px;

  padding: 14px;

  margin-bottom: 10px;

  border-radius: 13px;

  background: rgba(248, 246, 239, 0.8);

  border: 1px solid rgba(0, 0, 0, 0.06);
}

.setting-row:last-child {
  margin-bottom: 0;
}

.setting-info {
  flex: 1;
}

.setting-name {
  color: #333;

  font-size: 14px;

  font-weight: 600;

  margin-bottom: 4px;
}

.setting-description {
  color: rgba(30, 30, 30, 0.55);

  font-size: 11px;

  line-height: 1.45;
}

/* ==========================================================
     TOGGLE
  ========================================================== */

.toggle {
  position: relative;

  display: inline-block;

  width: 48px;
  height: 27px;

  flex-shrink: 0;

  cursor: pointer;
}

.toggle input {
  opacity: 0;

  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;

  inset: 0;

  background: #d5d2cb;

  border-radius: 50px;

  transition: 0.3s ease;
}

.toggle-slider::before {
  content: "";

  position: absolute;

  width: 21px;
  height: 21px;

  left: 3px;
  top: 3px;

  background: white;

  border-radius: 50%;

  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.15);

  transition: 0.3s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--gold);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(21px);
}

/* ==========================================================
     RESET VIEW BUTTON
  ========================================================== */

.reset-view-button {
  width: 42px;
  height: 42px;

  flex-shrink: 0;

  border: 1px solid rgba(var(--gold-rgb), 0.25);

  border-radius: 11px;

  background: rgba(var(--gold-rgb), 0.08);

  color: var(--gold);

  font-size: 19px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition: all 0.25s ease;
}

.reset-view-button:hover {
  background: rgba(var(--gold-rgb), 0.16);

  border-color: rgba(var(--gold-rgb), 0.5);
}

.reset-view-button:active {
  transform: scale(0.94);
}

/* ==========================================================
     INFORMATION
  ========================================================== */

.god-info {
  position: fixed;

  left: 7%;
  top: 48%;

  transform: translateY(-50%);

  width: 370px;

  z-index: 15;

  pointer-events: none;
}

.english-display {
  font-family: "Libre Baskerville", Georgia, serif;
}

.hindi-display {
  font-family: "Hind Devanagari", "Nirmala UI", "Mangal", sans-serif;
}

.god-title {
  color: var(--gold);

  font-size: 13px;

  letter-spacing: 2px;

  text-transform: uppercase;

  margin-bottom: 17px;
}

.god-title.hindi-display {
  letter-spacing: 0.6px;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
}

.god-name {
  font-family: "Libre Baskerville", Georgia, serif;

  font-size: clamp(34px, 2.4vw, 64px);

  font-weight: 400;

  line-height: 0.95;

  margin-bottom: 22px;

  color: var(--text);
}

.god-name.hindi-display {
  font-size: clamp(30px, 2.4vw, 52px);
  line-height: 1.05;
}

.god-description {
  max-width: 360px;

  color: rgba(30, 30, 30, 0.62);

  font-size: 14px;

  line-height: 1.8;

  margin-bottom: 27px;
  font-family: "Libre Baskerville", Georgia, serif;
}

.god-description.hindi-display {
  font-size: 16px;
  line-height: 1.7;
}

.language-fade {
  opacity: 0;
  transform: translateY(5px);
  filter: blur(2px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease;
}

/* ==========================================================
     DETAILS
  ========================================================== */

.details {
  width: 100%;
}

.detail-row {
  display: flex;

  align-items: baseline;

  padding: 11px 0;

  border-top: 1px solid rgba(0, 0, 0, 0.09);
}

.detail-label {
  width: 105px;

  flex-shrink: 0;

  color: var(--gold-dark);

  font-size: 9px;

  letter-spacing: 1.6px;

  text-transform: uppercase;
}

.detail-label.hindi-display {
  font-family: "Hind Devanagari", "Nirmala UI", "Mangal", sans-serif;
  font-size: 13px;
  letter-spacing: 0.2px;
  text-transform: none;
  line-height: 1.6;
}

.detail-value {
  color: rgba(30, 30, 30, 0.72);

  font-size: 12.5px;

  line-height: 1.5;
  letter-spacing: 0.08px;
  font-family: "Libre Baskerville", Georgia, serif;
}

.detail-value.hindi-display {
  font-family: "Hind Devanagari", "Nirmala UI", "Mangal", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 500;
  letter-spacing: 0.1px;
}

/* ==========================================================
     VIRTUAL DIYA
  ========================================================== */

.virtual-diya-container {
  position: fixed;
  right: 27px;
  bottom: 28px;
  z-index: 35;

  pointer-events: auto;

  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.virtual-diya-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
  flex: 0 0 54px;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  padding: 0;

  border: 1px solid rgba(var(--gold-rgb), 0.28);

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.86);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  color: var(--gold-dark);

  cursor: pointer;

  box-shadow:
    0 5px 16px rgba(57, 43, 20, 0.1),
    0 1px 3px rgba(255, 255, 255, 0.8) inset;

  transition:
    transform 0.2s ease,
    background 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.virtual-diya-button:hover {
  transform: scale(1.06);

  border-color: var(--gold);

  box-shadow: none;
}

.virtual-diya-button:active {
  transform: scale(0.96);
}

.virtual-diya-button:focus-visible {
  outline: 3px solid rgba(var(--gold-rgb), 0.28);
  outline-offset: 4px;
}

.virtual-diya-button:disabled {
  cursor: wait;
}

.virtual-diya-icon {
  width: 35px;
  height: 35px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.flower-offering-button .virtual-diya-icon {
  color: #b65c78;
  background: transparent;
}

.prayer-sound-button .virtual-diya-icon {
  background: transparent;
}

.story-speech-button.active {
  border-color: var(--gold);
  background: rgba(255, 250, 236, 0.98);
}

.top-controls .story-speech-button {
  width: 54px;
  height: 54px;
  min-height: 54px;
  flex-basis: 54px;
}

.story-speech-button .virtual-diya-icon {
  width: auto;
  font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 15px;
  letter-spacing: -2px;
  font-variant-emoji: text;
}

.virtual-diya-button:hover .virtual-diya-icon {
  transform: scale(1.1);
}

.virtual-diya-button.active .virtual-diya-icon {
  animation: diyaIconSpin 1s ease;
}

.story-speech-button.active .virtual-diya-icon {
  animation: none;
}

@keyframes diyaIconSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================
     GOD SELECTOR
  ========================================================== */

.god-selector {
  position: fixed;

  left: 50%;
  bottom: 25px;

  transform: translateX(-50%);

  z-index: 25;

  display: flex;

  align-items: flex-end;

  justify-content: center;

  gap: 12px;

  width: auto;

  max-width: 90vw;

  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -webkit-overflow-scrolling: touch;
}

.god-selector::-webkit-scrollbar {
  height: 6px;
  background: transparent;
}

.god-selector::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.god-selector::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

/* ==========================================================
     GOD CARD
  ========================================================== */

.god-card {
  position: relative;

  width: 92px;
  height: 104px;

  overflow: hidden;

  cursor: pointer;

  border: 1px solid rgba(0, 0, 0, 0.12);

  background: #e9e7e1;

  transition:
    width 0.4s ease,
    height 0.4s ease,
    transform 0.4s ease,
    border-color 0.4s ease;

  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.god-card:hover {
  transform: translateY(-5px);
}

.god-card:focus-visible {
  outline: 2px solid var(--gold);
}

.god-card.active {
  width: 112px;
  height: 125px;

  border-color: rgba(var(--gold-rgb), 0.85);

  transform: translateY(-7px);

  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(var(--gold-rgb), 0.1);
}

.god-card img {
  width: 100%;
  height: 100%;

  object-fit: cover;

  display: block;

  transition: transform 0.5s ease;
}

.god-card:hover img {
  transform: scale(1.05);
}

.god-card::after {
  content: "";

  position: absolute;

  inset: 0;

  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8),
    rgba(0, 0, 0, 0.02) 65%
  );
}

.card-name {
  position: absolute;

  left: 50%;
  bottom: 8px;

  transform: translateX(-50%);

  z-index: 3;

  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  line-height: 1.1;
  letter-spacing: 0.3px;
  color: #f0c76d;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(72, 39, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease;
}

.god-card:hover .card-name {
  color: #f0c76d;
  text-shadow:
    0 1px 0 rgba(72, 39, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.god-card.active .card-name {
  color: #f6d98a;
  text-shadow:
    0 1px 0 rgba(72, 39, 0, 0.9),
    0 2px 8px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(240, 199, 109, 0.25);
}

/* ==========================================================
     TRANSITION
  ========================================================== */

.transition {
  position: fixed;

  inset: 0;

  background: var(--background);

  z-index: 50;

  pointer-events: none;

  opacity: 0;

  transition: opacity 0.35s ease;
}

.transition.show {
  opacity: 0.55;
}

/* ==========================================================
     MODEL LOADER
  ========================================================== */

.model-loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.model-loader.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.model-loader-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
}

.model-loader-spinner {
  position: relative;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(var(--gold-rgb), 0.18);
  border-top-color: var(--gold);
  border-right-color: #d9ad59;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(var(--gold-rgb), 0.16);
  animation: loaderSpin 1.2s linear infinite;
}

.model-loader-spinner::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(var(--gold-rgb), 0.18);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.model-loader-spinner::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  background: url("../assets/icons/diya.webp") center / contain no-repeat;
  transform: translate(-50%, -50%) rotate(0deg);
  filter: drop-shadow(0 0 5px rgba(var(--gold-rgb), 0.42));
  animation: loaderIconCounterSpin 1.2s linear infinite;
}

@keyframes loaderSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loaderIconCounterSpin {
  to {
    transform: translate(-50%, -50%) rotate(-360deg);
  }
}

/* ==========================================================
     FLOWER OFFERING
  ========================================================== */

.flower-offering-button {
  border-color: rgba(196, 92, 119, 0.35);

  color: #a84d68;
}

.flower-offering-button:hover {
  transform: scale(1.06);

  border-color: #c45c77;

  box-shadow: none;
}

.flower-offering-button.active .virtual-diya-icon {
  animation: flowerIconFloat 0.9s ease;
}

.flower-offering-button:disabled {
  cursor: wait;

  opacity: 0.68;
}

@keyframes flowerIconFloat {
  0% {
    transform: scale(1) rotate(0deg);
  }

  45% {
    transform: scale(1.18) rotate(-12deg);
  }

  100% {
    transform: scale(1) rotate(0deg);
  }
}
