/* =========================================================
   APSG Premium Public Gallery
   Photo + video albums from Google Drive
   ========================================================= */
:root {
  --gallery-deep: #05351f;
  --gallery-green: #0f8a4b;
  --gallery-emerald: #0f766e;
  --gallery-gold: #d6a92b;
  --gallery-cream: #fffaf0;
  --gallery-ink: #07140e;
  --gallery-soft: #f6fbf7;
}

.gallery-page {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #102018;
  background:
    radial-gradient(circle at top left, rgba(214, 169, 43, 0.18), transparent 30rem),
    radial-gradient(circle at bottom right, rgba(15, 138, 75, 0.12), transparent 32rem),
    linear-gradient(180deg, #f8fbf7 0%, #eef8f2 58%, #fbfff9 100%);
}

.display-font { font-family: "Playfair Display", Georgia, serif; }

.gallery-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(5, 53, 31, 0.98), rgba(5, 36, 20, 0.94) 50%, rgba(15, 118, 110, 0.88)),
    url('/assets/images/hero/hero3.jpg') center/cover no-repeat;
}

.gallery-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.15;
  background-image:
    linear-gradient(rgba(255,255,255,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.14) 1px, transparent 1px);
  background-size: 42px 42px;
}

.gallery-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 120px;
  background: linear-gradient(180deg, transparent, #f8fbf7 80%);
  pointer-events: none;
}

.gallery-chip,
.gallery-filter-chip,
.gallery-count-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  width: fit-content;
  border-radius: 999px;
  font-weight: 950;
  text-decoration: none;
}

.gallery-chip {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.12);
  color: #fff;
  padding: .55rem .85rem;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  backdrop-filter: blur(14px);
}

.gallery-stat {
  border-radius: 1.35rem;
  background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 20px 60px rgba(0,0,0,.18);
  backdrop-filter: blur(14px);
}

.gallery-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  border-radius: 999px;
  padding: .88rem 1.25rem;
  font-size: .9rem;
  font-weight: 950;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.gallery-btn:hover { transform: translateY(-3px); }
.gallery-btn.gold { color: var(--gallery-deep); background: linear-gradient(135deg, #f7d66b, var(--gallery-gold)); box-shadow: 0 18px 42px rgba(214,169,43,.28); }
.gallery-btn.green { color: #fff; background: linear-gradient(135deg, var(--gallery-green), var(--gallery-emerald)); box-shadow: 0 18px 42px rgba(15,138,75,.22); }
.gallery-btn.white { color: #fff; background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.22); backdrop-filter: blur(12px); }
.gallery-btn.light { color: var(--gallery-deep); background: #fff; border-color: rgba(5,53,31,.12); box-shadow: 0 12px 32px rgba(5,53,31,.08); }

.gallery-shell {
  position: relative;
  overflow: hidden;
  border-radius: 2rem;
  border: 1px solid rgba(5, 53, 31, 0.10);
  background: rgba(255,255,255,.86);
  box-shadow: 0 26px 80px rgba(5,53,31,.12);
  backdrop-filter: blur(18px);
}
.gallery-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--gallery-deep), var(--gallery-gold), var(--gallery-emerald));
}

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid rgba(5,53,31,.08);
}
.gallery-search-wrap {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: min(100%, 26rem);
  border-radius: 999px;
  border: 1px solid rgba(5,53,31,.12);
  background: rgba(255,255,255,.92);
  padding: .72rem 1rem;
}
.gallery-search-wrap i { color: var(--gallery-gold); }
.gallery-search-wrap input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #102018;
  font-weight: 750;
}
.gallery-filter-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.gallery-filter-chip {
  border: 1px solid rgba(5,53,31,.10);
  background: #fff;
  color: #315041;
  padding: .55rem .8rem;
  font-size: .78rem;
  cursor: pointer;
}
.gallery-filter-chip.active,
.gallery-filter-chip:hover { color: var(--gallery-deep); background: #fff7d6; border-color: rgba(214,169,43,.36); }

.gallery-featured {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  gap: 0;
  overflow: hidden;
  border-radius: 1.7rem;
  background: linear-gradient(135deg, var(--gallery-deep), var(--gallery-emerald));
  color: #fff;
  border: 1px solid rgba(214,169,43,.24);
  box-shadow: 0 24px 72px rgba(5,53,31,.18);
}
.gallery-featured-media {
  min-height: 23rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gallery-deep), var(--gallery-emerald));
}
.gallery-featured-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery-featured-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(0,0,0,.38)); }
.gallery-featured-body { padding: 2rem; display: flex; flex-direction: column; justify-content: center; }
.gallery-featured h2 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(2rem, 4vw, 4.2rem); line-height: .95; font-weight: 950; letter-spacing: -.04em; }
.gallery-featured p { margin-top: 1rem; color: rgba(255,255,255,.78); line-height: 1.75; }

