/* =========================================
   Wedding style gallery hero ("One Space. Your Style.")
   Markup: template-parts/landing/style-gallery.php
   Loaded only where it is rendered (inc/wedding-styles.php).

   Desktop (900px+): three photographs. Position comes from data-slot:
     left 20% | center 60% (taller) | right 20%
   and moving a photograph between slots animates its box.
   Below 900px: one featured photograph (slots crossfade) plus thumbnails.
========================================= */

.pp2-gallery-hero {
  --pp2-gh-gold: var(--pp2-gold, #d8b57a);
  --pp2-gh-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --pp2-gh-speed: 550ms;
  --pp2-gh-gap: clamp(10px, 1.1vw, 18px);

  position: relative;
  z-index: 0;
  margin-top: 0;
  padding: clamp(104px, 12.5vh, 136px) 0 clamp(36px, 5vh, 64px);
  overflow: hidden;
  text-align: center;
  color: var(--pp2-text, #f6f1e9);
  /* Dark botanical: deep greens with a faint warm glow, no texture. */
  background:
    radial-gradient(110% 65% at 50% 0%, rgba(40, 68, 49, 0.5) 0%, rgba(7, 16, 12, 0) 62%),
    radial-gradient(55% 45% at 0% 100%, rgba(30, 54, 39, 0.38) 0%, rgba(7, 16, 12, 0) 72%),
    radial-gradient(50% 40% at 100% 85%, rgba(216, 181, 122, 0.06) 0%, rgba(7, 16, 12, 0) 72%),
    linear-gradient(180deg, #08130e 0%, #07100c 70%, #060b08 100%);
}

.pp2-interior-hero-wrap.pp2-gallery-hero {
  margin-top: 0;
}

/* ---------- Intro ---------- */
.pp2-gallery-hero__intro {
  position: relative;
  z-index: 1;
}

.pp2-gallery-hero__eyebrow {
  margin: 0 0 14px;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pp2-gh-gold);
}

.pp2-gallery-hero__title {
  margin: 0 auto;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(2.5rem, 4.4vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: #fbf6ee;
  text-wrap: balance;
}

.pp2-gallery-hero__text {
  max-width: 58ch;
  margin: 14px auto 0;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 1.6;
  color: rgba(246, 241, 233, 0.78);
  text-wrap: balance;
}

/* ---------- Gallery ---------- */
.pp2-gallery {
  position: relative;
  z-index: 1;
  width: min(94vw, 1480px);
  margin: clamp(22px, 3.4vh, 36px) auto 0;
}

.pp2-gallery__head {
  margin-bottom: clamp(12px, 1.8vh, 18px);
}

.pp2-gallery__eyebrow {
  margin: 0;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(246, 241, 233, 0.62);
}

.pp2-gallery__label {
  margin: 4px 0 0;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 1.4vw, 1.3rem);
  font-style: italic;
  line-height: 1.25;
  color: #f6f1e9;
}

/* Fixed height: nothing outside the stage moves when photographs swap.
   ~580px is everything else in the hero (navigation, copy, caption, buttons),
   so on typical desktop screens the buttons sit above the fold; the 320px
   floor keeps the photography large on short screens. */
.pp2-gallery__stage {
  position: relative;
  height: clamp(320px, min(calc(100svh - 580px), 40vw), 640px);
}

.pp2-gallery__panel {
  position: absolute;
  z-index: 1;
  display: block;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: #0d1711;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    left var(--pp2-gh-speed) var(--pp2-gh-ease),
    top var(--pp2-gh-speed) var(--pp2-gh-ease),
    width var(--pp2-gh-speed) var(--pp2-gh-ease),
    height var(--pp2-gh-speed) var(--pp2-gh-ease);
}

.pp2-gallery__panel:disabled {
  cursor: default;
}

.pp2-gallery__panel[data-slot="left"] {
  top: 9%;
  left: 0;
  width: calc(20% - var(--pp2-gh-gap));
  height: 82%;
}

.pp2-gallery__panel[data-slot="center"] {
  z-index: 2;
  top: 0;
  left: 20%;
  width: 60%;
  height: 100%;
  cursor: default;
}

.pp2-gallery__panel[data-slot="right"] {
  top: 9%;
  left: calc(80% + var(--pp2-gh-gap));
  width: calc(20% - var(--pp2-gh-gap));
  height: 82%;
}

.pp2-gallery__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pp2-sh-pos, 50% 50%);
  transition: filter 400ms ease, transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.pp2-gallery__panel:not([data-slot="center"]) .pp2-gallery__img {
  filter: brightness(0.8) saturate(0.92);
}

.pp2-gallery__panel:not([data-slot="center"]):hover .pp2-gallery__img,
.pp2-gallery__panel:not([data-slot="center"]):focus-visible .pp2-gallery__img {
  filter: none;
  transform: scale(1.03);
}

/* Side-panel name, on a short scrim at the foot of the photograph only. */
.pp2-gallery__name {
  position: absolute;
  inset: auto 0 0 0;
  padding: 48px 14px 14px;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fbf6ee;
  background: linear-gradient(to top, rgba(4, 8, 6, 0.62), rgba(4, 8, 6, 0));
  opacity: 1;
  transition: opacity 300ms ease 250ms;
}

.pp2-gallery__panel[data-slot="center"] .pp2-gallery__name {
  opacity: 0;
  transition-delay: 0ms;
}

/* Selected: one restrained gold rule along the foot of the photograph. */
.pp2-gallery__panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--pp2-gh-gold);
  opacity: 0;
  transition: opacity 300ms ease;
}

