.gallery-page {
  --gallery-ink: #071f26;
  --gallery-line: rgba(201, 168, 117, 0.38);
  padding: 150px 24px 88px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 8% 16%, rgba(21, 57, 67, 0.78), transparent 38%),
    radial-gradient(ellipse at 100% 40%, rgba(201, 168, 117, 0.08), transparent 34%),
    var(--gallery-ink);
}

.gallery-intro,
.gallery-collection {
  width: min(100%, 1120px);
  margin-inline: auto;
}

.gallery-intro {
  position: relative;
  display: flex;
  min-height: 270px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gallery-line);
}

.gallery-intro-copy { padding: 0 0 32px 5.5%; }
.gallery-kicker,
.gallery-collection-heading > span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2.7px;
  text-transform: uppercase;
}

.gallery-kicker span {
  width: 24px;
  height: 1px;
  background: var(--color-primary);
}

.gallery-kicker i { color: var(--color-text-muted); font-style: normal; }

.gallery-intro h1 {
  margin: 18px 0 0;
  font-size: clamp(48px, 7.4vw, 88px);
  font-weight: 500;
  letter-spacing: -2.8px;
  line-height: 0.92;
}

.gallery-intro h1 em {
  padding-left: 0.44em;
  color: var(--color-primary);
  font-weight: 500;
}

.gallery-description {
  max-width: 370px;
  margin: 20px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.gallery-index {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 8% 24px 24px;
  color: var(--color-text-muted);
}

.gallery-index-number {
  color: var(--color-text-white);
  font-family: var(--font-heading);
  font-size: 58px;
  font-style: italic;
  line-height: 1;
}

.gallery-index-rule { width: 42px; height: 1px; background: var(--color-primary); }
.gallery-index-label { font-size: 9px; letter-spacing: 1.6px; line-height: 1.65; text-transform: uppercase; }

.gallery-intro-bottom {
  position: absolute;
  right: 0;
  bottom: 15px;
  left: 5.5%;
  display: flex;
  justify-content: space-between;
  color: var(--color-text-muted);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.gallery-intro-bottom b { padding: 0 7px; color: var(--color-primary); }
.gallery-scroll-note { display: flex; align-items: center; gap: 9px; }
.gallery-scroll-icon { color: var(--color-primary); font-size: 15px; }

.gallery-collection { padding-top: 30px; }

.gallery-collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.gallery-collection-heading > span { font-size: 9px; letter-spacing: 2px; }
.gallery-collection-heading > span i { color: var(--color-text-muted); font-style: normal; }
.gallery-collection-heading p { color: var(--color-text-muted); font-size: 12px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(6, 112px);
  gap: 12px;
}

.gallery-frame {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: var(--color-surface);
}

.frame-one { grid-area: 1 / 1 / 3 / 5; }
.frame-two { grid-area: 1 / 5 / 3 / 8; }
.frame-three { grid-area: 1 / 8 / 3 / 13; }
.frame-four { grid-area: 3 / 5 / 5 / 8; }
.frame-five { grid-area: 3 / 1 / 5 / 5; }
.frame-six { grid-area: 3 / 8 / 5 / 13; }
.frame-seven { grid-area: 5 / 1 / 7 / 5; }
.frame-eight { grid-area: 5 / 5 / 7 / 9; }
.frame-nine { grid-area: 5 / 9 / 7 / 13; }

.gallery-image-button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  text-align: left;
}

.gallery-image-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  filter: saturate(0.78);
  transition: filter 500ms ease, transform 700ms cubic-bezier(.2, .7, .2, 1);
}

.frame-two img { object-position: center 58%; }
.frame-three img { object-position: center 32%; }
.frame-four img { object-position: center 30%; }
.frame-six img { object-position: center 38%; }
.frame-eight img { object-position: center 32%; }

.frame-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 31, 38, 0.05) 30%, rgba(7, 31, 38, 0.72) 100%);
  opacity: 0.82;
  transition: opacity 300ms ease;
}

.frame-label {
  position: absolute;
  right: 16px;
  bottom: 15px;
  left: 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--color-text-white);
  font-family: var(--font-heading);
  font-size: 19px;
  font-style: italic;
}

.frame-label b {
  color: var(--color-primary);
  font-family: var(--font-body);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 1px;
}

.frame-open {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  color: white;
  font-size: 14px;
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.gallery-image-button:hover img,
.gallery-image-button:focus-visible img { filter: saturate(1); transform: scale(1.045); }
.gallery-image-button:hover .frame-wash,
.gallery-image-button:focus-visible .frame-wash { opacity: 1; }
.gallery-image-button:hover .frame-open,
.gallery-image-button:focus-visible .frame-open { opacity: 1; transform: none; }

.gallery-rail-meta {
  display: grid;
  grid-template-columns: 1fr auto minmax(80px, 140px);
  align-items: center;
  gap: 18px;
  margin-top: 16px;
}

.gallery-rail-hint,
.gallery-count {
  color: var(--color-text-muted);
  font-size: 10px;
  letter-spacing: 1.2px;
}

.gallery-rail-hint b { padding-left: 5px; color: var(--color-primary); }
.gallery-count { color: var(--color-text-white); font-weight: 600; }
.gallery-count i { padding: 0 5px; color: var(--color-primary); font-style: normal; }
.gallery-rail-progress { height: 1px; background: var(--color-border); }
.gallery-rail-progress i { display: block; width: 11.11%; height: 100%; background: var(--color-primary); transition: width 180ms ease; }

.gallery-lightbox {
  width: min(94vw, 920px);
  max-width: none;
  max-height: 92vh;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #0a252c;
  color: var(--color-text);
}

.gallery-lightbox::backdrop { background: rgba(3, 14, 18, 0.88); backdrop-filter: blur(8px); }
.lightbox-shell { display: flex; max-height: 92vh; flex-direction: column; padding: 18px 22px 16px; }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; }
.lightbox-count { color: var(--color-primary); font-family: var(--font-heading); font-size: 23px; font-style: italic; }
.lightbox-count span { color: var(--color-text-muted); font-size: 16px; }
.lightbox-close,
.lightbox-nav {
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: color var(--transition-ui), background var(--transition-ui), border-color var(--transition-ui);
}

