/* ============================================================
   CONTENT GALLERY (canonical gallery → pager + softbox)
   ============================================================ */

/* Without JavaScript every authored slide remains reachable in a native
   horizontal scroller. Enhancement adds controls, never access to content. */
.content-gallery {
  display: block;
}
.content-gallery[data-gallery-columns="1"] { --gallery-columns: 1; }
.content-gallery[data-gallery-columns="2"] { --gallery-columns: 2; }
.content-gallery[data-gallery-columns="3"] { --gallery-columns: 3; }
.content-gallery[data-gallery-columns="4"] { --gallery-columns: 4; }
.content-gallery[data-gallery-columns="5"] { --gallery-columns: 5; }
.content-gallery[data-gallery-columns="6"] { --gallery-columns: 6; }
.content-gallery[data-gallery-columns="7"] { --gallery-columns: 7; }
.content-gallery[data-gallery-columns="8"] { --gallery-columns: 8; }
.content-gallery[data-gallery-enhance="pager"]:not(.is-pager) {
  display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: max(12rem, calc(100% - 52px));
  gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
}
.content-gallery[data-gallery-enhance="pager"]:not(.is-pager) > .gallery-bar-label { grid-row: 1; grid-column: 1 / -1; }
.content-gallery[data-gallery-enhance="pager"]:not(.is-pager) > .content-gallery-item { grid-row: 2; margin: 0; scroll-snap-align: start; }
.content-gallery[data-gallery-enhance="pager"]:not(.is-pager) .gallery-authored-copy { position: static; display: block; color: inherit; background: none; padding: .75rem 0; }
.content-gallery[data-gallery-enhance="pager"]:not(.is-pager) .gallery-authored-copy :is(p,h2,h3,h4) { display: block; color: inherit; text-shadow: none; overflow: visible; }
.content-gallery:not(.is-pager) .content-gallery-link img { aspect-ratio: 16 / 10; object-fit: cover; }
.gallery-hero .content-gallery:not(.is-pager) .content-gallery-link img { aspect-ratio: 16 / 9; }
.article-body .content-gallery .content-gallery-item { margin: 0; }
.content-gallery img { display: block; width: 100%; height: auto; background: var(--paper-2, #f1f1ee); }
.content-gallery figcaption {
  padding-top: 8px;
}
.content-gallery[data-gallery-layout="grid"] { display: grid; grid-template-columns: repeat(var(--gallery-columns, 2), minmax(0, 1fr)); gap: 14px; }
.content-gallery[data-gallery-layout="masonry"] { columns: var(--gallery-columns, 2); column-gap: 14px; }
.wp-block-gallery.has-nested-images.content-gallery:is([data-gallery-layout="grid"], [data-gallery-layout="masonry"]) > figure.wp-block-image.content-gallery-item:not(#individual-image) {
  width: 100%;
  min-width: 0;
}
.content-gallery[data-gallery-layout="masonry"] > .content-gallery-item { break-inside: avoid; margin-block-end: 14px; }
.content-gallery > .blocks-gallery-caption { grid-column: 1 / -1; column-span: all; }

/* hydrated: scroll-snap pager with per-slide text cards */
.content-gallery.is-pager { display: block; }
.gallery-stage {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.gallery-stage::-webkit-scrollbar { display: none; }
.is-pager .content-gallery-item {
  position: relative;
  flex: 0 0 calc(100% - 52px);
  min-width: 0;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
}
/* caption text moves onto the image; keep the semantic figcaption for no-JS */
.is-pager .content-gallery-item > figcaption { display: none; }
.is-pager .content-gallery-link { position: relative; display: block; background: var(--paper-2, #f1f1ee); }
/* uniform aspect frame so the overlay always sits on the photo itself;
   the softbox shows the uncropped file */
.is-pager :is(.content-gallery-link img, .content-gallery-item > img) {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.gallery-open {
  --gallery-open-drop: 8px;
  position: absolute;
  z-index: 4;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  background: var(--ink, #171717);
  box-shadow: var(--gallery-open-drop) var(--gallery-open-drop) 0 var(--y, #ffe100);
  color: var(--paper, #ffffff);
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow .14s var(--ease, ease), translate .14s var(--ease, ease);
}
.gallery-open:hover {
  translate: calc(-50% + 3px) calc(-50% + 3px);
  box-shadow: calc(var(--gallery-open-drop) - 3px) calc(var(--gallery-open-drop) - 3px) 0 var(--y, #ffe100);
}
.gallery-open:active {
  translate: calc(-50% + var(--gallery-open-drop)) calc(-50% + var(--gallery-open-drop));
  box-shadow: 0 0 0 var(--y, #ffe100);
}
.gallery-open:focus-visible { outline: 3px solid var(--y, #ffe100); outline-offset: 4px; }

/* on-image text: gradient-masked blur + scrim, then label and boxed title */
.gallery-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 64px 16px 15px;
  display: block;
  pointer-events: none;
}
.gallery-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 12, 12, 0) 0%, rgba(12, 12, 12, 0.34) 58%, rgba(12, 12, 12, 0.5) 100%);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 52%, #000 94%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.55) 52%, #000 94%);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .gallery-overlay::before {
    background: linear-gradient(180deg, rgba(12, 12, 12, 0) 0%, rgba(12, 12, 12, 0.55) 55%, rgba(12, 12, 12, 0.78) 100%);
  }
}
.gallery-overlay > * { position: relative; }
.gallery-overlay-label {
  margin: 0 0 9px;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.gallery-overlay-label .num:first-of-type { color: var(--y, #ffe100); }
.gallery-overlay-title {
  display: inline;
  max-width: 32ch;
  margin: 0;
  padding: 0.16em 0.45em 0.2em;
  background: var(--y, #ffe100);
  color: var(--on-accent, var(--ink, #171717));
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.gallery-overlay-title.contextus-gallery-generated-text {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

/* lead gallery: the gallery IS the story — wider than a lead image would be,
   hierarchy carried by scale and spacing, not rules */
.gallery-lead {
  max-width: 1280px;
  margin: 0 auto;
}
.gallery-hero .gallery-bar { margin-bottom: 14px; }
.gallery-hero .gallery-bar-label {
  color: var(--ink, #171717);
}
.gallery-hero .is-style-gallery-heading { font-size: 13px; letter-spacing: .16em; }
.gallery-hero :is(.content-gallery-link img, .content-gallery-item > img) { aspect-ratio: 16 / 9; }
.gallery-hero .gallery-overlay { padding-top: 110px; }
.gallery-hero .gallery-overlay-title { max-width: 38ch; font-size: 22px; }
.gallery-hero .gallery-overlay-sub { font-size: 16px; }
.gallery-overlay-sub {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
  max-width: 54ch;
}
.gallery-overlay-sub.contextus-gallery-generated-text {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 15px;
  font-style: italic;
  line-height: 1.5;
}
.gallery-bar-label {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  color: var(--mute, #595959);
}
.gallery-bar-label.contextus-gallery-generated-text {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}
.gallery-bar-label .flag {
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--y, #ffe100);
}
.gallery-bar-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-nav { display: flex; flex: none; gap: 6px; }
.gallery-nav button {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink, #171717);
  color: var(--paper, #ffffff);
  transition: background-color 0.15s var(--ease, ease), color 0.15s var(--ease, ease), transform 0.1s var(--ease, ease);
}
.gallery-nav button[hidden],
.softbox-nav[hidden] { display: none; }
.gallery-nav button:hover:not(:disabled) { background: var(--y, #ffe100); color: var(--on-accent, var(--ink, #171717)); }
.gallery-nav button:active:not(:disabled) { transform: scale(0.94); }
.gallery-nav button:disabled { background: var(--paper-2, #f1f1ee); color: #b5b5b1; }
.gallery-nav svg { width: 20px; height: 20px; }

/* softbox: full-viewport bright viewer for the original files */
.gallery-softbox {
  border: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  background: var(--paper, #ffffff);
  color: var(--ink, #171717);
}
.gallery-softbox[open] { display: block; overflow: hidden; }
html.has-gallery-softbox,
body.has-gallery-softbox { overflow: hidden; }
.softbox-content {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 70px clamp(72px, 9vw, 110px) 28px;
}
.gallery-ad-slot { display: none; }
.gallery-ad-slot:not(:empty) {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 50px;
  margin-inline: auto;
  overflow: hidden;
}
.gallery-ad-slot-top:not(:empty) { margin-bottom: 12px; }
.gallery-ad-slot-bottom:not(:empty) { margin-top: 12px; }
.softbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: min(100%, 920px);
  max-height: min(52dvh, 620px);
  margin-inline: auto;
}
.softbox-stage img {
  max-width: 100%;
  max-height: min(52dvh, 620px);
  width: auto;
  height: auto;
  background: var(--paper-2, #f1f1ee);
  box-shadow: 0 34px 90px rgba(17, 17, 17, 0.28);
  opacity: 0;
  transition: opacity 0.25s var(--ease, ease);
}
.softbox-stage img.is-loaded { opacity: 1; }
.softbox-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  width: min(100%, 728px);
  margin-inline: auto;
  padding: 12px 2px 4px;
}
.softbox-copy {
  display: grid;
  gap: 5px;
  max-width: 72ch;
}
.softbox-title {
  margin: 0;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: clamp(19px, 2vw, 25px);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.softbox-description {
  margin: 0;
  font-family: var(--font-serif, Georgia, serif);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink-soft, #303030);
}
.softbox-caption {
  margin: 2px 0 0;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--mute, #595959);
}
.softbox-count {
  margin-left: auto;
  white-space: nowrap;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--mute, #595959);
}
.softbox-count .num { font-size: 19px; font-weight: 900; color: var(--ink, #171717); }
.softbox-close, .softbox-nav {
  position: absolute;
  z-index: 2;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink, #171717);
  color: var(--paper, #ffffff);
  transition: background-color 0.15s var(--ease, ease), color 0.15s var(--ease, ease), transform 0.1s var(--ease, ease);
}
.softbox-close,
.softbox-nav {
  padding: 0;
  border: 0;
  appearance: none;
  box-shadow: none;
}
.softbox-close:hover, .softbox-nav:hover { background: var(--y, #ffe100); color: var(--on-accent, var(--ink, #171717)); }
.softbox-close:active, .softbox-nav:active { transform: scale(0.94); }
.softbox-close:focus-visible, .softbox-nav:focus-visible { outline: 3px solid var(--y, #ffe100); outline-offset: 3px; }
.softbox-close { top: 14px; right: 14px; }
.softbox-nav { top: 50%; transform: translateY(-50%); }
.softbox-nav:active { transform: translateY(-50%) scale(0.94); }
.softbox-prev { left: 8px; }
.softbox-next { right: 8px; }
.softbox-close svg, .softbox-nav svg { width: 22px; height: 22px; }
@media (max-width: 620px) {
  .is-pager .content-gallery-item { flex-basis: calc(100% - 36px); }
  .gallery-overlay { padding: 48px 12px 11px; gap: 7px; }
  .is-pager .gallery-overlay-title {
    display: -webkit-box;
    width: fit-content;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .is-pager .gallery-overlay-sub { display: none; }
  .gallery-nav { gap: 4px; }
  .gallery-nav button { width: 44px; height: 44px; }
  /* the lead gallery reads taller on portrait screens */
  .gallery-hero :is(.content-gallery-link img, .content-gallery-item > img) { aspect-ratio: 4 / 3; }
  .content-gallery { grid-template-columns: 1fr; columns: 1; }
  .gallery-open {
    --gallery-open-drop: 6px;
    inset-block-start: 38%;
    min-height: 44px;
    padding-inline: 14px;
    font-size: 11px;
  }
  .softbox-content { padding: 62px 10px 18px; }
  .gallery-ad-slot { width: min(100%, 300px); }
  .gallery-ad-slot-top:not(:empty) { margin-bottom: 16px; }
  .gallery-ad-slot-bottom:not(:empty) { margin-top: 16px; }
  .softbox-stage, .softbox-bar { width: min(100%, 340px); }
  .softbox-stage, .softbox-stage img { max-height: min(42dvh, 390px); }
  .softbox-stage img { box-shadow: 0 12px 36px rgba(17, 17, 17, 0.18); }
  .softbox-close, .softbox-nav { width: 44px; height: 44px; }
  .softbox-close { top: 10px; right: 12px; }
  .softbox-prev { left: 0; }
  .softbox-next { right: 0; }
  .softbox-bar { display: block; padding: 12px 4px 4px; }
  .softbox-copy { max-width: none; gap: 4px; }
  .softbox-count {
    position: absolute;
    z-index: 2;
    top: 19px;
    left: 16px;
    margin: 0;
  }
  .softbox-count .num { font-size: 18px; }
  .softbox-title { font-size: 18px; }
  .softbox-description { font-size: 15px; line-height: 1.4; }
}


.content-gallery :is(button, a):focus-visible, .gallery-softbox :is(button, a):focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .content-gallery *, .gallery-softbox * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (forced-colors: active) { .gallery-open, .gallery-nav button, .softbox-close, .softbox-nav { border: 1px solid ButtonText; } }

.content-gallery > .gallery-caption { grid-row: 3; grid-column: 1 / -1; column-span: all; margin-block: .75rem 0; font-size: .9em; color: var(--mute, #595959); }
