/* =========================================================
   Bontle & Desmond — Art Gallery
   Refined dark "gallery wall" theme.
   Mobile-first: base styles target phones; media queries widen
   spacing and photo tiles on larger screens.
   ========================================================= */

/* ---- Design tokens (change colours here in one place) ---- */
:root {
  --bg: #0e0e11;          /* deep near-black gallery wall   */
  --bg-soft: #16161b;     /* slightly lifted panels         */
  --gold: #c9a227;        /* warm gold accent               */
  --gold-soft: rgba(201, 162, 39, 0.35);
  --text: #f2f0ea;        /* warm off-white                 */
  --text-dim: #a7a39a;    /* muted captions / meta          */
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1200px;         /* gallery max width              */
  --band-h: 85vh;         /* shared height of the hero + footer video bands */
}

/* ---- Reset-ish base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

/* Visible focus states everywhere for keyboard users */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* =========================================================
   Looping background video (shared by hero + footer)
   ========================================================= */
.bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* fill the area, crop as needed */
  display: block;
  pointer-events: none;     /* clicks pass through; never pauses */
}

/* Hide every native control / play button so the video reads as pure
   background. NOTE: these pseudo-elements must target the bare `video`
   element — Safari frequently ignores them when scoped to a class, which
   is why the iOS play button can still show through a `.class::` selector.
   The only <video>s on this page are the background videos, so targeting
   `video` directly is safe. */
video::-webkit-media-controls,
video::-webkit-media-controls-enclosure,
video::-webkit-media-controls-panel,
video::-webkit-media-controls-panel-container,
video::-webkit-media-controls-play-button,
video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* =========================================================
   Hero / header
   ========================================================= */
.hero {
  position: relative;       /* anchor for the absolute video layer */
  overflow: hidden;
  text-align: center;
  /* Shared band height + centered content so the hero and footer video
     areas are exactly the same size. */
  min-height: var(--band-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem;
}

/* The video sits behind the title and fades out top + bottom into the
   page background, so there's no hard edge anywhere. */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;               /* video shows at full clarity */
  /* The only darkening is at the very top and bottom edges, where the
     video fades into the page background so there's no hard line. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 78%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 16%,
    #000 78%,
    transparent 100%
  );
}

.hero__content {
  position: relative;       /* above the video layer */
  z-index: 1;
  max-width: 40rem;
  margin: 0 auto;
  /* Soft shadow keeps the text legible over the (now clear) video
     without darkening the footage itself. */
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.75), 0 1px 4px rgba(0, 0, 0, 0.6);
}

.hero__eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
}

.hero__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 9vw, 4.75rem);
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
}

.hero__subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  color: var(--text-dim);
  margin: 0.4rem 0 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* The thin gold divider under the title */
.hero__divider {
  display: block;
  width: 64px;
  height: 2px;
  margin: 1.75rem auto;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold) 20%,
    var(--gold) 80%,
    transparent
  );
}

.hero__tagline {
  margin: 0;
  font-size: 1rem;
  font-style: italic;
  color: var(--text-dim);
  font-family: var(--serif);
}

/* =========================================================
   Gallery — sliding marquee rows
   The gallery is a stack of horizontal rows. Each row's track
   holds the row's photos TWICE in a row; the track is animated
   from 0 to -50%, so when the first copy scrolls off the second
   copy is exactly in its place — an endless seamless loop.
   Alternate rows scroll the opposite direction (see .row--reverse),
   giving the "top one way, below the other way" effect.
   ========================================================= */
.gallery {
  /* full-bleed: rows span the whole viewport width */
  width: 100%;
  padding: 0;                /* no bottom gap: footer video fades in directly */
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;          /* hide the off-screen parts of each track */
}

@media (min-width: 768px) {
  .gallery {
    gap: 1.5rem;
  }
}

/* One horizontal band. Clips its track horizontally. */
.row {
  overflow: hidden;
  width: 100%;
}

/* The moving strip of photos inside a row. width:max-content lets it
   grow as wide as all its (duplicated) photos need. */
