/* ========== GALLERY GRID ========== */
.pg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 32px 24px;
}

/* Tablet */
@media (max-width: 900px) {
  .pg-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 24px 16px;
    gap: 14px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .pg-grid {
    grid-template-columns: repeat(3, 1fr);
    padding: 18px 12px;
    gap: 10px;
  }
}

/* ========== GRID ITEM ========== */
.pg-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: #f8fafc;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
  height: 50vh;
}

/* Landscape frame */
.pg-item::before {
  content: "";
  display: block;
  padding-bottom: 65%; /* landscape ratio */
}

.pg-item-img-wrap {
  position: absolute;
  inset: 0;
}

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

.pg-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top right,
    rgba(15, 23, 42, 0.28),
    rgba(15, 23, 42, 0.02)
  );
  opacity: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 12px;
  box-sizing: border-box;
  transition: opacity 0.18s ease;
}

.pg-item-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.9);
}

.pg-item-pill {
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.22);
  color: #f9fafb;
  border: 1px solid rgba(241, 245, 249, 0.6);
  backdrop-filter: blur(8px);
}

.pg-item:hover {
  transform: translateY(-3px);
  filter: saturate(1.05);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.pg-item:hover img {
  transform: scale(1.03);
}

.pg-item:hover .pg-item-overlay {
  opacity: 1;
}

/* ========== MODAL BACKDROP ========== */
.pg-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  justify-content: center;
  align-items: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 999;
}

.pg-modal.pg-open {
  visibility: visible;
  opacity: 1;
}

/* ========== MODAL SHELL ========== */
.pg-modal-shell {
  max-width: 960px;
  width: 90vw;
  max-height: 86vh;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 22px 18px;
  box-sizing: border-box;
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.45);
  position: relative;
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.30s cubic-bezier(0.19, 1, 0.22, 1),
    opacity 0.24s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pg-modal.pg-open .pg-modal-shell {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pg-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pg-modal-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #64748b;
}

.pg-modal-count {
  font-size: 11px;
  color: #94a3b8;
}

/* ========== IMAGE AREA ========== */
.pg-modal-img-wrap {
  position: relative;
  border-radius: 14px;
  background: #f6f6f6;
  /* padding: 12px 52px;  */
  box-sizing: border-box;
}

.pg-modal-img-inner {
  border-radius: 12px;
  overflow: hidden;
  background: #f6f6f6;
}

.pg-modal-img-inner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 64vh;
  object-fit: contain;
  user-select: none;
}

/* ========== MOBILE MODAL (REDUCED HEIGHT) ========== */
@media (max-width: 700px) {
  .pg-modal-shell {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: 80vh;         /* reduced height */
    margin: 0 12px;
    border-radius: 16px;
    padding: 12px 14px 14px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.55);
  }

  .pg-modal-top {
    padding-inline: 2px;
  }

  .pg-modal-img-wrap {
    padding: 8px 18px;        /* tighter spacing */
  }

  .pg-modal-img-inner img {
    max-height: 60vh;
  }
}

@media (max-width: 500px) {
  .pg-modal-img-wrap {
    padding: 8px 14px;
  }
}

/* ========== NAV BUTTONS (DESKTOP) ========== */
.pg-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);              /* lighter */
  border: 1px solid rgba(176, 19, 126, 0.25);        /* soft border */
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.25);    /* lighter shadow */
  backdrop-filter: blur(12px);
  color: #b0137e;                                     /* brand, but not heavy */
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.pg-nav-btn:hover {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
  transform: translateY(-50%) translateY(-2px) scale(1.03);
}

.pg-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
}

#pgPrevBtn {
  left: 16px;
}

#pgNextBtn {
  right: 16px;
}

/* ========== NAV BUTTONS ON MOBILE: BOTTOM CENTER ========== */
@media (max-width: 700px) {
  .pg-nav-btn {
    top: auto;
    bottom: 10px;           /* move to bottom */
    transform: none;        /* reset transform */
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  #pgPrevBtn {
    left: 50%;
    transform: translateX(-54px); /* left of center */
  }

  #pgNextBtn {
    right: 50%;
    transform: translateX(54px);  /* right of center */
  }
}

/* ========== CLOSE BUTTON ========== */
.pg-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(176, 19, 126, 0.4);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.30);
  backdrop-filter: blur(10px);
  color: #b0137e;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.pg-close-btn:hover {
  transform: translateY(-1px);
}

.pg-close-btn:active {
  transform: scale(0.95);
}

/* ========== FOOTER (optional caption) ========== */
.pg-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.pg-modal-hint {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
