/* Gallery page presentation. The homepage remains the authority for tokens,
   header, typography, buttons, final CTA and footer. */

.gallery-page {
  color: var(--home-ink);
  background: var(--home-paper);
}

.gallery-page main :is(.gallery-hero, .gallery-media-section, .gallery-video-section, .gallery-project-break, .site-final-cta) .eyebrow {
  color: var(--home-gold) !important;
  -webkit-text-fill-color: var(--home-gold) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.15em !important;
  text-transform: uppercase;
}

.gallery-page .gallery-wide-shell {
  width: min(calc(100% - 80px), 1400px) !important;
  max-width: 1400px !important;
}

/* Full first viewport, using the homepage header-stack calculations. */
html body.gallery-page main .gallery-hero.page-hero {
  position: relative;
  min-height: calc(100vh - 150px) !important;
  min-height: calc(100svh - 150px) !important;
  display: grid !important;
  place-items: center;
  padding: 0 !important;
  background-image:
    linear-gradient(180deg, rgba(7, 8, 8, 0.35), rgba(7, 8, 8, 0.2) 48%, rgba(7, 8, 8, 0.5)),
    var(--hero-desktop) !important;
  background-position: var(--hero-position, center center) !important;
  background-size: cover !important;
}

.gallery-page main .gallery-hero > .shell {
  display: grid;
  width: min(calc(100vw - 72px), 1500px) !important;
  max-width: 1500px !important;
  min-height: inherit;
  place-items: center;
}

.gallery-page main .gallery-hero .hero-copy {
  width: min(100%, 1120px) !important;
  max-width: 1120px !important;
  margin-inline: auto !important;
  padding-block: 48px;
  text-align: center;
}

.gallery-page main .gallery-hero .hero-eyebrow {
  display: block;
  margin-bottom: 22px !important;
  font-size: 15px !important;
  letter-spacing: 0.09em !important;
}

.gallery-page main .gallery-hero h1 {
  max-width: 1120px !important;
  margin: 0 auto !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: clamp(60px, 5vw, 78px) !important;
  font-weight: 700 !important;
  line-height: 1.02 !important;
  letter-spacing: -0.04em !important;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.35);
}

.gallery-page main .gallery-hero .hero-copy > p {
  max-width: 760px !important;
  margin: 26px auto 0 !important;
  color: rgba(255, 255, 255, 0.84) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.84) !important;
  font-size: 17px !important;
  line-height: 1.6 !important;
}

/* Dynamic gallery content. */
.gallery-page main .gallery-media-section {
  padding-block: clamp(90px, 6vw, 108px) !important;
  background: var(--home-paper) !important;
}

.gallery-page main :is(.gallery-media-section, .gallery-video-section) .section-head {
  max-width: 790px;
  margin: 0 auto 42px !important;
  text-align: center;
}

.gallery-page main :is(.gallery-media-section, .gallery-video-section) .section-head .eyebrow {
  display: block;
  margin-bottom: 16px !important;
}

.gallery-page main :is(.gallery-media-section, .gallery-video-section) .section-head h2 {
  margin: 0 !important;
  color: var(--home-ink) !important;
  -webkit-text-fill-color: var(--home-ink) !important;
  font-size: clamp(42px, 3.4vw, 52px) !important;
  line-height: 1.08 !important;
  letter-spacing: -0.035em !important;
}

.gallery-page main :is(.gallery-media-section, .gallery-video-section) .section-head p {
  max-width: 720px;
  margin: 20px auto 0 !important;
  color: #5f5b54 !important;
  font-size: 16px !important;
  line-height: 1.65 !important;
}

.gallery-page .gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px !important;
}

.gallery-page .gallery-category-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 34px;
}

