/* ==========================================================================
   CIELO CAFE AND RESTRO - 3D INFINITE GALLERY
   Theme: Italian Luxury Cafe & Night Restro
   ========================================================================== */

:root {
  --gallery-bg: #0C0907;
  --gallery-fg: #FFFFFF;
  --gallery-fallback-bg: #14100D;
  --gallery-fallback-fg: rgba(255, 255, 255, 0.7);
}

.gallery-page-container {
  width: 100%;
  position: relative;
  padding: 1rem 0 2rem 0;
}

/* ---- 3D Gallery Stage ---- */
.gallery3d {
  position: relative;
  width: 100%;
  height: clamp(360px, 58vh, 480px);
  overflow: hidden;
  background-color: var(--gallery-bg);
  border-radius: var(--border-radius-lg, 0.75rem);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.2);
}

@media (min-width: 640px) {
  .gallery3d {
    height: clamp(450px, 68vh, 640px);
    border-radius: var(--border-radius-xl, 1rem);
  }
}

@media (min-width: 1024px) {
  .gallery3d {
    height: clamp(520px, 82vh, 880px);
  }
}

.gallery3d__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.gallery3d__canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}

.gallery3d__canvas canvas:active {
  cursor: grabbing;
}

.gallery3d__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--gallery-fallback-fg);
  font-family: var(--font-sans);
}

/* ---- WebGL Fallback Grid ---- */
.gallery3d__fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1.5rem;
  background: var(--gallery-fallback-bg);
  color: var(--gallery-fallback-fg);
}

@media (min-width: 640px) {
  .gallery3d__fallback {
    padding: 2rem;
  }
}

.gallery3d.is-fallback .gallery3d__fallback {
  display: flex;
}

.gallery3d__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-height: 24rem;
  overflow-y: auto;
  width: 100%;
  max-width: 50rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  .gallery3d__grid {
    gap: 1rem;
    max-height: 28rem;
  }
}

@media (min-width: 768px) {
  .gallery3d__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery3d__grid img {
  width: 100%;
  height: 8rem;
  object-fit: cover;
  border-radius: var(--border-radius-md, 0.75rem);
}

@media (min-width: 640px) {
  .gallery3d__grid img {
    height: 9rem;
  }
}

/* ---- Center Title Overlay in Black Background ---- */
.gallery-title-overlay {
  position: absolute;
  inset: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  text-align: center;
  pointer-events: none;
  z-index: 2;
}

@media (min-width: 640px) {
  .gallery-title-overlay {
    padding: 0 1.5rem;
  }
}

.gallery-title-overlay h1,
.gallery-title-overlay h2 {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(2rem, 7.5vw, 6.5rem);
  letter-spacing: -0.035em;
  font-weight: 350;
  line-height: 0.95;
  color: #757575; /* Gray big font on black background */
  text-transform: none;
  user-select: none;
}

.gallery-title-overlay h1 span,
.gallery-title-overlay h2 span {
  font-style: italic;
  font-weight: 300;
  color: #8E8E8E; /* Harmonious accent gray */
}

/* ---- Interaction Hint Cue ---- */
.gallery-hint-cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1rem;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 2;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .gallery-hint-cue {
    bottom: 2rem;
    font-size: 0.75rem;
  }
}
.gallery-hint-cue p {
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.gallery-hint-cue .gallery-hint__dim {
  opacity: 0.55;
  font-size: 0.6875rem;
  margin-top: 0.25rem;
}

/* Hide desktop hint on mobile when mobile controls are visible */
@media (max-width: 768px) {
  .gallery-hint-cue {
    display: none;
  }
}

/* ==========================================================================
   MOBILE "TAP TO INTERACT" OVERLAY CONTROLS
   Zero scroll trapping by default; tap to unlock 3D gestures with Done button
   ========================================================================== */

/* By default on touch/mobile devices, disable canvas pointer events so page scrolls 100% freely */
@media (max-width: 768px) {
  .gallery3d:not(.is-interactive) .gallery3d__canvas canvas {
    pointer-events: none !important;
    touch-action: pan-y !important;
  }

  .gallery3d.is-interactive {
    box-shadow: 0 0 0 2px var(--accent-sky), 0 20px 45px rgba(0, 0, 0, 0.4);
  }

  .gallery3d.is-interactive .gallery3d__canvas canvas {
    pointer-events: auto !important;
    touch-action: none !important;
  }
}

.gallery3d-mobile-controls {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: auto;
  padding: 0 1rem;
}

@media (min-width: 769px) {
  .gallery3d-mobile-controls {
    display: none !important;
  }
}

/* 1. Unlock Pill Button (Tap to Explore 3D) */
.btn-gallery-unlock {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  min-height: 44px;
  border-radius: var(--border-radius-full);
  background-color: rgba(12, 9, 7, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--bg-cream);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 250ms ease;
  user-select: none;
}

.btn-gallery-unlock:active {
  transform: scale(0.97);
  background-color: var(--accent-sky-deep);
}

.btn-gallery-unlock .unlock-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-sky);
  box-shadow: 0 0 8px var(--accent-sky);
  animation: pulseDot 1.8s infinite ease-in-out;
}

/* 2. Active Mode Controls Bar (Prev + Done + Next) */
.gallery-active-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--border-radius-full);
  background-color: rgba(12, 9, 7, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--accent-sky);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: fadeInSlideUp 250ms ease forwards;
}

@keyframes fadeInSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-gallery-nav {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 200ms ease;
}

.btn-gallery-nav:active {
  background-color: var(--accent-sky);
  color: var(--text-espresso);
}

.btn-gallery-done {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  min-height: 40px;
  border-radius: var(--border-radius-full);
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
}

.btn-gallery-done:active {
  background-color: #34d399;
  color: #000000;
}
