/* ═══════════════════════════════════════════════════════
   AP Video Gallery Plugin — gallery.css  v1.0.0
   Self-contained: no theme variables required.
   Falls back gracefully on any WordPress theme.
═══════════════════════════════════════════════════════ */

/* ── Section wrapper ──────────────────────────────── */
.apvg-section {
  padding: 80px 0;
  background: #0e0c08;
}

.apvg-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Section header ───────────────────────────────── */
.apvg-header {
  text-align: center;
  margin-bottom: 48px;
}

.apvg-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  color: #e8b84a;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

.apvg-subtitle {
  font-family: "Lato", Arial, sans-serif;
  font-size: 1rem;
  color: #a89880;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

.apvg-rule {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #b87333, #d4944a, #b87333);
  margin: 0 auto;
  border-radius: 2px;
}

/* ── Grid ─────────────────────────────────────────── */
.apvg-grid {
  display: grid;
  gap: 20px;
}

.apvg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.apvg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.apvg-cols-1 { grid-template-columns: 1fr; }

/* ── Card ─────────────────────────────────────────── */
.apvg-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(184, 115, 51, 0.25);
  background: #1a1510;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;

  /* CRITICAL: cards must always be visible and clickable */
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none;
}

.apvg-card:hover,
.apvg-card:focus-visible {
  transform: translateY(-4px) scale(1.015);
  border-color: #b87333;
  box-shadow: 0 12px 40px rgba(184, 115, 51, 0.3);
  outline: none;
}

/* ── Thumbnail wrapper ────────────────────────────── */
.apvg-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

.apvg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.apvg-card:hover .apvg-img,
.apvg-card:focus-visible .apvg-img {
  transform: scale(1.06);
}

/* ── Bronze tint overlay ──────────────────────────── */
.apvg-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(184,115,51,0.18) 0%, rgba(14,12,8,0.45) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.apvg-card:hover .apvg-tint,
.apvg-card:focus-visible .apvg-tint {
  opacity: 1;
}

/* ── Play button ──────────────────────────────────── */
.apvg-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.apvg-play svg {
  width: 56px;
  height: 56px;
  color: #e8b84a;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
  transition: transform 0.25s ease, color 0.25s ease;
}

.apvg-card:hover .apvg-play svg,
.apvg-card:focus-visible .apvg-play svg {
  transform: scale(1.15);
  color: #fff;
}

/* ── YouTube badge ────────────────────────────────── */
.apvg-yt-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  pointer-events: none;
}

.apvg-yt-badge svg {
  width: 72px;
  height: 16px;
}

/* ── Caption ──────────────────────────────────────── */
.apvg-caption {
  padding: 10px 14px 12px;
  background: linear-gradient(to bottom, #1a1510, #0e0c08);
}

.apvg-card-title {
  display: block;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #e8dcc8;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════ */

/* Hidden state — display:none so it's completely inert */
.apvg-lb {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999999;
  align-items: center;
  justify-content: center;
}

/* Visible state — JS adds this class */
.apvg-lb.apvg-lb--open {
  display: flex;
}

/* Backdrop */
.apvg-lb__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 0, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}

/* Panel */
.apvg-lb__panel {
  position: relative;
  z-index: 1;
  width: min(960px, 94vw);
  background: #0e0c08;
  border: 1px solid rgba(184, 115, 51, 0.45);
  border-radius: 10px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.96);
  overflow: hidden;

  /* Entry animation */
  animation: apvgPanelIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes apvgPanelIn {
  from { transform: scale(0.9) translateY(16px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* Close button */
.apvg-lb__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 12, 8, 0.9);
  border: 1px solid rgba(184, 115, 51, 0.5);
  border-radius: 50%;
  color: #e8dcc8;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.apvg-lb__close:hover {
  background: rgba(184, 115, 51, 0.25);
  border-color: #d4944a;
  transform: rotate(90deg) scale(1.1);
}

.apvg-lb__close svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Title bar */
.apvg-lb__title {
  margin: 0;
  padding: 0.85rem 3.5rem 0.85rem 1.25rem;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e8b84a;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(184, 115, 51, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 16:9 embed wrapper */
.apvg-lb__embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.apvg-lb__embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .apvg-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .apvg-cols-3,
  .apvg-cols-2 { grid-template-columns: 1fr; gap: 14px; }
  .apvg-lb__panel { width: 98vw; border-radius: 6px; }
  .apvg-play svg { width: 44px; height: 44px; }
}

/* ── Carousel (shows 4 at a time; arrows page the rest) ──────── */
.apvg-carousel {
  position: relative;
}
.apvg-viewport {
  overflow: hidden;
  width: 100%;
}
.apvg-track {
  display: grid;
  grid-auto-flow: column;
  gap: 20px;
  /* Each column is exactly 1/4 of the viewport so 4 cards show at once */
  grid-auto-columns: calc((100% - 3 * 20px) / 4);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
/* Arrows */
.apvg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(184, 115, 51, 0.5);
  background: rgba(20, 16, 10, 0.85);
  color: #e8b84a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}
.apvg-arrow svg { width: 22px; height: 22px; }
.apvg-arrow:hover:not(:disabled) {
  background: #b87333;
  border-color: #b87333;
  color: #fff;
}
.apvg-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}
.apvg-arrow--prev { left: -10px; }
.apvg-arrow--next { right: -10px; }
@media (min-width: 1200px) {
  .apvg-arrow--prev { left: -22px; }
  .apvg-arrow--next { right: -22px; }
}
/* Page dots */
.apvg-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.apvg-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(184, 115, 51, 0.35);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.apvg-dot.is-active {
  background: #e8b84a;
  transform: scale(1.25);
}

/* Responsive: fewer cards per view on smaller screens */
@media (max-width: 1024px) {
  .apvg-track { grid-auto-columns: calc((100% - 2 * 20px) / 3); }
}
@media (max-width: 768px) {
  .apvg-track { grid-auto-columns: calc((100% - 20px) / 2); gap: 14px; }
  .apvg-arrow--prev { left: -6px; }
  .apvg-arrow--next { right: -6px; }
}
@media (max-width: 520px) {
  .apvg-track { grid-auto-columns: 100%; }
}
