/* Cowdlly lamp → genie: opening lamp pin + floating section guide */

.genie-stage {
  position: fixed;
  z-index: 40;
  top: auto;
  bottom: calc(88px + 54px + 10px + env(safe-area-inset-bottom, 0px));
  inset-inline-start: auto;
  inset-inline-end: max(8px, env(safe-area-inset-inline-end, 0px));
  width: min(300px, 34vw);
  height: auto;
  margin: 0;
  padding: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
  filter: drop-shadow(0 12px 28px rgba(88, 28, 180, 0.28));
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 12px, 0);
  transition:
    opacity 520ms ease,
    visibility 520ms ease,
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.genie-stage.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  animation: genie-float-idle 4.8s ease-in-out infinite;
}

.genie-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(48vh, 400px);
  transform-origin: center bottom;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.35));
}

@keyframes genie-float-idle {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -10px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .genie-stage.is-visible {
    animation: none;
  }
}

.genie-bubble {
  position: relative;
  width: min(260px, 82vw);
  max-width: 100%;
  margin-inline-end: 8px;
  padding: 12px 14px 14px;
  border-radius: 16px 16px 6px 16px;
  border: 1px solid rgba(168, 85, 247, 0.4);
  background: linear-gradient(165deg, rgba(28, 12, 52, 0.94), rgba(12, 6, 28, 0.92));
  color: #f3e8ff;
  box-shadow:
    0 10px 28px rgba(76, 29, 149, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 1;
  transform: none;
  transition: opacity 200ms ease;
  pointer-events: none;
}

html[dir="ltr"] .genie-bubble {
  border-radius: 16px 16px 16px 6px;
  margin-inline-end: 0;
  margin-inline-start: 8px;
}

.genie-bubble.is-pop,
.genie-bubble:not([hidden]) {
  opacity: 1;
  transform: none;
}

.genie-bubble[hidden] {
  display: none !important;
}

.genie-bubble-label {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.22);
  color: #e9d5ff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.genie-bubble-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  font-weight: 500;
  color: #f5f3ff;
}

.genie-bubble::after {
  content: "";
  position: absolute;
  bottom: -7px;
  inset-inline-end: 28px;
  width: 14px;
  height: 14px;
  background: rgba(18, 8, 36, 0.95);
  border-inline-end: 1px solid rgba(168, 85, 247, 0.45);
  border-bottom: 1px solid rgba(168, 85, 247, 0.45);
  transform: rotate(45deg);
}

.genie-scroll-hint {
  position: fixed;
  z-index: 41;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(138, 43, 226, 0.35);
  background: rgba(10, 6, 24, 0.78);
  color: #d9c9ff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 1;
  transition: opacity 280ms ease;
  animation: lamp-hint-pulse 2.4s ease-in-out infinite;
}

.genie-scroll-hint.is-hidden {
  opacity: 0;
  visibility: hidden;
  animation: none;
}

@keyframes lamp-hint-pulse {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

/* —— Lamp opening hero —— */
.lamp-hero {
  margin-top: 0;
  padding: 0;
}

.lamp-pin {
  position: relative;
}

.lamp-viewport {
  position: relative;
  height: 100vh;
  height: 100dvh;
}

.lamp-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  padding:
    calc(72px + env(safe-area-inset-top, 0px))
    clamp(16px, 4vw, 40px)
    clamp(48px, 7vh, 72px);
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 78%, rgba(124, 58, 237, 0.28), transparent 62%),
    radial-gradient(ellipse 50% 40% at 50% 20%, rgba(88, 28, 180, 0.18), transparent 55%),
    linear-gradient(180deg, #070412 0%, #12082a 48%, #0a0618 100%);
}

#lampCanvas {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(72px, calc(54px + env(safe-area-inset-bottom, 0px)));
  transform: translateX(-50%);
  display: block;
  width: min(640px, 86vw);
  height: auto !important;
  max-height: min(42vh, 360px);
  margin: 0;
  filter: drop-shadow(0 24px 48px rgba(88, 28, 180, 0.55));
  object-fit: contain;
  pointer-events: none;
}

