/* Editorial gallery layer. Loaded after the shared site styles. */
body.gallery-page {
  --gallery-ink: #080706;
  --gallery-cream: #f5efe6;
  --gallery-gold: #d4b26a;
  background: var(--gallery-ink);
  color: var(--gallery-cream);
}

body.gallery-page a { color: inherit; }
body.gallery-page :where(a, button):focus-visible {
  outline: 2px solid var(--gallery-gold);
  outline-offset: 5px;
}

body.gallery-page .gallery-hero {
  position: relative;
  min-height: max(650px, calc(100svh - 130px));
  isolation: isolate;
  display: grid;
  align-items: end;
  overflow: clip;
  background: #12100d;
}
body.gallery-page .gallery-hero > img,
body.gallery-page .gallery-hero > picture {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}
body.gallery-page .gallery-hero > img { object-fit: cover; }
body.gallery-page .gallery-hero > picture img {
  width: 100%; height: 100%; object-fit: cover;
}
body.gallery-page .gallery-hero::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,7,6,.08) 20%, rgba(8,7,6,.82) 82%, var(--gallery-ink) 100%);
}
body.gallery-page .gallery-hero .gallery-title {
  position: relative;
  z-index: 2;
  width: min(100% - 3rem, 88rem);
  margin: 0 auto;
  padding: clamp(8rem, 22vh, 14rem) 0 4.5rem;
}
body.gallery-page .gallery-title h1 {
  max-width: 12ch;
  margin: .2rem 0 1rem;
  color: var(--gallery-cream);
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(4rem, 11vw, 11rem);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: .84;
  text-wrap: balance;
}
body.gallery-page .gallery-title .eyebrow,
body.gallery-page .gallery-intro .eyebrow,
body.gallery-page .gallery-feature .eyebrow {
  color: var(--gallery-gold);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}
body.gallery-page .gallery-title a { color: var(--gallery-cream); }
body.gallery-page .gallery-hero-note {
  position: absolute;
  z-index: 2;
  right: max(1.5rem, calc((100% - 88rem) / 2));
  bottom: 2rem;
  max-width: 15rem;
  color: rgba(245,239,230,.72);
  font-size: .78rem;
  line-height: 1.45;
  text-align: right;
}

body.gallery-page .gallery-intro {
  width: min(100% - 3rem, 88rem);
  margin: 0 auto;
  padding: clamp(6rem, 13vw, 12rem) 0 clamp(4rem, 8vw, 8rem);
}
body.gallery-page .gallery-intro h2 {
  max-width: 14ch;
  margin: .8rem 0 1.5rem;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.6rem, 6vw, 6.5rem);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: .94;
}
body.gallery-page .gallery-intro > p:last-child {
  max-width: 39rem;
  color: rgba(245,239,230,.72);
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  line-height: 1.55;
}

body.gallery-page .gallery-story {
  width: min(100% - 3rem, 88rem);
  margin: 0 auto;
  padding-bottom: clamp(7rem, 16vw, 15rem);
}
body.gallery-page .gallery-feature {
  position: relative;
  width: min(66%, 53rem);
  margin: 0 0 clamp(5rem, 13vw, 12rem);
}
body.gallery-page .gallery-feature:nth-child(even) {
  width: min(53%, 43rem);
  margin-top: clamp(1rem, 8vw, 8rem);
  margin-left: auto;
}
body.gallery-page .gallery-feature:nth-child(3n) { width: min(76%, 60rem); }
body.gallery-page .gallery-feature:nth-child(4) { width: 100%; margin-left: 0; }
body.gallery-page .gallery-feature > a { display: block; position: relative; }
body.gallery-page .gallery-feature img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.35 / 1;
  object-fit: cover;
  background: #17130f;
}
body.gallery-page .gallery-feature:nth-child(even) img { aspect-ratio: .9 / 1; }
body.gallery-page .gallery-feature:nth-child(3n) img { aspect-ratio: 1.7 / 1; }
body.gallery-page .gallery-feature:nth-child(4) img { aspect-ratio: 16 / 9; }
body.gallery-page .gallery-open {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  padding: .7rem .85rem;
  background: rgba(8,7,6,.76);
  color: var(--gallery-cream);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
body.gallery-page .gallery-feature figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(212,178,106,.48);
}
body.gallery-page .gallery-feature h3 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.2rem, 2vw, 2rem);
  font-weight: 400;
  line-height: 1.1;
}
body.gallery-page .gallery-finale {
  width: min(100% - 3rem, 88rem);
  margin: 0 auto;
  padding: 0 0 8rem;
}
body.gallery-page .gallery-finale h2 { font-family: Fraunces, Georgia, serif; font-size: clamp(2rem, 5vw, 5rem); font-weight: 400; }
body.gallery-page .gallery-finale > div { display:flex; flex-wrap:wrap; gap:24px; margin-top:36px; align-items:center; }

