/* Dream Gallery — immersive 2.5D prototype
   FUNCTIONAL + INTEGRATION UPDATE ONLY — PRODUCTION WEBSITE UNTOUCHED */

:root {
  --cream: #f7f3ec;
  --ink: #2a2622;
  --ink-soft: rgba(42, 38, 34, 0.72);
  --gold: #c4a574;
  --gold-cream: rgba(255, 246, 228, 0.72);
  --veil: rgba(255, 252, 247, 0.42);
  --ring: rgba(255, 250, 240, 0.62);
  --shade: rgba(28, 24, 20, 0);
  --ease-cine: cubic-bezier(0.22, 0.61, 0.36, 1);
  --zoom-ms: 1500ms;
  --panel-ms: 500ms;
  --font-serif: "Fraunces", "Times New Roman", serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e0c0a;
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* —— Minimal fixed chrome —— */
.dg-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(10, 8, 6, 0.42) 0%,
    rgba(10, 8, 6, 0.12) 70%,
    transparent 100%
  );
}

.dg-chrome-brand,
.dg-chrome-back {
  pointer-events: auto;
}

.dg-chrome-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.dg-chrome-logo {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.92;
}

.dg-chrome-wordmark {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--cream);
  opacity: 0.88;
}

.dg-chrome-back {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.dg-chrome-back:hover,
.dg-chrome-back:focus-visible {
  opacity: 0.92;
  outline: none;
}

/* —— Stage / World (cover scale) —— */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #0e0c0a;
}

#world {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  will-change: transform;
  /* base placement set in JS: translate(-50%,-50%) scale(s) + optional drift */
}

#gallery {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: auto;
  user-select: none;
  pointer-events: none;
}

#hotspots,
#veils {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#shade {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0);
  pointer-events: none;
  transition:
    background var(--zoom-ms) var(--ease-cine),
    backdrop-filter var(--zoom-ms) var(--ease-cine),
    -webkit-backdrop-filter var(--zoom-ms) var(--ease-cine);
  z-index: 2;
}

body.is-zoomed #shade {
  background: rgba(18, 14, 10, 0.34);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}

/* Breathing drift — applied via CSS var from JS on #world when idle */
@keyframes breathe {
  0%,
  100% {
    --drift-x: 0px;
    --drift-y: 0px;
  }
  50% {
    --drift-x: 6px;
    --drift-y: -4px;
  }
}

/* Hotspots — soft ethereal gold-cream glow (not game HUD) */
.hotspot {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 50% / 42%;
  background: transparent;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.65s ease, background 0.65s ease, opacity 0.65s ease;
  opacity: 0;
}

.hotspot::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: inherit;
  border: 1px solid transparent;
  box-shadow: none;
  transition: border-color 0.65s ease, box-shadow 0.65s ease, opacity 0.65s ease;
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .hotspot:hover,
  .hotspot:focus-visible {
    opacity: 1;
    background: radial-gradient(
      ellipse at center,
      rgba(255, 248, 230, 0.16) 0%,
      rgba(255, 242, 214, 0.06) 42%,
      transparent 72%
    );
  }

  .hotspot:hover::after,
  .hotspot:focus-visible::after {
    opacity: 1;
    border-color: var(--ring);
    box-shadow:
      0 0 18px rgba(255, 246, 220, 0.45),
      0 0 42px rgba(212, 176, 120, 0.28),
      0 0 72px rgba(255, 240, 210, 0.18),
      inset 0 0 36px rgba(255, 250, 240, 0.12);
  }
}

.hotspot:focus-visible {
  opacity: 1;
}

body.is-zoomed .hotspot {
  pointer-events: none;
}

/* CSS veil ovals removed — fabric lives in the master image only. */
.veil,
#veils { display: none !important; }

/* Unrevealed targets: hit area only, never a visible oval/glow at rest or hover */
.hotspot--unrevealed,
.hotspot--unrevealed:hover,
.hotspot--unrevealed:focus-visible {
  opacity: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0;
  cursor: default;
}
.hotspot--unrevealed::after { display: none !important; }

/* Minimal Coming Soon / Unrevealed notice */
#unrevealed-note {
  position: fixed;
  left: 50%;
  bottom: max(48px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 40;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  padding: 14px 22px;
  background: rgba(14, 12, 10, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(247, 243, 236, 0.92);
}
#unrevealed-note.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#unrevealed-note .unrevealed-note-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 6px;
  opacity: 0.9;
}
#unrevealed-note .unrevealed-note-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
  opacity: 0.55;
}
body.reduce-motion #unrevealed-note { transition: none; }

/* Panel — lower-left band, never covers artwork center */
.panel {
  position: fixed;
  z-index: 20;
  left: clamp(1rem, 4vw, 2.5rem);
  bottom: clamp(1.25rem, 5vh, 3rem);
  max-width: min(22rem, 86vw);
  color: var(--cream);
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--panel-ms) var(--ease-cine),
    transform var(--panel-ms) var(--ease-cine);
}

.panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.panel[hidden] {
  display: block !important;
  visibility: hidden;
}

.panel.is-open[hidden] {
  visibility: visible;
}

.panel-inner {
  padding: 1.25rem 1.35rem 1.35rem;
  background: linear-gradient(
    145deg,
    rgba(18, 14, 12, 0.55) 0%,
    rgba(18, 14, 12, 0.28) 100%
  );
  border: 1px solid rgba(247, 243, 236, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel-id {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  opacity: 0.65;
  margin-bottom: 0.55rem;
  font-weight: 300;
}

.panel-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  letter-spacing: 0.06em;
  line-height: 1.15;
  margin-bottom: 0.55rem;
}

.panel-meta {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 0.2rem;
  font-weight: 300;
}

.panel-collection {
  font-size: 0.78rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  opacity: 0.8;
  margin-bottom: 0.85rem;
}

.panel-desc {
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.55;
  opacity: 0.88;
  margin-bottom: 1.25rem;
  max-width: 34ch;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
}

.text-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.85;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid rgba(247, 243, 236, 0.35);
  transition: opacity 0.25s ease, border-color 0.25s ease;
}

.text-btn:hover,
.text-btn:focus-visible {
  opacity: 1;
  border-color: rgba(247, 243, 236, 0.9);
}

.text-btn[hidden] {
  display: none;
}

.mono {
  font-family: var(--font-mono);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 6, 0.88);
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox[hidden] {
  display: flex !important;
}

#lightbox-img {
  max-width: min(92vw, 900px);
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream);
  opacity: 0.75;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  opacity: 1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --zoom-ms: 120ms;
    --panel-ms: 120ms;
  }

  .panel,
  #shade,
  .hotspot,
  .hotspot::after,
  .lightbox {
    transition-duration: 0.01ms !important;
  }
}

body.reduce-motion #world {
  /* drift disabled in JS */
}