.pp2-gallery__panel[data-slot="center"]::after {
  opacity: 1;
  transition-delay: var(--pp2-gh-speed);
}

.pp2-gallery__panel:focus {
  outline: none;
}

.pp2-gallery__panel:focus-visible {
  outline: 2px solid var(--pp2-gh-gold);
  outline-offset: 4px;
}

/* Mobile thumbnails: hidden on desktop. */
.pp2-gallery__thumbs {
  display: none;
}

/* ---------- Caption + calls to action ---------- */
.pp2-gallery__footer {
  margin-top: clamp(16px, 2.4vh, 24px);
}

/* Captions share one grid cell, so the area is always as tall as the
   longest one and the buttons never move. */
.pp2-gallery__captions {
  display: grid;
}

.pp2-gallery__caption {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 350ms ease, visibility 0s linear 350ms;
}

.pp2-gallery__caption.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 400ms ease 150ms, visibility 0s;
}

.pp2-gallery__caption-name {
  margin: 0;
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pp2-gh-gold);
}

.pp2-gallery__caption-tagline {
  margin: 4px 0 0;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 1.6vw, 1.45rem);
  font-style: italic;
  line-height: 1.25;
  color: #fbf6ee;
}

.pp2-gallery__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: clamp(14px, 2.2vh, 22px);
}

/* ---------- Tablet ---------- */
@media (min-width: 900px) and (max-width: 1199px) {
  .pp2-gallery__stage {
    height: clamp(300px, min(calc(100svh - 560px), 44vw), 520px);
  }

  .pp2-gallery__name {
    padding: 40px 10px 10px;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }
}

