/* GALLERY PAGE
   Use with:
   <link rel="stylesheet" href="css/global.css">
   <link rel="stylesheet" href="css/gallery.css">
*/

/* PAGE HEADER
   Shared with leaderboard-style pages, included here so Gallery does not need leaderboard.css.
*/
.page-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px 80px;
}

.page-header {
  padding: 60px 0 40px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, var(--ocean), transparent) 1;
  margin-bottom: 36px;
}

.page-eyebrow {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
  font-weight: 500;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(42px, 7vw, 64px);
  font-weight: 300;
  color: var(--cream);
  line-height: 1.1;
  margin-bottom: 16px;
}

.page-title em {
  font-style: italic;
  color: var(--gold);
}

.page-sub {
  font-size: 15px;
  color: var(--text2);
  font-weight: 300;
  line-height: 1.85;
}

/* GALLERY GRID */
.gallery-wrapper {
  position: relative;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-radius: 10px;
}

.gallery-wrapper::-webkit-scrollbar {
  display: none;
}

.gallery-track {
  display: flex;
  width: 100%;
}

.gallery-page {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.g-cell {
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  border: 0.5px solid var(--border);
  border-top: 1.5px solid var(--ocean);
}

.g-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.5s ease;
}

.g-cell:hover img {
  transform: scale(1.05);
}

/* HOVER CAPTION */
.g-caption {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(6, 16, 30, 0.88) 0%,
    rgba(6, 16, 30, 0.2) 55%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.g-cell:hover .g-caption {
  opacity: 1;
}

.g-caption-title {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--cream);
  line-height: 1.3;
}

.g-caption-sub {
  font-size: 10px;
  color: var(--text2);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* PLACEHOLDER CELLS */
.g-cell-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.g-placeholder-inner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ocean);
  opacity: 0.2;
}

/* GALLERY NAV */
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.g-arrow {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0.5px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
  user-select: none;
  font-family: inherit;
}

.g-arrow:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.g-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  border-color: var(--border);
}

.g-dots {
  display: flex;
  gap: 6px;
}

.g-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border2);
  transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}

.g-dot.active {
  background: var(--gold);
  transform: scale(1.3);
}

/* LIGHTBOX */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(4, 10, 20, 0.96);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 22px;
  color: var(--text2);
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
  z-index: 2;
  transition: color 0.2s;
  font-family: inherit;
  line-height: 1;
}

.lb-close:hover {
  color: var(--cream);
}

.lb-scroller {
  width: 100%;
  height: 80vh;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  align-items: center;
}

.lb-scroller::-webkit-scrollbar {
  display: none;
}

.lb-track {
  display: flex;
  align-items: center;
  padding: 0 13%;
  flex-shrink: 0;
}

.lb-slide {
  flex-shrink: 0;
  width: 68vw;
  max-width: 680px;
  height: 78vh;
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.lb-slide img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.lb-slide:not(.active) {
  opacity: 0.32;
  transform: scale(0.87);
}

.lb-slide.active {
  opacity: 1;
  transform: scale(1);
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0.5px solid var(--border2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text2);
  transition: all 0.2s;
  z-index: 2;
  font-family: inherit;
}

.lb-nav:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.lb-prev {
  left: 16px;
}

.lb-next {
  right: 16px;
}

.lb-footer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lb-caption {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: var(--cream);
  font-weight: 300;
}

.lb-counter {
  font-size: 11px;
  color: var(--text3);
  letter-spacing: 0.1em;
}

/* LIGHT MODE OVERRIDES */
body.light .lightbox {
  background: rgba(240, 236, 228, 0.97);
}

body.light .lb-close {
  color: var(--text2);
}

body.light .lb-caption {
  color: var(--text);
}

body.light .g-caption {
  background: linear-gradient(
    to top,
    rgba(240, 236, 228, 0.9) 0%,
    rgba(240, 236, 228, 0.3) 55%,
    transparent 100%
  );
}

body.light .g-caption-title {
  color: var(--text);
}

/* MOBILE */
@media (max-width: 600px) {
  .page-wrap {
    padding: 0 20px 60px;
  }

  .lb-slide {
    width: 88vw;
  }

  .lb-track {
    padding: 0 4%;
  }

  .lb-nav {
    display: none;
  }
}