.lamp-copy {
  position: relative;
  z-index: 3;
  width: min(680px, 92vw);
  margin: 0 auto;
  text-align: center;
  pointer-events: none;
  align-self: start;
}

.lamp-brand {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #f5f3ff;
  text-shadow: 0 0 40px rgba(168, 85, 247, 0.45);
}

.lamp-copy h1 {
  margin: 0 0 6px;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.35;
  color: #e9d5ff;
  max-width: none;
  text-shadow: none;
  animation: none;
}

.lamp-line {
  margin: 0 auto 12px;
  max-width: 40ch;
  color: #c4b5fd;
  font-size: 0.92rem;
  line-height: 1.55;
}

body.story-mode .lamp-brand {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
}

.lamp-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1.5px),
    radial-gradient(circle at 55% 60%, rgba(216, 180, 254, 0.05) 0 1px, transparent 1.5px);
  background-size: 120px 120px, 160px 160px, 90px 90px;
  opacity: 0.7;
  pointer-events: none;
}

body.story-mode .lamp-stage {
  background:
    radial-gradient(ellipse 80% 60% at 50% 72%, rgba(124, 58, 237, 0.34), transparent 64%),
    radial-gradient(ellipse 45% 35% at 50% 18%, rgba(103, 232, 249, 0.08), transparent 50%),
    linear-gradient(180deg, #05030c 0%, #12082a 52%, #080414 100%);
}

.lamp-copy .lamp-actions {
  pointer-events: auto;
  justify-content: center;
}

.lamp-actions {
  margin-top: 0;
  opacity: 0.92;
  transition: opacity 320ms ease;
}

body.lamp-open .lamp-actions {
  opacity: 1;
}

body.lamp-emerged .lamp-copy h1,
body.lamp-emerged .lamp-line {
  opacity: 0.88;
}

.lamp-after {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 48px) clamp(16px, 4vw, 32px) 12px;
}

.lamp-after .hero-description {
  margin-top: 12px;
}

body.has-genie-bg .site-header {
  position: relative;
  z-index: 80;
}

body.has-genie-bg .scroll-progress {
  z-index: 200;
}

body.has-genie-bg .page-loader {
  z-index: 9999;
}

body.has-genie-bg .bg-shapes {
  z-index: 1;
  opacity: 0.2;
}

body.has-genie-bg main,
body.has-genie-bg .site-footer {
  position: relative;
  z-index: 10;
}

body.has-genie-bg .chatbot-wrap,
body.has-genie-bg .whatsapp-float,
body.has-genie-bg .back-to-top {
  z-index: 90;
}

body.has-genie-bg .cookie-banner {
  z-index: 95;
}

body.has-genie-bg:not(.genie-reduced) .about-visual {
  display: none;
}

body.has-genie-bg:not(.genie-reduced) .about-shell {
  grid-template-columns: 1fr;
}

@media (min-width: 1200px) {
  .genie-stage {
    width: min(420px, 34vw);
    inset-inline-end: max(12px, env(safe-area-inset-inline-end, 0px));
  }

  .genie-bubble {
    width: min(300px, 100%);
  }

  #lampCanvas {
    width: min(620px, 52vw);
  }
}

@media (max-width: 900px) {
  /* Floating tour genie hides on phones — see responsive-fix.css */
  .genie-stage {
    width: min(160px, 28vw);
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    inset-inline-end: max(8px, env(safe-area-inset-inline-end, 0px));
  }

  .genie-stage canvas {
    max-height: 140px;
  }

  .genie-bubble {
    width: min(200px, 70vw);
    padding: 10px 12px 12px;
  }

  .genie-bubble-text {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .lamp-brand {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  #lampCanvas {
    width: min(480px, 94vw);
    max-height: min(42vh, 360px);
  }

  .lamp-copy {
    top: calc(76px + env(safe-area-inset-top, 0px));
  }
}

@media (max-width: 560px) {
  .genie-stage {
    display: none !important;
  }

  .lamp-line {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .genie-scroll-hint {
    display: none;
  }

  .genie-bubble,
  .genie-stage {
    transition: none;
  }

  .genie-stage {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}
