.gallery-page { background: var(--surface-soft); }
.gallery-section { padding: clamp(44px, 7vw, 90px) 0 clamp(70px, 10vw, 120px); }
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.gallery-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: #dfe6ec;
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}
.gallery-card img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .35s ease;
}
.gallery-card::after {
  content: "View";
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(0,31,63,.88);
  color: #fff;
  font-family: Archivo, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s ease, transform .25s ease;
}
.gallery-card:hover img,
.gallery-card:focus-visible img { transform: scale(1.035); }
.gallery-card:hover::after,
.gallery-card:focus-visible::after { opacity: 1; transform: translateY(0); }

.gallery-dialog {
  width: min(1100px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: #081522;
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
.gallery-dialog::backdrop { background: rgba(0,14,28,.86); }
.gallery-dialog__inner { position: relative; }
.gallery-dialog img {
  width: 100%;
  max-height: calc(100dvh - 28px);
  object-fit: contain;
}
.gallery-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0,31,63,.94);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}
.gallery-dialog__close:hover { background: var(--brand-green); }

@media (min-width: 560px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
  .gallery-card:nth-child(7n + 1) { grid-row: span 2; }
  .gallery-card:nth-child(7n + 1) img { aspect-ratio: 4 / 6.2; }
}
@media (min-width: 1280px) {
  .gallery-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (hover: none) {
  .gallery-card::after { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-card img, .gallery-card::after { transition: none; }
}

/* v5.0 gallery: an uneven photographic contact sheet. */
.gallery-page { background: #f5f3ed; }
.gallery-section { background: #f5f3ed; }
.gallery-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.gallery-card { grid-column: span 3; border-radius: 0; background: #10283b; }
.gallery-card:nth-child(7n + 1) { grid-column: span 6; grid-row: span 2; }
.gallery-card:nth-child(5n + 3) { grid-column: span 4; }
.gallery-card img { width: 100%; height: 100%; min-height: 230px; object-fit: cover; }
.gallery-card::after { background: linear-gradient(0deg, rgba(16,40,59,.72), transparent 58%); }
.gallery-dialog { border-radius: 0; }
@media (max-width: 767px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery-card, .gallery-card:nth-child(7n + 1), .gallery-card:nth-child(5n + 3) { grid-column: span 1; grid-row: auto; }
  .gallery-card:nth-child(5n + 1) { grid-column: span 2; }
  .gallery-card img { min-height: 170px; }
}

/* v6.0 curated gallery composition. */
.gallery-page { background: #f5f3ed; color: #10283b; }
.gallery-overview { padding: clamp(48px, 7vw, 92px) 0; background: #f5f3ed; border-bottom: 1px solid rgba(16,40,59,.16); }
.gallery-overview__inner { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: clamp(30px, 8vw, 128px); align-items: end; }
.gallery-overview__eyebrow,
.gallery-section__eyebrow { display: block; margin-bottom: 13px; color: #70808b; font-family: Archivo, sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.gallery-overview h2,
.gallery-section__heading h2 { max-width: 14ch; margin: 0; font-size: clamp(2.35rem, 4.7vw, 5.2rem); letter-spacing: -.065em; line-height: .9; }
.gallery-overview h2 span { color: #b58a17; }
.gallery-overview__aside { max-width: 44ch; }
.gallery-overview__aside > p { margin: 0; color: #526068; font-size: clamp(1rem, 1.2vw, 1.13rem); line-height: 1.65; }
.gallery-overview__nav { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 27px; }
.gallery-overview__nav a { display: inline-flex; align-items: baseline; gap: 8px; color: #10283b; font-family: Archivo, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-decoration: none; text-transform: uppercase; }
.gallery-overview__nav a span { color: #b58a17; font-variant-numeric: tabular-nums; }
.gallery-overview__nav a:hover,
.gallery-overview__nav a:focus-visible { color: #b58a17; }
.gallery-section { padding: clamp(58px, 9vw, 132px) 0; }
.gallery-section--featured { background: #10283b; color: #fff; }
.gallery-section--archive { background: #e9e5dc; }
.gallery-section__heading { display: grid; grid-template-columns: minmax(88px,.3fr) minmax(0,1fr); gap: 20px; align-items: start; margin-bottom: clamp(30px, 5vw, 62px); }
.gallery-section__count { padding-top: 5px; color: #b58a17; font-family: Archivo, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.gallery-section__heading h2 { color: inherit; }
.gallery-section__heading h2 em { color: #b58a17; font-style: normal; }
.gallery-section--featured .gallery-section__eyebrow { color: rgba(255,255,255,.58); }
.gallery-grid--featured,
.gallery-grid--archive { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: clamp(10px, 1.6vw, 22px); }
.gallery-grid--featured .gallery-card,
.gallery-grid--archive .gallery-card { width: 100%; min-height: 0; margin: 0; border: 0; border-radius: 0; background: #071723; box-shadow: none; }
.gallery-grid--featured .gallery-card { grid-column: span 6; aspect-ratio: 4 / 3; }
.gallery-grid--featured .gallery-card:nth-child(1),
.gallery-grid--featured .gallery-card:nth-child(4) { grid-column: span 7; aspect-ratio: 16 / 10; }
.gallery-grid--featured .gallery-card:nth-child(2),
.gallery-grid--featured .gallery-card:nth-child(3) { grid-column: span 5; }
.gallery-grid--archive .gallery-card { grid-column: span 4; aspect-ratio: 4 / 3; }
.gallery-grid--archive .gallery-card:nth-child(9n + 1) { grid-column: span 8; aspect-ratio: 16 / 9; }
.gallery-grid--archive .gallery-card:nth-child(9n + 5) { grid-column: span 5; aspect-ratio: 5 / 4; }
.gallery-grid--archive .gallery-card:nth-child(9n + 6) { grid-column: span 7; aspect-ratio: 5 / 4; }
.gallery-grid--featured .gallery-card picture,
.gallery-grid--archive .gallery-card picture,
.gallery-grid--featured .gallery-card img,
.gallery-grid--archive .gallery-card img { display: block; width: 100%; height: 100%; }
.gallery-grid--featured .gallery-card img,
.gallery-grid--archive .gallery-card img { object-fit: cover; transition: transform .6s cubic-bezier(.16,1,.3,1); }
.gallery-grid--featured .gallery-card::after,
.gallery-grid--archive .gallery-card::after { right: 14px; bottom: 14px; padding: 8px 11px; border-radius: 0; background: rgba(9,26,40,.82); font-size: 10px; letter-spacing: .1em; }
.gallery-grid--featured .gallery-card:hover img,
.gallery-grid--featured .gallery-card:focus-visible img,
.gallery-grid--archive .gallery-card:hover img,
.gallery-grid--archive .gallery-card:focus-visible img { transform: scale(1.045); }
.gallery-section[id] { scroll-margin-top: 100px; }
@media (max-width: 767px) {
  .gallery-overview { padding: 44px 0 48px; }
  .gallery-overview__inner { grid-template-columns: 1fr; gap: 24px; }
  .gallery-overview h2,
  .gallery-section__heading h2 { max-width: 12ch; font-size: clamp(2.25rem, 12vw, 3.5rem); }
  .gallery-section { padding: 58px 0; }
  .gallery-section__heading { grid-template-columns: 1fr; gap: 10px; }
  .gallery-section__count { padding: 0; }
  .gallery-grid--featured,
  .gallery-grid--archive { grid-template-columns: 1fr; gap: 10px; }
  .gallery-grid--featured .gallery-card,
  .gallery-grid--featured .gallery-card:nth-child(n),
  .gallery-grid--archive .gallery-card,
  .gallery-grid--archive .gallery-card:nth-child(n) { grid-column: auto; aspect-ratio: 4 / 3; }
  .gallery-grid--featured .gallery-card:first-child,
  .gallery-grid--archive .gallery-card:nth-child(9n + 1) { aspect-ratio: 16 / 10; }
}

/* Keep every expanded gallery image centred within the lightbox. */
.gallery-dialog {
  margin: auto;
  width: min(1100px, calc(100vw - 28px));
  height: min(76dvh, 760px);
  max-height: calc(100dvh - 28px);
}
.gallery-dialog__inner {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}
.gallery-dialog img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  object-position: center;
}
@media (max-width: 767px) {
  .gallery-dialog { height: min(72dvh, 620px); }
}