.row__track {
  display: flex;
  width: max-content;
  will-change: transform;
  /* duration is set per-row from JS so every row glides at a calm,
     even pace regardless of how many photos it holds */
  animation-name: marquee;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

/* Even rows drift the other way by running the same animation backwards */
.row--reverse .row__track {
  animation-direction: reverse;
}

/* Move exactly one copy's width to the left, then loop. Because the
   track contains two identical copies, -50% lands seamlessly. */
@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* Pause the motion when the pointer is over a row (desktop), so it's
   easy to aim at a photo and click it. */
@media (hover: hover) and (pointer: fine) {
  .row:hover .row__track {
    animation-play-state: paused;
  }
}

/* Each photo in the strip. Every tile is the same fixed size (see below)
   and the image is cropped to fill it with object-fit: cover. The right
   margin is the gap between photos — kept on the element (not flex `gap`)
   so the two copies are pixel-identical and the -50% loop stays seamless. */
.cell {
  position: relative;
  flex: 0 0 auto;
  /* Every tile is the SAME size: a fixed width and a fixed 4:5 portrait
     shape. Bigger than before, and uniform across the whole gallery. */
  width: clamp(260px, 72vw, 360px);
  aspect-ratio: 4 / 5;
  margin-right: 1rem;
  padding: 0;
  border: none;
  background: var(--bg-soft);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

@media (min-width: 768px) {
  .cell {
    margin-right: 1.5rem;
  }
}

.cell__img {
  width: 100%;
  height: 100%;
  object-fit: cover;        /* fill the tile, cropping to keep one size */
  display: block;
  transition: transform 0.6s ease;
}

/* Soft gold frame + gentle zoom on hover (desktop only) */
@media (hover: hover) and (pointer: fine) {
  .cell:hover {
    box-shadow: 0 0 0 1px var(--gold-soft), 0 18px 40px rgba(0, 0, 0, 0.55);
  }
  .cell:hover .cell__img {
    transform: scale(1.05);
  }
}

/* Caption that fades up on hover/focus */
.cell__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.9rem 0.7rem;
  background: linear-gradient(
    to top,
    rgba(14, 14, 17, 0.92),
    rgba(14, 14, 17, 0)
  );
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.cell:hover .cell__overlay,
.cell:focus-visible .cell__overlay {
  opacity: 1;
  transform: translateY(0);
}

.cell__caption {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
}

/* Reduced motion: stop the auto-scroll and let people scroll each row
   by hand instead. */
@media (prefers-reduced-motion: reduce) {
  .row {
    overflow-x: auto;
  }
  .row__track {
    animation: none;
  }
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  position: relative;
  overflow: hidden;
  text-align: center;
  /* Same band height + centering as the hero, so the video is the same size */
  min-height: var(--band-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text-dim);
}

/* Footer video fades IN from the top (transparent at the very top) so the
   sliding photo rows above dissolve into it with no visible seam. */
.footer__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 1;               /* clear video; only the top edge fades to black */
  /* Mirror image of the hero mask, so the fade into the photos above is
     the same "divider" as the hero's fade into the photos below. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 22%,
    #000 84%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 22%,
    #000 84%,
    transparent 100%
  );
}

.footer__content {
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8), 0 1px 4px rgba(0, 0, 0, 0.6);
}

.footer__divider {
  display: block;
  width: 44px;
  height: 1px;
  margin: 0 auto 1.75rem;
  background: var(--gold-soft);
}

.footer__line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 0.35rem;
}

.footer__year {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
}

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox[hidden] {
  display: none;
}

/* Fade the whole overlay in when opened (.is-open added by JS) */
.lightbox {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.is-open {
  opacity: 1;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 8, 0.92);
  backdrop-filter: blur(2px);
}

.lightbox__figure {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(92vw, 1000px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--gold-soft), 0 30px 80px rgba(0, 0, 0, 0.7);
}

.lightbox__caption {
  text-align: center;
  margin-top: 1.1rem;
  max-width: 40rem;
}

.lightbox__cap-text {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--text);
}

/* Close + nav buttons share a soft circular style */
.lightbox__close,
.lightbox__nav {
  position: absolute;
  z-index: 2;
  background: rgba(20, 20, 25, 0.6);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease,
    border-color 0.25s ease;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: var(--gold);
  color: #1a1407;
  border-color: var(--gold);
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 46px;
  height: 46px;
  font-size: 1.8rem;
  line-height: 1;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox__nav--prev {
  left: 1rem;
}
.lightbox__nav--next {
  right: 1rem;
}

@media (min-width: 768px) {
  .lightbox__nav--prev {
    left: 2rem;
  }
  .lightbox__nav--next {
    right: 2rem;
  }
}

/* Prevent the page behind from scrolling while lightbox is open */
body.no-scroll {
  overflow: hidden;
}

/* =========================================================
   Reduced motion: honour users who prefer less animation
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