.lightbox-close { width: 40px; height: 40px; font-size: 25px; }
.lightbox-stage { display: flex; min-height: 0; flex: 1; align-items: center; justify-content: center; gap: 20px; padding: 12px 0; }
.lightbox-image { max-width: min(70vw, 660px); max-height: 70vh; width: auto; height: auto; object-fit: contain; }
.lightbox-nav { width: 44px; height: 44px; flex: none; font-size: 19px; }
.lightbox-close:hover,
.lightbox-nav:hover { border-color: var(--color-primary); background: var(--color-primary); color: var(--color-text-dark); }
.lightbox-caption { min-height: 22px; color: var(--color-text-muted); font-family: var(--font-heading); font-size: 17px; font-style: italic; text-align: center; }

@media (max-width: 820px) {
  .gallery-page { padding-top: 124px; }
  .gallery-intro { min-height: 250px; }
  .gallery-intro-copy { padding-left: 2%; }
  .gallery-intro-bottom { left: 2%; }
  .gallery-index { margin-right: 4%; }
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: 230px;
  }
  .gallery-frame { grid-area: auto; }
  .frame-one,
  .frame-four,
  .frame-seven { grid-row: span 2; }
  .frame-three,
  .frame-six { grid-row: span 2; }
}

@media (max-width: 600px) {
  .gallery-page { padding: 110px 20px 64px; }
  .gallery-intro { min-height: 300px; align-items: flex-start; }
  .gallery-intro-copy { padding: 26px 0 62px; }
  .gallery-kicker { gap: 7px; font-size: 9px; letter-spacing: 1.7px; }
  .gallery-kicker span { width: 17px; }
  .gallery-intro h1 { margin-top: 21px; font-size: clamp(40px, 11.5vw, 58px); letter-spacing: -1.8px; }
  .gallery-intro h1 em { padding-left: 0.23em; }
  .gallery-description { max-width: 290px; margin-top: 16px; font-size: 13px; }
  .gallery-index { position: absolute; right: 0; bottom: 36px; gap: 8px; margin: 0; }
  .gallery-index-number { font-size: 32px; }
  .gallery-index-rule { width: 20px; }
  .gallery-index-label { font-size: 7px; letter-spacing: 1px; }
  .gallery-intro-bottom { right: 0; bottom: 12px; left: 0; font-size: 8px; letter-spacing: 1px; }
  .gallery-scroll-note { display: none; }
  .gallery-collection { padding-top: 22px; }
  .gallery-collection-heading { margin-bottom: 14px; }
  .gallery-collection-heading > span { font-size: 8px; letter-spacing: 1.6px; }
  .gallery-collection-heading p { max-width: 120px; font-size: 10px; text-align: right; }
  .gallery-grid {
    display: flex;
    gap: 13px;
    margin: 0 -20px;
    padding: 0 20px 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .gallery-grid::-webkit-scrollbar { display: none; }
  .gallery-frame,
  .frame-one,
  .frame-two,
  .frame-three,
  .frame-four,
  .frame-five,
  .frame-six,
  .frame-seven,
  .frame-eight,
  .frame-nine {
    flex: 0 0 min(76vw, 310px);
    height: 370px;
    margin: 0;
    scroll-snap-align: center;
  }
  .gallery-frame:nth-child(even) { margin-top: 23px; }
  .frame-label { right: 13px; bottom: 14px; left: 13px; font-size: 18px; }
  .frame-open { opacity: 1; transform: none; }
  .gallery-rail-meta { grid-template-columns: 1fr auto; gap: 10px 14px; margin-top: 12px; }
  .gallery-rail-hint { font-size: 9px; }
  .gallery-rail-progress { grid-column: 1 / -1; grid-row: 2; }
  .lightbox-shell { padding: 12px 12px 14px; }
  .lightbox-stage { gap: 0; }
  .lightbox-image { max-width: 76vw; max-height: 72vh; }
  .lightbox-nav { width: 38px; height: 38px; }
  .lightbox-prev { margin-right: -4px; }
  .lightbox-next { margin-left: -4px; }
}

@media (max-width: 360px) {
  .gallery-page { padding-right: 16px; padding-left: 16px; }
  .gallery-grid { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
  .gallery-intro h1 { font-size: 40px; }
  .gallery-rail-hint { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-page *,
  .gallery-page *::before,
  .gallery-page *::after,
  .gallery-lightbox *,
  .gallery-lightbox *::before,
  .gallery-lightbox *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
