/* ============================================================
   Peacock Automaton Gallery 41 — CSS
   ============================================================ */

.pag41-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 600px;
  max-height: 65vh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 80%, #1a1208 0%, #0d0a05 60%, #040302 100%);
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
}

.pag41-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
}

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

/* ============================================================
   LOADING INDICATOR
   ============================================================ */
.pag41-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(ellipse at 50% 80%, #1a1208 0%, #0d0a05 100%);
  color: #c89040;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  z-index: 5;
  transition: opacity 0.6s ease;
}

.pag41-loading.pag41-loaded {
  opacity: 0;
  pointer-events: none;
}

.pag41-gear-loader {
  display: flex;
  align-items: center;
  gap: -4px;
}

.pag41-gear {
  font-size: 32px;
  color: #c89040;
  display: inline-block;
  animation: pag41-spin 2s linear infinite;
  text-shadow: 0 0 8px rgba(200, 144, 64, 0.6);
}

.pag41-gear-1 { font-size: 40px; animation-duration: 3s; }
.pag41-gear-2 { font-size: 28px; animation-duration: 2s; animation-direction: reverse; margin: 0 -6px; }
.pag41-gear-3 { font-size: 34px; animation-duration: 2.5s; }

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

/* ============================================================
   LIGHTBOX
   ============================================================ */
.pag41-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 3, 2, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.pag41-lightbox:not([hidden]) {
  opacity: 1;
}

.pag41-lightbox[hidden] {
  display: none;
}

.pag41-lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Brass/enamel frame decoration */
.pag41-lightbox-inner::before {
  content: '';
  position: absolute;
  inset: -20px;
  border: 3px solid #c89040;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px #8a6020,
    0 0 30px rgba(200, 144, 64, 0.3),
    inset 0 0 30px rgba(200, 144, 64, 0.05);
  pointer-events: none;
  z-index: -1;
}

.pag41-lightbox-inner::after {
  content: '';
  position: absolute;
  inset: -14px;
  border: 1px solid rgba(200, 144, 64, 0.4);
  border-radius: 1px;
  pointer-events: none;
  z-index: -1;
}

/* Ornamental corners */
.pag41-lightbox-media {
  max-width: 80vw;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pag41-lightbox-media img,
.pag41-lightbox-media video {
  max-width: 80vw;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  box-shadow: 0 0 40px rgba(0,0,0,0.8), 0 0 80px rgba(200, 144, 64, 0.15);
}

.pag41-lightbox-close {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid #c89040;
  color: #c89040;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  border-radius: 1px;
}

.pag41-lightbox-close:hover,
.pag41-lightbox-close:focus {
  background: #c89040;
  color: #0d0a05;
  outline: 2px solid #ffd580;
  outline-offset: 2px;
}

/* Navigation */
.pag41-lightbox-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.pag41-lightbox-prev,
.pag41-lightbox-next {
  background: none;
  border: 1px solid #c89040;
  color: #c89040;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  border-radius: 1px;
}

.pag41-lightbox-prev:hover,
.pag41-lightbox-prev:focus,
.pag41-lightbox-next:hover,
.pag41-lightbox-next:focus {
  background: #c89040;
  color: #0d0a05;
  outline: 2px solid #ffd580;
  outline-offset: 2px;
}

.pag41-lightbox-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: center;
  flex: 1;
}

.pag41-lightbox-thumbs li {
  width: 44px;
  height: 44px;
  border: 2px solid transparent;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.pag41-lightbox-thumbs li.active,
.pag41-lightbox-thumbs li:hover {
  border-color: #c89040;
}

.pag41-lightbox-thumbs li img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pag41-lightbox-thumbs li:focus {
  outline: 2px solid #ffd580;
  outline-offset: 2px;
}

/* ============================================================
   FAN-OUT TRANSITION
   ============================================================ */
.pag41-lightbox.pag41-transition-fan-out .pag41-lightbox-media {
  animation: pag41-fan-in 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes pag41-fan-in {
  from {
    clip-path: polygon(50% 50%, 50% 50%, 50% 50%);
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    opacity: 1;
    transform: scale(1);
  }
}

.pag41-lightbox.pag41-transition-fade .pag41-lightbox-media {
  animation: pag41-fade-in 0.4s ease forwards;
}

@keyframes pag41-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pag41-lightbox.pag41-transition-zoom .pag41-lightbox-media {
  animation: pag41-zoom-in 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes pag41-zoom-in {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.pag41-lightbox.pag41-transition-slide .pag41-lightbox-media {
  animation: pag41-slide-in 0.4s ease forwards;
}

@keyframes pag41-slide-in {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .pag41-gear,
  .pag41-lightbox,
  .pag41-lightbox-media,
  .pag41-lightbox-close,
  .pag41-lightbox-prev,
  .pag41-lightbox-next {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
   EDITOR PREVIEW
   ============================================================ */
.elementor-editor-active .pag41-loading {
  display: none;
}
