.gallery-page {
  background: var(--paper);
}

.gallery-hero {
  position: relative;
  min-height: 84svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  padding: 118px 32px 64px;
  color: #fff;
  background: #0b0d0d;
  isolation: isolate;
}

.gallery-hero-image,
.gallery-hero-overlay {
  position: absolute;
  inset: 0;
}

.gallery-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-hero-overlay {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(3, 6, 6, 0.78), rgba(3, 6, 6, 0.35) 52%, rgba(3, 6, 6, 0.12)),
    linear-gradient(0deg, rgba(3, 6, 6, 0.78), rgba(3, 6, 6, 0.02) 50%);
}

.gallery-hero-inner {
  position: relative;
  z-index: 2;
  width: min(100%, var(--container));
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.back-link:hover {
  color: #fff;
}

.gallery-hero h1 {
  margin: 14px 0 0;
  max-width: 850px;
  font-size: 72px;
  line-height: 0.96;
  letter-spacing: 0;
}

.gallery-roman {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-mood {
  max-width: 760px;
  margin: 30px 0 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.55;
}

.gallery-lead {
  max-width: 720px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
}

.gallery-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.gallery-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
}

.gallery-facts li {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.gallery-switcher {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 244, 0.92);
  backdrop-filter: blur(18px);
}

.gallery-switcher a {
  display: grid;
  gap: 2px;
  min-height: 72px;
  align-content: center;
  padding: 12px 22px;
  border-right: 1px solid var(--line);
  color: var(--ink-soft);
}

.gallery-switcher a:last-child {
  border-right: 0;
}

.gallery-switcher a.is-active {
  color: var(--ink);
  background: #fff;
}

.gallery-switcher span {
  color: var(--moss);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gallery-switcher strong {
  font-size: 15px;
  line-height: 1.25;
}

.gallery-main {
  padding: 96px 32px 112px;
}

.gallery-heading {
  width: min(100%, 820px);
  margin: 0 auto 40px;
  text-align: center;
}

.gallery-heading h2 {
  margin: 12px 0 0;
  font-size: 48px;
  line-height: 1.1;
  letter-spacing: 0;
}

.gallery-heading p {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.gallery-grid {
  width: min(100%, var(--container));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 220px;
  gap: 12px;
}

.gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--charcoal);
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.gallery-tile.is-wide {
  grid-column: span 2;
}

.gallery-tile.is-tall {
  grid-row: span 2;
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 180ms ease, transform 420ms ease;
}

.gallery-tile:hover img,
.gallery-tile:focus-visible img {
  opacity: 0.82;
  transform: scale(1.04);
}

.gallery-tile span {
  position: absolute;
  left: 12px;
  bottom: 10px;
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(8, 11, 11, 0.62);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
}

.gallery-next {
  padding: 0 32px 108px;
  background: var(--paper);
}

.gallery-next-inner {
  width: min(100%, var(--container));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.gallery-next p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.gallery-next a {
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.2;
}

.gallery-next a:hover {
  color: var(--moss);
}

body.is-lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  grid-template-rows: 72px minmax(0, 1fr) 72px;
  gap: 12px;
  padding: 18px;
  background: rgba(3, 5, 5, 0.94);
  color: #fff;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-frame {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

.lightbox-frame img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.lightbox-counter {
  grid-column: 2;
  grid-row: 3;
  align-self: center;
  justify-self: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lightbox-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-button:hover,
.lightbox-button:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-close {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.lightbox-prev {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
  justify-self: center;
}

.lightbox-next {
  grid-column: 3;
  grid-row: 2;
  align-self: center;
  justify-self: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 1280px) {
  .gallery-hero h1 {
    font-size: 94px;
  }

  .gallery-grid {
    grid-auto-rows: 252px;
  }
}

@media (max-width: 1040px) {
  .gallery-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-switcher a:nth-child(2n) {
    border-right: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 190px;
  }
}

@media (max-width: 720px) {
  .gallery-hero {
    min-height: 82svh;
    padding: 104px 18px 44px;
  }

  .gallery-hero h1 {
    font-size: 46px;
  }

  .gallery-mood {
    font-size: 20px;
  }

  .gallery-switcher {
    position: relative;
    grid-template-columns: 1fr;
  }

  .gallery-switcher a {
    min-height: 58px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .gallery-switcher a:last-child {
    border-bottom: 0;
  }

  .gallery-main {
    padding: 76px 18px 82px;
  }

  .gallery-heading h2 {
    font-size: 34px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 150px;
    gap: 8px;
  }

  .gallery-tile.is-wide,
  .gallery-tile.is-tall {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gallery-next {
    padding: 0 18px 78px;
  }

  .gallery-next-inner {
    display: block;
  }

  .gallery-next a {
    display: inline-block;
    margin-top: 8px;
    font-size: 24px;
  }

  .lightbox {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    grid-template-rows: 64px minmax(0, 1fr) 64px;
    padding: 10px;
  }

  .lightbox-button {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }
}

@media (max-width: 420px) {
  .gallery-hero h1 {
    font-size: 39px;
  }

  .gallery-hero-actions {
    display: grid;
  }

  .gallery-grid {
    grid-auto-rows: 132px;
  }
}
