.article-gallery { margin-block: 2rem; clear: both; }
.article-gallery [hidden] { display: none !important; }
.article-gallery-stage { position: relative; }
.article-gallery-ready .article-gallery-stage { aspect-ratio: 3 / 2; overflow: hidden; touch-action: pan-y pinch-zoom; background: #101817; }
.article-gallery .article-gallery-slide { margin: 0; }
.article-gallery-ready .article-gallery-slide,
.article-gallery-ready .article-gallery-slide a { display: block; height: 100%; }
.article-gallery .article-gallery-slide img { display: block; width: 100%; margin: 0; }
.article-gallery-ready .article-gallery-slide img { height: 100%; object-fit: cover; border-radius: 0; }
.article-gallery-ready .article-gallery-slide figcaption { display: none; }
.article-gallery .article-gallery-caption { margin: 8px 0 0; color: var(--color-muted, #596663); font-size: .85rem; line-height: 1.5; }
.article-gallery-count, .article-gallery-control {
  position: absolute;
  z-index: 1;
  color: #fff;
  background: rgb(0 0 0 / 68%);
  border: 0;
}
.article-gallery .article-gallery-count { margin: 0; inset: 10px auto auto 10px; padding: 5px 9px; border-radius: 5px; font-size: .8rem; }
.article-gallery-control { display: grid; place-items: center; width: 44px; height: 44px; font: inherit; font-size: 28px; line-height: 1; border-radius: 50%; cursor: pointer; }
.article-gallery-control:hover { background: #000; }
.article-gallery-control:focus-visible, .article-gallery-slide a:focus-visible { outline: 2px solid white; outline-offset: -3px; }
.article-gallery-control[data-gallery-action="prev"] { left: 10px; top: 50%; transform: translateY(-50%); }
.article-gallery-control[data-gallery-action="next"] { right: 10px; top: 50%; transform: translateY(-50%); }
.article-gallery-control[data-gallery-action="open"],
.article-gallery-control[data-gallery-action="close"] { right: 10px; top: 10px; border-radius: 6px; }
.article-gallery-dialog {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 56px clamp(48px, 6vw, 88px) 24px;
  border: 0;
  background: #101817;
  touch-action: pan-y pinch-zoom;
  color: #fff;
}
.article-gallery-dialog[open] { display: grid; place-items: center; }
.article-gallery-dialog::backdrop { background: #101817; }
.article-gallery .article-gallery-dialog figure { margin: 0; min-width: 0; max-width: 100%; text-align: center; }
.article-gallery .article-gallery-dialog img { display: block; max-width: 100%; max-height: 78dvh; margin: auto; object-fit: contain; }
.article-gallery .article-gallery-dialog figcaption { margin-top: 8px; color: #fff; font-size: .9rem; }

/* Editorial gallery: neutral frame, square photographs and themed controls. */
.article-page__content section.article-gallery {
  margin-block: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--shell-font);
}
.article-gallery-ready .article-gallery-stage {
  aspect-ratio: 3 / 2;
  max-height: 620px;
  background: var(--color-surface);
  border: 1px solid color-mix(in srgb, var(--color-border) 25%, transparent);
  box-sizing: border-box;
}
.article-gallery-ready .article-gallery-slide img { object-fit: contain; }
.article-gallery .article-gallery-slide a { cursor: zoom-in; }
.article-gallery .article-gallery-caption {
  padding: 12px 0;
  margin: 0;
  border-block-end: 1px solid color-mix(in srgb, var(--color-border) 25%, transparent);
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.6;
}
.article-gallery .article-gallery-control {
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--color-border) 30%, transparent);
  border-radius: 0;
  background: var(--color-canvas);
  color: var(--color-text);
  font-size: 16px;
}
.article-gallery .article-gallery-control:hover { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }
.article-gallery .article-gallery-control:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.article-gallery .article-gallery-count {
  inset: 14px auto auto 14px;
  padding: 7px 11px;
  border-radius: 0;
  background: var(--color-canvas);
  color: var(--color-text);
  border: 1px solid color-mix(in srgb, var(--color-border) 30%, transparent);
  font: 600 12px/1.5 var(--shell-font);
  font-variant-numeric: tabular-nums;
}
.article-gallery-control[data-gallery-action="prev"] { left: 14px; }
.article-gallery-control[data-gallery-action="next"] { right: 14px; }
.article-gallery-control[data-gallery-action="open"], .article-gallery-control[data-gallery-action="close"] { right: 14px; top: 14px; }
.article-gallery .article-gallery-dialog { background: var(--color-canvas); color: var(--color-text); }
.article-gallery-dialog::backdrop { background: var(--color-canvas); }
.article-gallery .article-gallery-dialog figcaption { color: var(--color-muted); font: 14px/1.6 var(--shell-font); max-width: 75ch; margin: 16px auto 0; }
.article-gallery .article-gallery-dialog img { border-radius: 0; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .article-gallery-control { transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease; }
}
@media (max-width: 600px) {
  .article-gallery-ready .article-gallery-stage { aspect-ratio: 4 / 3; }
  .article-gallery .article-gallery-control { width: 40px; height: 40px; font-size: 14px; }
  .article-gallery .article-gallery-count { inset: 8px auto auto 8px; padding: 5px 8px; }
  .article-gallery-control[data-gallery-action="prev"] { left: 8px; }
  .article-gallery-control[data-gallery-action="next"] { right: 8px; }
  .article-gallery-control[data-gallery-action="open"], .article-gallery-control[data-gallery-action="close"] { right: 8px; top: 8px; }
  .article-gallery-dialog { padding: 64px 12px 72px; }
  .article-gallery-dialog .article-gallery-control[data-gallery-action="prev"], .article-gallery-dialog .article-gallery-control[data-gallery-action="next"] { top: auto; bottom: 16px; transform: none; }
}

.article-gallery .article-gallery-dialog {
  color-scheme: dark;
  --color-canvas: #15191d;
  --color-surface: #21272d;
  --color-text: #f5f7f9;
  --color-muted: #b7c2cc;
  --color-primary: #a59573;
  --color-on-primary: #15191d;
  background: var(--color-canvas);
  color: var(--color-text);
}
.article-gallery-dialog::backdrop { background: #15191d; }