/* ---------- Mobile + small tablet: one featured photograph ---------- */
@media (max-width: 899px) {
  .pp2-gallery-hero {
    padding: 96px 0 40px;
  }

  .pp2-gallery-hero__eyebrow {
    margin-bottom: 10px;
    font-size: 0.64rem;
    letter-spacing: 0.16em;
  }

  .pp2-gallery-hero__title {
    max-width: 14ch;
    font-size: clamp(2.2rem, 8.5vw, 3.4rem);
  }

  .pp2-gallery-hero__text {
    max-width: 36ch;
    font-size: 0.92rem;
  }

  .pp2-gallery {
    width: min(calc(100% - 32px), 640px);
    margin-top: 24px;
  }

  .pp2-gallery__label {
    font-size: 1.1rem;
  }

  .pp2-gallery__stage {
    height: auto;
    aspect-ratio: 4 / 3;
  }

  /* All photographs share the featured frame and crossfade. The outgoing
     one stays opaque underneath until the new one has faded in. */
  .pp2-gallery__panel,
  .pp2-gallery__panel[data-slot] {
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0s linear var(--pp2-gh-speed), visibility 0s linear var(--pp2-gh-speed);
  }

  .pp2-gallery__panel[data-slot="center"] {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--pp2-gh-speed) ease, visibility 0s;
  }

  .pp2-gallery__img {
    object-position: var(--pp2-sh-pos-m, var(--pp2-sh-pos, 50% 50%));
  }

  .pp2-gallery__name {
    display: none;
  }

  .pp2-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .pp2-gallery__thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin: 0;
    padding: 0 0 2px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: rgba(246, 241, 233, 0.74);
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .pp2-gallery__thumb:disabled {
    cursor: default;
  }

  .pp2-gallery__thumb-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 5px;
    background: #0d1711;
    transition: box-shadow 250ms ease;
  }

  .pp2-gallery__thumb-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.72;
    transition: opacity 250ms ease;
  }

  .pp2-gallery__thumb-name {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-wrap: balance;
  }

  /* Selected: gold ring, gold name and a short rule (shape, not just colour). */
  .pp2-gallery__thumb-name::after {
    content: "";
    display: block;
    width: 18px;
    height: 2px;
    margin: 5px auto 0;
    background: currentColor;
    opacity: 0;
  }

  .pp2-gallery__thumb[aria-pressed="true"] {
    color: var(--pp2-gh-gold);
  }

  .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-media {
    box-shadow: 0 0 0 2px #07100c, 0 0 0 4px var(--pp2-gh-gold);
  }

  .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-img {
    opacity: 1;
  }

  .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-name::after {
    opacity: 1;
  }

  .pp2-gallery__thumb:focus {
    outline: none;
  }

  .pp2-gallery__thumb:focus-visible {
    outline: 2px solid #fbf6ee;
    outline-offset: 4px;
  }

  .pp2-gallery-hero.is-loading .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-media {
    animation: pp2GalleryPulse 1.1s ease-in-out infinite;
  }

  .pp2-gallery__footer {
    margin-top: 16px;
  }

  .pp2-gallery__caption-tagline {
    font-size: 1.15rem;
  }
}

@keyframes pp2GalleryPulse {
  50% {
    box-shadow: 0 0 0 2px #07100c, 0 0 0 4px rgba(216, 181, 122, 0.35);
  }
}

@media (max-width: 640px) {
  .pp2-gallery__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pp2-gallery__actions .pp2-btn {
    width: 100%;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .pp2-gallery-hero {
    --pp2-gh-speed: 0ms;
  }

  .pp2-gallery__panel,
  .pp2-gallery__panel[data-slot],
  .pp2-gallery__img,
  .pp2-gallery__name,
  .pp2-gallery__panel::after,
  .pp2-gallery__caption,
  .pp2-gallery__caption.is-active,
  .pp2-gallery__thumb-media,
  .pp2-gallery__thumb-img {
    transition: none;
  }

  .pp2-gallery__panel:not([data-slot="center"]):hover .pp2-gallery__img,
  .pp2-gallery__panel:not([data-slot="center"]):focus-visible .pp2-gallery__img {
    transform: none;
  }

  .pp2-gallery-hero.is-loading .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-media {
    animation: none;
  }
}

/* Forced colours: keep the selected state visible. */
@media (forced-colors: active) {
  .pp2-gallery__panel[data-slot="center"],
  .pp2-gallery__thumb[aria-pressed="true"] .pp2-gallery__thumb-media {
    outline: 3px solid Highlight;
    outline-offset: 2px;
  }
}
