/* ───────────────────────────────────────────────
   PDL – Frontend Styles
   2.5D Parallax Depth Layer Widget
──────────────────────────────────────────────── */

/* ── Widget Wrapper ── */
.pdl-widget-wrapper {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  cursor: crosshair;
  background: #111;
}

.pdl-widget-wrapper.pdl-is-zoomed {
  cursor: zoom-out;
}

/* ── Canvas ── */
.pdl-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ── CSS Fallback ── */
.pdl-fallback-wrapper {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.pdl-fallback-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.pdl-css-layer {
  position: absolute;
  inset: -6%;
  width: calc(100% + 12%);
  height: calc(100% + 12%);
  background-size: cover;
  background-position: center;
}

/* ── Loading ── */
.pdl-loading-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 10;
}

.pdl-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: pdl-spin 0.8s linear infinite;
}

@keyframes pdl-spin {
  to { transform: rotate(360deg); }
}

/* ── Placeholder (editor, no image) ── */
.pdl-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: #1a1a2e;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  text-align: center;
  padding: 2rem;
}

/* ── Hotspot Layer ── */
.pdl-hotspots-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* ── Hotspot Marker ── */
.pdl-hotspot-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: #111;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 6;
  padding: 0;
  outline: none;
  will-change: transform;
  animation: pdl-pulse 2.4s ease-in-out infinite;
}

.pdl-hotspot-marker:hover {
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.25);
  animation: none;
}

.pdl-hotspot-marker:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #0055aa;
}

@keyframes pdl-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
}

/* ── Lightbox Overlay ── */
.pdl-lightbox-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
  box-sizing: border-box;
  border-radius: inherit;
}

.pdl-lightbox-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── Lightbox Panel ── */
.pdl-lightbox-panel {
  background: #fff;
  color: #111;
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  transform: translateY(12px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.pdl-lightbox-overlay.is-open .pdl-lightbox-panel {
  transform: translateY(0);
}

.pdl-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  transition: background 0.15s;
  z-index: 1;
  padding: 0;
}

.pdl-lightbox-close:hover {
  background: rgba(0,0,0,0.15);
}

.pdl-lightbox-image-wrap {
  width: 100%;
  max-height: 240px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}

.pdl-lightbox-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.pdl-lightbox-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.pdl-lightbox-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #111;
  padding-right: 2rem;
}

.pdl-lightbox-content {
  font-size: 14px;
  line-height: 1.65;
  color: #444;
}

.pdl-lightbox-content p:first-child { margin-top: 0; }
.pdl-lightbox-content p:last-child  { margin-bottom: 0; }

/* Prevent body scroll when lightbox is open (full-page use) */
body.pdl-lightbox-active { overflow: hidden; }

/* ── Gyro permission button (iOS) ── */
.pdl-gyro-permission-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 8;
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s;
}

.pdl-gyro-permission-btn:hover {
  background: rgba(255,255,255,0.25);
}

/* ── Dark panel scrollbar ── */
.pdl-lightbox-panel::-webkit-scrollbar       { width: 6px; }
.pdl-lightbox-panel::-webkit-scrollbar-track  { background: transparent; }
.pdl-lightbox-panel::-webkit-scrollbar-thumb  { background: rgba(0,0,0,0.2); border-radius: 3px; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .pdl-lightbox-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .pdl-lightbox-panel {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 85vh;
  }

  .pdl-lightbox-image-wrap {
    border-radius: 16px 16px 0 0;
    max-height: 180px;
  }

  .pdl-lightbox-img {
    height: 180px;
  }
}

/* ── Reduced motion: show static image, hide canvas ── */
@media (prefers-reduced-motion: reduce) {
  .pdl-canvas              { display: none !important; }
  .pdl-fallback-wrapper    { display: block !important; }
  .pdl-loading-indicator   { display: none !important; }
  .pdl-hotspot-marker      { animation: none !important; }
}