.gallery-page .gallery-category-filters a {
  padding: 10px 15px;
  color: #252522;
  border: 1px solid rgba(16, 17, 16, .2);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.gallery-page .gallery-category-filters a:hover,
.gallery-page .gallery-category-filters a:focus-visible,
.gallery-page .gallery-category-filters a.is-active {
  color: #10110f;
  background: var(--home-gold, #fcbc4d);
  border-color: var(--home-gold, #fcbc4d);
}

.gallery-page .gallery-item {
  position: relative;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border: 0 !important;
  border-radius: 4px;
  background: #111;
  box-shadow: none !important;
}

.gallery-page .gallery-item-trigger {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  color: #fff;
  text-decoration: none;
  overflow: hidden;
}

.gallery-page .gallery-item-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 42%, rgba(7, 8, 8, 0.76) 100%);
  transition: background-color 200ms ease;
}

.gallery-page .gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0 !important;
  object-fit: cover;
  transition: transform 220ms ease;
}

.gallery-page .gallery-video-item video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: #111;
}

.gallery-page .gallery-item figcaption {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 24px;
  color: #fff;
}

.gallery-page .gallery-item figcaption small {
  color: var(--home-gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.gallery-page .gallery-item figcaption strong {
  color: #fff;
  font-family: var(--fds-font-heading);
  font-size: clamp(18px, 1.4vw, 22px);
  line-height: 1.2;
}

.gallery-page .gallery-item figcaption span {
  display: -webkit-box;
  max-width: 52ch;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.gallery-page .gallery-item-trigger:hover img,
.gallery-page .gallery-item-trigger:focus-visible img {
  transform: scale(1.035);
}

.gallery-page .gallery-item-trigger:hover::after,
.gallery-page .gallery-item-trigger:focus-visible::after {
  background-color: rgba(7, 8, 8, 0.13);
}

.gallery-page .gallery-item-trigger:focus-visible {
  outline: 2px solid var(--home-gold);
  outline-offset: -4px;
}

.gallery-page .gallery-empty-state {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 46px 24px;
  border: 1px solid var(--home-line);
  color: #5f5b54;
  background: #fff;
  text-align: center;
}

.gallery-page .gallery-empty-state .btn { margin-top: 18px; }

.gallery-page .gallery-pagination {
  justify-content: center;
}

/* Dark visual break. */
.gallery-page main .gallery-project-break {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding-block: clamp(82px, 6vw, 104px) !important;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(8, 9, 9, 0.91), rgba(8, 9, 9, 0.78)),
    url('/assets/images/fire-and-dine/heroes/hero-02-craftsmanship-1916.webp') center center / cover no-repeat !important;
  border-top: 1px solid rgba(252, 188, 77, 0.28);
}

.gallery-page .gallery-project-break > .shell {
  max-width: 880px !important;
  text-align: center;
}

.gallery-page .gallery-project-break .eyebrow {
  display: block;
  margin-bottom: 16px;
}

.gallery-page .gallery-project-break h2 {
  margin: 0 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: clamp(42px, 3.4vw, 52px) !important;
  line-height: 1.08 !important;
  letter-spacing: -0.035em !important;
}

.gallery-page .gallery-project-break p {
  max-width: 680px;
  margin: 20px auto 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 16px;
  line-height: 1.65;
}

/* Dynamic videos retain their existing source and playback behaviour. */
.gallery-page main .gallery-video-section {
  padding-block: clamp(90px, 6vw, 108px) !important;
  color: #fff;
  background: #101110 !important;
}

.gallery-page main .gallery-video-section .section-head h2 {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.gallery-page main .gallery-video-section .section-head p {
  color: rgba(255, 255, 255, 0.7) !important;
}

.gallery-page .gallery-video-section .gallery-pagination {
  border-top-color: rgba(252, 188, 77, 0.22);
  color: #fff;
}

.gallery-page .gallery-video-section .gallery-pagination a,
.gallery-page .gallery-video-section .fd-pagination-current {
  border-color: rgba(252, 188, 77, 0.32);
}

.gallery-page .gallery-video-section .gallery-pagination a:hover,
.gallery-page .gallery-video-section .gallery-pagination a:focus-visible {
  border-color: var(--home-gold);
}

.gallery-page .gallery-video-section .fd-pagination-current {
  color: var(--home-ink);
  background: var(--home-gold);
}

.gallery-page .gallery-video-section .fd-pagination-gap {
  color: rgba(255, 255, 255, 0.68);
}

.gallery-page .gallery-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 1240px);
  margin-inline: auto;
  gap: 26px;
}

.gallery-page .gallery-video-grid.is-single {
  width: min(100%, 760px);
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
}

.gallery-page .gallery-video {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(252, 188, 77, 0.22);
  border-radius: 4px;
  background: #191a18;
}

.gallery-page .gallery-video-frame,
.gallery-page .gallery-video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background: #111;
}

