/* ===================================================================
   StrikePoint Laser Tag — gallery page styles.
   Loads after /pages.css and only adds what the gallery grid and the
   lightbox need. Colors, fonts, and spacing all come from pages.css.
   =================================================================== */

/* The gallery page leads with an h1; pages.css only styles h2.section-title. */
.gallery-page h1.section-title {
  font-family: 'Black Ops One', sans-serif;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.0;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
  color: var(--ink);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* The shared .section-intro is capped at 640px, which drops the final word of
   this sentence onto a line by itself on wide screens. Balanced wrapping plus a
   slightly wider cap evens the lines out. Scoped to .gallery-page so the FAQ
   and every other .section-intro on the site keep their existing behaviour. */
.gallery-page .section-intro {
  max-width: 46rem;
  text-wrap: balance;
}

/* ============ GRID ============ */
/* Fixed column counts, never masonry: 3 wide / 2 tablet / 1 phone. */
.gallery-grid {
  list-style: none;
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.gallery-grid .shot { min-width: 0; }
.gallery-grid figure {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.gallery-grid figure:hover { border-color: var(--blue); transform: translateY(-4px); }

.shot-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.shot-trigger:focus-visible { outline: 3px solid var(--blue-glow); outline-offset: 3px; }

/* height:auto keeps every photograph at its natural aspect ratio while the
   width/height attributes still reserve the right box before load. */
.gallery-grid img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-grid figcaption {
  padding: 16px 20px 20px;
  margin-top: auto;              /* captions line up along the bottom of each row */
  color: var(--ink-dim);
  font-size: 15px;
  line-height: 1.6;
}

.gallery-cta { display: flex; justify-content: center; margin-top: 56px; }

/* .btn-primary lives in the homepage's inline stylesheet, so the shared
   definition is copied here the same way pages.css copies components. */
.btn-primary {
  background: var(--red); color: white; border: none;
  padding: 18px 36px; font-family: 'Oswald', sans-serif; font-weight: 700;
  font-size: 16px; text-transform: uppercase; letter-spacing: 0.16em;
  cursor: pointer; text-decoration: none; position: relative;
  display: inline-block;
  box-shadow: 0 0 0 1px var(--red), 0 8px 32px rgba(255,42,60,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: all 0.2s;
}
.btn-primary:hover {
  background: var(--red-glow);
  box-shadow: 0 0 0 1px var(--red-glow), 0 12px 48px rgba(255,69,84,0.6), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-2px);
}
.btn-primary:focus-visible { outline: 3px solid var(--blue-glow); outline-offset: 3px; }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 7, 13, 0.92);
  backdrop-filter: blur(6px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lightbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.lightbox-counter {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--ink-mute); letter-spacing: 0.2em; text-transform: uppercase;
}

/* Every control clears the 44 x 44 CSS pixel minimum touch target. */
.lightbox-btn {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px;
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink);
  background: rgba(17, 26, 46, 0.92);
  border: 1px solid var(--line-bright);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.lightbox-btn:hover { background: rgba(30, 136, 255, 0.16); border-color: var(--blue); }
.lightbox-btn:focus-visible { outline: 3px solid var(--blue-glow); outline-offset: 3px; }
.lightbox-close span[aria-hidden] { font-size: 24px; line-height: 1; }
.lightbox-btn-text { line-height: 1; }

.lightbox-stage {
  display: flex; align-items: center; gap: 12px;
  min-height: 0;
}
.lightbox-nav {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  padding: 0;
  font-size: 30px; line-height: 1;
}

.lightbox-figure {
  flex: 1 1 auto;
  min-width: 0;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  width: auto; height: auto;      /* natural aspect ratio, never stretched */
  border: 1px solid var(--line-bright);
  background: var(--bg-1);
}
.lightbox-figure figcaption {
  color: var(--ink-dim);
  font-size: 15px; line-height: 1.6; text-align: center;
  max-width: 720px;
}

/* ============ RESPONSIVE ============ */
/* Three columns leave the thirteenth photograph alone in the final row, so it
   moves to the middle column. The :last-child guard keeps this from firing if
   the photograph count ever changes; two- and one-column layouts are untouched
   and keep normal document order. */
@media (min-width: 1025px) {
  .gallery-grid .shot:nth-child(13):last-child { grid-column: 2; }
}

/* 1024px keeps landscape tablets on two columns, which is wider than the
   site's usual 980px layout breakpoint and applies to the gallery only. */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: 1fr; margin-top: 40px; }
  .gallery-cta { margin-top: 40px; }
  .gallery-cta .btn-primary {
    width: 100%; text-align: center;
    padding-left: 20px; padding-right: 20px;
  }
  .lightbox { padding: 12px; }
  /* Controls move below the photograph so the image keeps the full width. */
  .lightbox-stage { flex-wrap: wrap; justify-content: center; }
  .lightbox-figure { order: -1; flex: 1 0 100%; }
  .lightbox-figure img { max-height: 60vh; }
  .lightbox-nav { width: 64px; height: 48px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .gallery-grid figure,
  .shot-trigger,
  .lightbox-btn,
  .btn-primary {
    transition: none;
  }
  .gallery-grid figure:hover { transform: none; }
  .btn-primary:hover { transform: none; }
}
