/* ======================================================
   PD Gallery – Frontend CSS
   Brand: #0077d0 | Font: Poppins / Montserrat
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Montserrat:wght@500;700&display=swap');

:root {
  --pdg-blue:   #0077d0;
  --pdg-dark:   #091929;
  --pdg-light:  #f0f6fc;
  --pdg-radius: 8px;
  --pdg-gap:    12px;
  --pdg-trans:  .28s cubic-bezier(.4,0,.2,1);
  --pdg-font:   "Poppins", "Montserrat", sans-serif;
}

/* ── Grid wrapper ── */
.pdg-gallery { font-family: var(--pdg-font); }

.pdg-grid {
  display: grid;
  gap: var(--pdg-gap);
}
.pdg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pdg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pdg-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* masonry (CSS-only fallback, JS can enhance) */
.pdg-layout-masonry {
  grid-template-rows: masonry;
  align-items: start;
}

/* ── Item ── */
.pdg-item { cursor: pointer; }

.pdg-thumb-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--pdg-radius);
  background: var(--pdg-light);
}

/* Proportions */
.pdg-ratio-square    .pdg-thumb-wrap { aspect-ratio: 1/1; }
.pdg-ratio-landscape .pdg-thumb-wrap { aspect-ratio: 4/3; }
.pdg-ratio-wide      .pdg-thumb-wrap { aspect-ratio: 16/9; }
.pdg-ratio-auto      .pdg-thumb-wrap { aspect-ratio: auto; }

.pdg-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--pdg-trans), filter var(--pdg-trans);
}

/* ── Overlay ── */
.pdg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 119, 208, 0);
  transition: background var(--pdg-trans);
}
.pdg-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92);
  border-radius: 50%;
  color: var(--pdg-blue);
  opacity: 0;
  transform: scale(.7);
  transition: opacity var(--pdg-trans), transform var(--pdg-trans);
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.pdg-icon svg { width: 26px; height: 26px; fill: var(--pdg-blue); }

.pdg-item:hover .pdg-overlay  { background: rgba(0,119,208,.35); }
.pdg-item:hover .pdg-icon     { opacity: 1; transform: scale(1); }
.pdg-item:hover .pdg-thumb-wrap img { transform: scale(1.06); filter: brightness(.85); }

/* ── Caption ── */
.pdg-caption {
  padding: 6px 4px 0;
  display: flex; flex-direction: column; gap: 2px;
}
.pdg-cap-title {
  font-family: var(--pdg-font);
  font-size: 13px; font-weight: 600;
  color: var(--pdg-dark);
  line-height: 1.3;
}
.pdg-cap-text {
  font-family: var(--pdg-font);
  font-size: 12px; color: #555; line-height: 1.4;
}

/* ═══════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════ */
.pdg-lb {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; pointer-events: none;
}
.pdg-lb.is-open { visibility: visible; pointer-events: all; }

.pdg-lb-bg {
  position: absolute; inset: 0;
  background: rgba(5,18,30,.92);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .32s ease;
}
.pdg-lb.is-open .pdg-lb-bg { opacity: 1; }

.pdg-lb-box {
  position: relative; z-index: 1;
  width: min(92vw, 960px);
  max-height: 94vh;
  display: flex; flex-direction: column;
  background: #0d1f30;
  border-radius: 12px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  overflow: hidden;
  opacity: 0; transform: translateY(20px) scale(.97);
  transition: opacity .3s ease, transform .3s ease;
}
.pdg-lb.is-open .pdg-lb-box { opacity: 1; transform: none; }

/* nav buttons */
.pdg-lb-close,
.pdg-lb-prev,
.pdg-lb-next {
  position: absolute;
  border: none; background: rgba(255,255,255,.12);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: background var(--pdg-trans), transform .15s;
  z-index: 2;
}
.pdg-lb-close svg,
.pdg-lb-prev  svg,
.pdg-lb-next  svg { fill: #fff; }

.pdg-lb-close { top: 14px; right: 14px; width: 40px; height: 40px; }
.pdg-lb-close svg { width: 20px; height: 20px; }

.pdg-lb-prev, .pdg-lb-next {
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
}
.pdg-lb-prev { left: 14px; }
.pdg-lb-next { right: 14px; }
.pdg-lb-prev svg, .pdg-lb-next svg { width: 24px; height: 24px; }

.pdg-lb-close:hover { background: var(--pdg-blue); }
.pdg-lb-prev:hover,
.pdg-lb-next:hover  { background: var(--pdg-blue); transform: translateY(-50%) scale(1.08); }

/* media area */
.pdg-lb-media-wrap {
  position: relative;
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 52px 72px 16px;
  overflow: hidden;
}
.pdg-lb-media {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.pdg-lb-media img {
  max-width: 100%; max-height: 68vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
.pdg-lb-media iframe {
  width: min(800px, 80vw);
  aspect-ratio: 16/9;
  border: none; border-radius: 6px;
}

/* spinner */
.pdg-lb-spinner {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center; gap: 8px;
}
.pdg-lb-spinner.active { display: flex; }
.pdg-lb-spinner span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pdg-blue);
  animation: pdg-bounce 1.2s infinite ease-in-out;
}
.pdg-lb-spinner span:nth-child(2) { animation-delay: .2s; }
.pdg-lb-spinner span:nth-child(3) { animation-delay: .4s; }
@keyframes pdg-bounce {
  0%,80%,100% { transform: scale(0); opacity:.4; }
  40%         { transform: scale(1); opacity:1; }
}

/* meta */
.pdg-lb-meta {
  padding: 10px 72px 18px;
  text-align: center;
  font-family: var(--pdg-font);
}
.pdg-lb-title   { font-weight: 600; color: #fff; font-size: 15px; margin: 0 0 4px; }
.pdg-lb-caption { color: rgba(255,255,255,.65); font-size: 13px; margin: 0; }
.pdg-lb-counter { color: rgba(255,255,255,.4); font-size: 12px; margin: 6px 0 0; }

/* slide animation */
.pdg-lb-media.pdg-slide-left  { animation: pdg-sl .22s ease forwards; }
.pdg-lb-media.pdg-slide-right { animation: pdg-sr .22s ease forwards; }
@keyframes pdg-sl { from{opacity:0;transform:translateX(40px)} to{opacity:1;transform:none} }
@keyframes pdg-sr { from{opacity:0;transform:translateX(-40px)} to{opacity:1;transform:none} }

/* ── Responsive ── */
@media (max-width: 900px) {
  .pdg-cols-4 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 640px) {
  .pdg-cols-3,
  .pdg-cols-4 { grid-template-columns: repeat(2,1fr); }
  .pdg-lb-media-wrap { padding: 52px 14px 12px; }
  .pdg-lb-meta       { padding: 8px 14px 14px; }
  .pdg-lb-prev { left: 6px; }
  .pdg-lb-next { right: 6px; }
}
@media (max-width: 400px) {
  .pdg-cols-2,
  .pdg-cols-3,
  .pdg-cols-4 { grid-template-columns: 1fr; }
}

/* reduce-motion */
@media (prefers-reduced-motion: reduce) {
  .pdg-thumb-wrap img,
  .pdg-overlay,
  .pdg-icon,
  .pdg-lb-box,
  .pdg-lb-bg,
  .pdg-lb-media { transition: none; animation: none; }
}