.gallery-page .gallery-video-frame { overflow: hidden; }
.gallery-page .gallery-video-frame iframe,
.gallery-page .gallery-video-frame video { display: block; width: 100%; height: 100%; }
.gallery-page .gallery-video video { object-fit: contain; }
.gallery-page .gallery-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 2px solid var(--home-gold);
  border-radius: 50%;
  color: var(--home-ink);
  background: var(--home-gold);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}
.gallery-page .gallery-video-frame:focus-within .gallery-video-play,
.gallery-page .gallery-video-frame.is-playing .gallery-video-play {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}
.gallery-page .gallery-video figcaption { margin: 0; padding: 20px 22px; }
.gallery-page .gallery-video figcaption small {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--home-gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.gallery-page .gallery-video figcaption strong { display: block; color: #fff; font-size: 18px; }
.gallery-page .gallery-video figcaption span { display: block; margin-top: 5px; color: rgba(255, 255, 255, 0.68); line-height: 1.6; }
.gallery-page .gallery-video-empty {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 34px 24px;
  border: 1px solid rgba(252, 188, 77, 0.22);
  color: rgba(255, 255, 255, 0.7);
  background: #191a18;
  text-align: center;
}

/* Native lightbox; no external viewer dependency. */
.gallery-page.gallery-lightbox-open { overflow: hidden; }

.gallery-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  background: rgba(7, 8, 8, 0.96);
}

.gallery-lightbox::backdrop { background: rgba(7, 8, 8, 0.96); }

.gallery-lightbox-inner {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  width: 100%;
  height: 100%;
  align-items: center;
  gap: 18px;
  padding: 72px 32px 32px;
}

.gallery-lightbox figure {
  display: grid;
  max-width: 1400px;
  max-height: calc(100vh - 104px);
  margin: auto;
  justify-items: center;
}

.gallery-lightbox figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
}

.gallery-lightbox figcaption {
  width: min(100%, 920px);
  margin-top: 16px;
  text-align: center;
}

.gallery-lightbox figcaption span,
.gallery-lightbox figcaption strong { display: block; }
.gallery-lightbox figcaption span { color: var(--home-gold); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; }
.gallery-lightbox figcaption strong { margin-top: 5px; color: #fff; font-size: 20px; }
.gallery-lightbox figcaption p { margin: 5px auto 0; color: rgba(255, 255, 255, 0.7); font-size: 14px; line-height: 1.55; }
.gallery-lightbox figcaption p:empty { display: none; }

.gallery-lightbox button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(252, 188, 77, 0.66);
  border-radius: 50%;
  color: var(--home-gold);
  background: rgba(8, 9, 9, 0.7);
  cursor: pointer;
}

.gallery-lightbox button:hover,
.gallery-lightbox button:focus-visible {
  color: var(--home-ink);
  background: var(--home-gold);
}

.gallery-lightbox-close { position: absolute; z-index: 2; top: 20px; right: 24px; }
.gallery-lightbox-nav { justify-self: center; }

/* Closing CTA inherits the homepage image, height, spacing and buttons. */
.gallery-page .site-final-cta .btn { min-width: 190px; }

