/**
 * Particle Morph Gallery – Stylesheet
 *
 * Aesthetic: Dark-cinematic, refined, tech-luxe.
 * Fonts loaded via Google Fonts in the widget HTML where needed;
 * we keep this self-contained here.
 */

/* ── Reset / Base ────────────────────────────────────────────────────────────── */

.pmg-widget,
.pmg-widget * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Widget Container ────────────────────────────────────────────────────────── */

.pmg-widget {
  position: relative;
  width: 100%;
  height: 560px;
  overflow: hidden;
  background: #0a0a12;
  border-radius: 4px;
  /* Prevent default touch zoom on mobile */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ── WebGL Canvas ────────────────────────────────────────────────────────────── */

.pmg-scene-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pmg-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

.pmg-canvas:active {
  cursor: grabbing;
}

/* ── Caption Overlay ─────────────────────────────────────────────────────────── */

.pmg-caption {
  position: absolute;
  bottom: 64px;
  left: 0;
  right: 0;
  padding: 0 32px 20px;
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.70) 0%,
    rgba(0, 0, 0, 0.30) 60%,
    transparent 100%);
  pointer-events: none;
  z-index: 10;
}

.pmg-caption__title {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 400;
  color: #ffffff;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-shadow: 0 1px 12px rgba(0,0,0,0.8);
  min-height: 1.5em;
  transition: opacity 0.4s ease;
}

.pmg-caption__desc {
  margin-top: 6px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: clamp(0.78rem, 1.3vw, 0.92rem);
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
  min-height: 1.4em;
}

/* ── Navigation ──────────────────────────────────────────────────────────────── */

.pmg-nav {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.pmg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pmg-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.55);
  transform: scale(1.1);
}

.pmg-btn:active {
  transform: scale(0.95);
}

.pmg-btn svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

/* Dots */
.pmg-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pmg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.30);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
  padding: 0;
}

.pmg-dot:hover {
  background: rgba(255, 255, 255, 0.65);
  transform: scale(1.25);
}

.pmg-dot--active {
  background: #ffffff;
  transform: scale(1.3);
}

/* ── Click hint ──────────────────────────────────────────────────────────────── */

.pmg-hint {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.6s ease;
}

.pmg-widget:hover .pmg-hint {
  opacity: 0;
}

/* ── Lightbox ────────────────────────────────────────────────────────────────── */

.pmg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pmg-lightbox--active {
  pointer-events: all;
  opacity: 1;
  visibility: visible;
}

.pmg-lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 10, var(--pmg-lb-opacity, 0.88));
  cursor: pointer;
}

.pmg-lightbox__content {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ── Lightbox: Fade animation ── */
.pmg-lightbox--fade .pmg-lightbox__content {
  transition: opacity 0.35s ease;
  opacity: 0;
}

.pmg-lightbox--fade.pmg-lightbox--active .pmg-lightbox__content {
  opacity: 1;
}

/* ── Lightbox: Zoom animation ── */
.pmg-lightbox--zoom .pmg-lightbox__content {
  transition: opacity 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  transform: scale(0.88);
}

.pmg-lightbox--zoom.pmg-lightbox--active .pmg-lightbox__content {
  opacity: 1;
  transform: scale(1);
}

.pmg-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.06);
}

.pmg-lightbox__info {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
}

.pmg-lightbox__title {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

.pmg-lightbox__desc {
  margin-top: 6px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.55);
}

.pmg-lightbox__close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(20, 20, 30, 0.85);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

.pmg-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(90deg) scale(1.1);
}

.pmg-lightbox__close svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

/* ── Body lock when lightbox open ── */
.pmg-body-lock {
  overflow: hidden !important;
}

/* ── Fallback Gallery ────────────────────────────────────────────────────────── */

.pmg-widget--fallback .pmg-scene-wrapper,
.pmg-widget--fallback .pmg-hint {
  display: none !important;
}

.pmg-fallback {
  position: absolute;
  inset: 0;
  padding: 20px;
  overflow-y: auto;
  background: #0a0a12;
}

.pmg-fallback__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.pmg-fallback__item {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}

.pmg-fallback__item img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pmg-fallback__item:hover img {
  transform: scale(1.04);
}

.pmg-fallback__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: rgba(0,0,0,0.6);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.02em;
}

.pmg-fallback__notice {
  margin-top: 16px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.05em;
  text-align: center;
}

/* ── Elementor Editor Placeholder ────────────────────────────────────────────── */

.pmg-editor-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #0a0a12;
  border: 1px dashed rgba(136, 204, 255, 0.25);
  border-radius: 4px;
}

.pmg-editor-placeholder__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0.65;
}

.pmg-editor-placeholder__inner p {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: #88ccff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pmg-editor-placeholder__inner span {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  color: rgba(136, 204, 255, 0.5);
  letter-spacing: 0.04em;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .pmg-widget {
    height: 400px;
    border-radius: 0;
  }

  .pmg-caption {
    padding: 0 16px 14px;
    bottom: 56px;
  }

  .pmg-caption__title {
    font-size: 1.05rem;
  }

  .pmg-caption__desc {
    display: none; /* Keep mobile UI clean */
  }

  .pmg-nav {
    bottom: 12px;
    gap: 8px;
  }

  .pmg-btn {
    width: 28px;
    height: 28px;
  }

  .pmg-dot {
    width: 6px;
    height: 6px;
  }

  .pmg-lightbox__content {
    max-width: 96vw;
  }

  .pmg-lightbox__close {
    top: -12px;
    right: -6px;
  }
}

@media (max-width: 480px) {
  .pmg-fallback__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Gyroscope Permission Button ─────────────────────────────────────────────── */

.pmg-gyro-btn {
  display: none; /* shown only by JS when iOS permission needed */
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid rgba(136, 204, 255, 0.45);
  border-radius: 24px;
  background: rgba(4, 10, 24, 0.80);
  color: rgba(136, 204, 255, 0.90);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 25;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s ease, opacity 0.6s ease, transform 0.2s ease;
  white-space: nowrap;
}

.pmg-gyro-btn:hover {
  background: rgba(136, 204, 255, 0.15);
  transform: translateX(-50%) scale(1.05);
}

.pmg-gyro-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  animation: pmg-spin 2.5s linear infinite;
}

.pmg-gyro-btn--granted {
  opacity: 0;
  pointer-events: none;
}

@keyframes pmg-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Color Theme Indicator (shown briefly on theme change) ───────────────── */
.pmg-theme-badge {
  position: absolute;
  top: 14px;
  left: 16px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.pmg-theme-badge--visible { opacity: 1; }

/* ── Slide type badge in caption (Text / Shape indicator) ────────────────── */
.pmg-caption__type {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 7px;
  border-radius: 9px;
  background: rgba(136,204,255,0.18);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(136,204,255,0.75);
}