/* Progressive reveal: without JavaScript the content stays fully visible. */
html.js body.gallery-page .gallery-feature { opacity: 1; transform: translateY(1.5rem); transition: transform .7s ease; }
html.js body.gallery-page .gallery-feature.is-visible { transform: none; }

.photo-viewer {
  width: min(calc(100vw - 1.5rem), 96rem);
  height: min(calc(100svh - 1.5rem), 60rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gallery-cream);
}
body.gallery-page:has(.photo-viewer[open]) { overflow: hidden; }
.photo-viewer::backdrop { background: rgba(8,7,6,.93); backdrop-filter: blur(10px); }
.photo-viewer__scrim { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; cursor: default; }
.photo-viewer__frame { position: relative; z-index: 1; display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem; align-items: center; width: 100%; height: 100%; }
.photo-viewer__media { display: grid; place-items: center; min-width: 0; height: 100%; margin: 0; }
.photo-viewer__media img { display: block; width: 100%; height: min(82svh, 52rem); object-fit: contain; }
.photo-viewer button:not(.photo-viewer__scrim) { min-width: 2.75rem; min-height: 2.75rem; border: 1px solid rgba(212,178,106,.7); background: rgba(8,7,6,.74); color: var(--gallery-cream); cursor: pointer; }
.photo-viewer__close { position: absolute; z-index: 2; top: .75rem; right: .75rem; font-size: 1.4rem; }
.photo-viewer__prev, .photo-viewer__next { position: relative; z-index: 2; font-size: 1.3rem; }
.photo-viewer__caption { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0 0; color: rgba(245,239,230,.78); font-size: .82rem; }
.photo-viewer__count { color: var(--gallery-gold); font-family: "IBM Plex Mono", ui-monospace, monospace; white-space: nowrap; }

@media (max-width: 700px) {
  body.gallery-page .gallery-hero { min-height: max(560px, calc(100svh - 126px)); }
  body.gallery-page .gallery-hero .gallery-title { width: calc(100% - 2rem); padding-bottom: 3rem; }
  body.gallery-page .gallery-hero-note { right: 1rem; bottom: .8rem; font-size: .66rem; }
  body.gallery-page .gallery-intro, body.gallery-page .gallery-story, body.gallery-page .gallery-finale { width: calc(100% - 2rem); }
  body.gallery-page .gallery-feature, body.gallery-page .gallery-feature:nth-child(even), body.gallery-page .gallery-feature:nth-child(3n), body.gallery-page .gallery-feature:nth-child(4) { width: 100%; margin-top: 0; margin-left: 0; }
  .photo-viewer { width: calc(100vw - .75rem); height: calc(100svh - .75rem); }
  .photo-viewer__frame { grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem; }
  .photo-viewer__media img { height: 72svh; }
}
@media (prefers-reduced-motion: reduce) {
  html.js body.gallery-page .gallery-feature { opacity: 1; transform: none; transition: none; }
}