.gallery-count-chip {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.11);
  color: rgba(255,255,255,.88);
  padding: .45rem .7rem;
  font-size: .75rem;
}

.gallery-albums-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}
.gallery-album-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.55rem;
  border: 1px solid rgba(5,53,31,.10);
  background: #fff;
  box-shadow: 0 18px 54px rgba(5,53,31,.09);
  cursor: pointer;
  transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease;
}
.gallery-album-card:hover { transform: translateY(-6px); box-shadow: 0 26px 70px rgba(5,53,31,.14); border-color: rgba(214,169,43,.34); }
.gallery-album-cover { position: relative; height: 17rem; overflow: hidden; background: linear-gradient(135deg, var(--gallery-deep), var(--gallery-emerald)); }
.gallery-album-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.gallery-album-card:hover .gallery-album-cover img { transform: scale(1.06); }
.gallery-album-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 42%, rgba(0,0,0,.72)); }
.gallery-album-badges { position: absolute; left: .9rem; right: .9rem; top: .9rem; z-index: 2; display: flex; flex-wrap: wrap; gap: .45rem; }
.gallery-badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .38rem .6rem; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(10px); font-size: .68rem; font-weight: 950; }
.gallery-badge.gold { color: var(--gallery-deep); background: linear-gradient(135deg, #f7d66b, var(--gallery-gold)); border: 0; }
.gallery-album-title-strip { position: absolute; left: 1rem; right: 1rem; bottom: 1rem; z-index: 2; color: #fff; }
.gallery-album-title-strip h3 { font-family: "Playfair Display", Georgia, serif; font-size: 1.55rem; font-weight: 950; line-height: 1.02; }
.gallery-album-body { padding: 1rem; }
.gallery-album-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.gallery-album-meta span { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .35rem .55rem; background: #eef8f2; color: #315041; font-size: .72rem; font-weight: 850; }
.gallery-album-desc { margin-top: .65rem; color: #64746a; line-height: 1.6; font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.gallery-album-view { padding: 1.25rem; }
.gallery-album-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, rgba(5,53,31,.96), rgba(15,118,110,.88));
  color: #fff;
  box-shadow: 0 18px 50px rgba(5,53,31,.16);
}
.gallery-album-head h2 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(2rem, 4vw, 4rem); font-weight: 950; line-height: .98; }
.gallery-album-head p { color: rgba(255,255,255,.78); line-height: 1.65; }
.gallery-media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.gallery-media-card { position: relative; overflow: hidden; border: 0; border-radius: 1.25rem; min-height: 13rem; background: linear-gradient(135deg, var(--gallery-deep), var(--gallery-emerald)); cursor: pointer; box-shadow: 0 14px 36px rgba(5,53,31,.10); }
.gallery-media-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.gallery-media-card:hover img { transform: scale(1.06); }
.gallery-media-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 52%, rgba(0,0,0,.76)); }
.gallery-media-info { position: absolute; left: .85rem; right: .85rem; bottom: .85rem; z-index: 2; color: #fff; text-align: left; }
.gallery-media-info strong { display: block; font-weight: 950; line-height: 1.12; }
.gallery-media-info small { color: rgba(255,255,255,.72); font-weight: 800; }
.gallery-video-mark { position: absolute; right: .85rem; top: .85rem; z-index: 3; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 999px; background: linear-gradient(135deg, #f7d66b, var(--gallery-gold)); color: var(--gallery-deep); box-shadow: 0 12px 34px rgba(0,0,0,.22); }

.gallery-state { text-align: center; border: 1px dashed rgba(5,53,31,.16); border-radius: 1.5rem; padding: 3rem 1.25rem; background: rgba(255,255,255,.86); color: #64746a; box-shadow: 0 18px 50px rgba(5,53,31,.08); }
.gallery-state i { color: var(--gallery-gold); font-size: 2rem; }
.gallery-loader { width: 2.2rem; height: 2.2rem; display: inline-block; border-radius: 999px; border: 3px solid rgba(214,169,43,.24); border-top-color: var(--gallery-gold); animation: gallerySpin .8s linear infinite; }
@keyframes gallerySpin { to { transform: rotate(360deg); } }

.gallery-lightbox { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 1rem; background: rgba(3, 20, 12, 0.94); backdrop-filter: blur(12px); }
.gallery-lightbox.show { display: flex; }
.gallery-lightbox-inner { width: min(1180px, 100%); max-height: 94vh; display: grid; grid-template-rows: auto 1fr auto; gap: .75rem; }
.gallery-lightbox-top, .gallery-lightbox-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #fff; }
.gallery-lightbox-title strong { display: block; font-weight: 950; }
.gallery-lightbox-title small { color: rgba(255,255,255,.64); font-weight: 750; }
.gallery-lightbox-stage { position: relative; overflow: hidden; min-height: 68vh; border-radius: 1.4rem; background: #000; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 24px 70px rgba(0,0,0,.38); }
.gallery-lightbox-stage img, .gallery-lightbox-stage iframe, .gallery-lightbox-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border: 0; }
.gallery-lightbox-btn { width: 2.8rem; height: 2.8rem; display: grid; place-items: center; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.10); color: #fff; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.gallery-lightbox-btn:hover { background: rgba(214,169,43,.92); color: var(--gallery-deep); transform: translateY(-2px); }
.gallery-lightbox-nav { display: flex; gap: .55rem; align-items: center; }
.gallery-progress { flex: 1; height: .45rem; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.14); }
.gallery-progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gallery-gold), #f7d66b); transition: width .3s ease; }

@media (max-width: 1100px) { .gallery-albums-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } .gallery-media-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 820px) { .gallery-featured { grid-template-columns: 1fr; } .gallery-featured-media { min-height: 18rem; } .gallery-album-head { grid-template-columns: 1fr; } .gallery-media-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .gallery-toolbar { align-items: stretch; } .gallery-search-wrap { min-width: 100%; } .gallery-albums-grid { grid-template-columns: 1fr; padding: .9rem; } .gallery-media-grid { grid-template-columns: 1fr; } .gallery-lightbox-stage { min-height: 55vh; } .gallery-lightbox-top, .gallery-lightbox-bottom { flex-wrap: wrap; } }

@media print { .gallery-hero, #navbar, #footer, .gallery-lightbox { display: none !important; } .gallery-shell, .gallery-album-card, .gallery-media-card { box-shadow: none !important; border: 1px solid #ddd !important; } }

/* =========================================================
   Google Drive Folder Fallback Embed
   ========================================================= */
.gallery-drive-embed {
  overflow: hidden;
  border-radius: 1.6rem;
  border: 1px solid rgba(5, 53, 31, 0.10);
  background: #fff;
  box-shadow: 0 22px 70px rgba(5, 53, 31, 0.10);
}
.gallery-drive-embed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(5, 53, 31, 0.08);
  background: linear-gradient(90deg, #fff7d6, #f8fbf7);
}
.gallery-drive-embed-head strong {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #05351f;
  font-weight: 950;
}
.gallery-drive-embed-head span {
  color: #64746a;
  font-size: .82rem;
  font-weight: 750;
}
.gallery-drive-embed iframe {
  width: 100%;
  height: min(72vh, 680px);
  border: 0;
  background: #fff;
}
.gallery-drive-note {
  padding: .8rem 1rem 1rem;
  color: #8a6616;
  font-size: .82rem;
  font-weight: 800;
  background: #fff7d6;
}
.gallery-btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}
.gallery-featured-mark {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 18rem;
  color: rgba(255,255,255,.72);
  font-size: 3rem;
  background: linear-gradient(135deg, #05351f, #0f766e);
}