@media (max-width: 1180px) {
  html body.gallery-page main .gallery-hero.page-hero {
    min-height: calc(100vh - 118px) !important;
    min-height: calc(100svh - 118px) !important;
    background-image:
      linear-gradient(180deg, rgba(7, 8, 8, 0.38), rgba(7, 8, 8, 0.24) 48%, rgba(7, 8, 8, 0.54)),
      var(--hero-tablet) !important;
  }

  .gallery-page main .gallery-hero h1 { font-size: clamp(54px, 6vw, 68px) !important; }
  .gallery-page .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-page .gallery-item { aspect-ratio: 4 / 3; }
}

@media (max-width: 820px) {
  html body.gallery-page main .gallery-hero.page-hero {
    min-height: calc(100vh - 110px) !important;
    min-height: calc(100svh - 110px) !important;
  }

  .gallery-page main .gallery-hero h1 { font-size: 54px !important; }
  .gallery-page .gallery-wide-shell { width: calc(100% - 48px) !important; }
  .gallery-page .gallery-video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .gallery-lightbox-inner {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    gap: 8px;
    padding-inline: 14px;
  }
}

@media (max-width: 600px) {
  html body.gallery-page main .gallery-hero.page-hero {
    min-height: max(580px, calc(100svh - 100px)) !important;
    background-image:
      linear-gradient(rgba(7, 8, 8, 0.4), rgba(7, 8, 8, 0.58)),
      var(--hero-mobile) !important;
  }

  .gallery-page main .gallery-hero > .shell,
  .gallery-page .gallery-wide-shell {
    width: calc(100% - 40px) !important;
  }

  .gallery-page main .gallery-hero .hero-copy { padding-block: 42px; }
  .gallery-page main .gallery-hero h1 { font-size: clamp(40px, 11vw, 52px) !important; }
  .gallery-page main .gallery-hero .hero-eyebrow { font-size: 11px !important; }
  .gallery-page main .gallery-hero .hero-copy > p { font-size: 15px !important; }

  .gallery-page main :is(.gallery-media-section, .gallery-video-section) {
    padding-block: 72px !important;
  }

  .gallery-page main :is(.gallery-media-section, .gallery-video-section) .section-head h2,
  .gallery-page .gallery-project-break h2 {
    font-size: clamp(34px, 9.5vw, 42px) !important;
  }

  .gallery-page .gallery-grid { grid-template-columns: minmax(0, 1fr); gap: 16px !important; }
  .gallery-page .gallery-item { min-height: 0; aspect-ratio: 4 / 3; }
  .gallery-page .gallery-item figcaption { padding: 18px; }
  .gallery-page .gallery-item figcaption span { display: none; }
  .gallery-page .gallery-video-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .gallery-page .gallery-video-play { width: 54px; height: 54px; }
  .gallery-page main .gallery-project-break { min-height: 390px; padding-inline: 20px !important; }

  .gallery-lightbox-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) 48px;
    align-items: center;
    gap: 12px;
    padding: 68px 16px 18px;
  }

  .gallery-lightbox figure { grid-column: 1 / -1; max-height: calc(100vh - 140px); }
  .gallery-lightbox figure img { max-height: calc(100vh - 230px); }
  .gallery-lightbox-nav { position: static; width: 100% !important; border-radius: 3px !important; }
  .gallery-lightbox-prev { grid-column: 1; grid-row: 2; }
  .gallery-lightbox-next { grid-column: 2; grid-row: 2; }
  .gallery-lightbox-close { top: 12px; right: 16px; }
  .gallery-page .site-final-cta .btn { min-width: 0; }
}

@media (max-width: 390px) {
  .gallery-page main .gallery-hero h1 { font-size: 38px !important; }
  .gallery-page main .gallery-hero .hero-copy > p { font-size: 14px !important; }
}

@media (hover: none) {
  .gallery-page .gallery-item-trigger::after {
    background: linear-gradient(180deg, transparent 36%, rgba(7, 8, 8, 0.8) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-page .gallery-item img { transition: none; }
}
