/* ============================================================
   gallery.css — KMA Business Group PH
   Corporate editorial gallery page
   ============================================================ */

/* ── Custom properties (gallery-scoped) ── */
:root {
  --gl-ink:        #0a1628;
  --gl-ink-mid:    #1c2e48;
  --gl-gold:       #b89355;
  --gl-gold-light: #d4af6e;
  --gl-rule:       rgba(0, 61, 130, 0.12);
  --gl-font-serif: 'Playfair Display', Georgia, serif;
  --gl-font-sans:  'DM Sans', 'Segoe UI', sans-serif;
}

/* ══════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════ */
.gl-header {
  max-width: 640px;
  margin: 56px auto 0;
  padding: 0 24px 40px;
  text-align: center;
}

.gl-header__eyebrow {
  font-family: var(--gl-font-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gl-gold);
  margin-bottom: 14px;
}

.gl-header__title {
  font-family: var(--gl-font-serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  color: var(--gl-ink);
  line-height: 1.18;
  margin-bottom: 18px;
  letter-spacing: -0.4px;
}

.gl-header__desc {
  font-family: var(--gl-font-sans);
  font-size: 15px;
  font-weight: 300;
  color: #5a6a82;
  line-height: 1.72;
  margin-bottom: 28px;
}

.gl-header__rule {
  width: 40px;
  height: 1.5px;
  background: var(--gl-gold);
  margin: 0 auto;
  opacity: 0.7;
}

/* ══════════════════════════════════════════
   GRID WRAPPER
══════════════════════════════════════════ */
.gl-grid-wrap {
  padding: 0 20px 72px;
  max-width: 1200px;
  margin: 0 auto;
}

.gl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  gap: 16px;
}

/* First card spans 2 columns — featured */
.gl-chapter--featured {
  grid-column: span 2;
}

/* ══════════════════════════════════════════
   CHAPTER CARD
══════════════════════════════════════════ */
.gl-chapter {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--gl-ink);
  cursor: pointer;

  /* Entrance animation start state */
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s ease;
}

.gl-chapter--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay per card */
.gl-chapter:nth-child(1) { transition-delay: 0.00s; }
.gl-chapter:nth-child(2) { transition-delay: 0.07s; }
.gl-chapter:nth-child(3) { transition-delay: 0.14s; }
.gl-chapter:nth-child(4) { transition-delay: 0.21s; }
.gl-chapter:nth-child(5) { transition-delay: 0.28s; }
.gl-chapter:nth-child(6) { transition-delay: 0.35s; }
.gl-chapter:nth-child(7) { transition-delay: 0.42s; }

.gl-chapter:hover {
  box-shadow: 0 16px 48px rgba(10, 22, 40, 0.28);
}

/* ── Hero image ── */
.gl-chapter__img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s;
  opacity: 0.72;
}

.gl-chapter--featured .gl-chapter__img {
  height: 340px;
}

.gl-chapter:hover .gl-chapter__img {
  transform: scale(1.04);
  opacity: 0.55;
}

/* ── Dark gradient overlay ── */
.gl-chapter__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8, 16, 36, 0.90) 0%,
    rgba(8, 16, 36, 0.50) 45%,
    rgba(8, 16, 36, 0.10) 100%
  );
  pointer-events: none;
  transition: background 0.3s;
}

.gl-chapter:hover .gl-chapter__overlay {
  background: linear-gradient(
    to top,
    rgba(8, 16, 36, 0.95) 0%,
    rgba(8, 16, 36, 0.60) 50%,
    rgba(8, 16, 36, 0.20) 100%
  );
}

/* ── Text body (sits on top of overlay) ── */
.gl-chapter__body {
  position: absolute;
  left: 0;
  right: 0;
  /* sits just above the thumbnail strip */
  bottom: 72px;
  padding: 0 22px 16px;
  pointer-events: none;
}

/* Card has no thumbnails if only 1 image */
.gl-chapter:not(:has(.gl-chapter__thumb)) .gl-chapter__body {
  bottom: 0;
}

.gl-chapter__tag {
  display: block;
  font-family: var(--gl-font-sans);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gl-gold-light);
  margin-bottom: 10px;
  font-weight: 400;
}

.gl-chapter__rule {
  width: 24px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.3);
  margin-bottom: 10px;
  transition: width 0.35s ease, background 0.35s ease;
}

.gl-chapter:hover .gl-chapter__rule {
  width: 44px;
  background: var(--gl-gold-light);
}

.gl-chapter__title {
  font-family: var(--gl-font-serif);
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.gl-chapter--featured .gl-chapter__title {
  font-size: 26px;
}

.gl-chapter__sub {
  font-family: var(--gl-font-sans);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.3px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.gl-chapter__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--gl-font-sans);
  font-size: 11px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.40);
  transition: color 0.25s;
  pointer-events: none;
}

.gl-chapter:hover .gl-chapter__cta {
  color: rgba(255, 255, 255, 0.85);
}

/* ── Thumbnail strip (bottom of card) ── */
.gl-chapter__strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  gap: 2px;
  background: rgba(8, 16, 36, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gl-chapter__thumb {
  flex: 1;
  background-size: cover;
  background-position: center;
  opacity: 0.55;
  transition: opacity 0.2s;
  cursor: pointer;
  pointer-events: all;
  position: relative;
}

.gl-chapter__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 36, 0.2);
  transition: background 0.2s;
}

.gl-chapter__thumb:hover {
  opacity: 1;
}

.gl-chapter__thumb:hover::after {
  background: transparent;
}

/* ══════════════════════════════════════════
   LIGHTBOX MODAL
══════════════════════════════════════════ */
.gl-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 12, 28, 0.96);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px;
}

.gl-modal--open {
  display: flex;
}

/* Close button */
.gl-modal__close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 10000;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.gl-modal__close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Image area */
.gl-modal__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 960px;
  padding: 0 60px;
}

.gl-modal__img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.gl-modal__img {
  max-width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* Navigation arrows */
.gl-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.55);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 10000;
}

.gl-modal__nav:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.gl-modal__nav--prev { left: 4px; }
.gl-modal__nav--next { right: 4px; }

/* Caption footer */
.gl-modal__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  max-width: 960px;
  margin-top: 20px;
  padding: 0 4px;
}

.gl-modal__caption-title {
  font-family: var(--gl-font-serif);
  font-size: 17px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 4px;
}

.gl-modal__caption-tag {
  font-family: var(--gl-font-sans);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gl-gold-light);
  font-weight: 300;
}

.gl-modal__counter {
  font-family: var(--gl-font-sans);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Dot indicators */
.gl-modal__dots {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.gl-modal__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.gl-modal__dot--active {
  background: var(--gl-gold-light);
  transform: scale(1.3);
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .gl-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gl-chapter--featured {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .gl-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .gl-chapter--featured {
    grid-column: span 1;
  }
  .gl-chapter__img,
  .gl-chapter--featured .gl-chapter__img {
    height: 240px;
  }
  .gl-modal__inner {
    padding: 0 44px;
  }
  .gl-modal__nav--prev { left: 0; }
  .gl-modal__nav--next { right: 0; }
}