/* ==========================================================================
   Particle Mosaic 98 — style.css
   Text Domain: particle-mosaic-98
   ========================================================================== */

/* ── Wrapper ── */
.pm98-canvas-wrap {
  position: relative;
  width: 100%;
  height: 540px;
  overflow: hidden;
  background-color: #0a0a12;
  border-radius: 12px;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none; /* handled by JS */
  cursor: grab;
}

.pm98-canvas-wrap:active {
  cursor: grabbing;
}

/* ── Canvas ── */
.pm98-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ── Editor Placeholder ── */
.pm98-editor-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.18);
  font-family: monospace;
  pointer-events: none;
  letter-spacing: 0.08em;
}

/* Hide placeholder once the canvas is initialised */
.pm98-canvas-wrap.pm98--ready .pm98-editor-placeholder {
  display: none;
}

/* ── Loading spinner ── */
.pm98-canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: pm98-spin 0.8s linear infinite;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s;
}

.pm98-canvas-wrap.pm98--ready::after {
  opacity: 0;
  pointer-events: none;
}

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

/* ── Caption overlay ── */
.pm98-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.pm98-canvas-wrap:hover .pm98-caption,
.pm98-canvas-wrap:focus-within .pm98-caption {
  opacity: 1;
}

/* ── Lightbox ── */
.pm98-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm98-lightbox[hidden] {
  display: none !important;
}

.pm98-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.pm98-lightbox__close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.1rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.pm98-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.pm98-lightbox__content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  animation: pm98-lb-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pm98-lb-in {
  from { opacity: 0; transform: scale(0.05); }
  to   { opacity: 1; transform: scale(1); }
}

.pm98-lightbox__img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.pm98-lightbox__caption {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin: 0;
  text-align: center;
}

/* ── Text Caption ── */
.pm98-text-caption {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: rgba(255,255,255,0.8);
  font-size: 0.75rem;
  font-family: monospace;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: 99px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Video Badge ── */
.pm98-video-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.72rem;
  font-family: monospace;
  letter-spacing: 0.05em;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  animation: pm98-badge-in 0.3s ease both;
}

@keyframes pm98-badge-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Lightbox Video ── */
.pm98-lightbox__video {
  max-width: 90vw;
  max-height: 75vh;
  width: auto;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  outline: none;
  background: #000;
}

.pm98-lightbox__video[hidden] {
  display: none !important;
}

/* ── Mobile ── */
@media (max-width: 767px) {
  .pm98-canvas-wrap {
    /* height overridden via inline style from JS */
    border-radius: 8px;
    cursor: default;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .pm98-canvas-wrap::after {
    animation: none;
    display: none;
  }
  .pm98-lightbox__content {
    animation: none;
  }
}
