.gallery-page {
  --gallery-accent: #9b91ff;
  --gallery-accent-strong: #6d61e8;
  --gallery-panel: #101018;
  background:
    radial-gradient(circle at 78% 8%, rgba(97, 86, 199, 0.22), transparent 31rem),
    radial-gradient(circle at 12% 51%, rgba(97, 86, 199, 0.08), transparent 34rem),
    #09090d;
}

.gallery-page main {
  overflow: clip;
}

.gallery-hero {
  position: relative;
  isolation: isolate;
  min-height: max(48rem, 100svh);
  padding: calc(var(--header-height) + clamp(2rem, 6vh, 5rem)) 4vw clamp(4rem, 8vh, 7rem);
  border-bottom: 1px solid var(--line);
}

.gallery-hero::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 49.94%, rgba(255, 255, 255, 0.045) 50%, transparent 50.06%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 4.5rem 4.5rem, 4.5rem 4.5rem;
  content: "";
  -webkit-mask-image: linear-gradient(to bottom, #000 25%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 25%, transparent 92%);
}

.gallery-hero::after {
  position: absolute;
  z-index: -1;
  top: 17%;
  right: 12%;
  width: min(44vw, 43rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(97, 86, 199, 0.15);
  content: "";
  filter: blur(6rem);
}

.gallery-hero-grid {
  display: grid;
  width: var(--container);
  min-height: calc(100svh - var(--header-height) - clamp(8rem, 14vh, 12rem));
  margin-inline: auto;
  grid-template-columns: minmax(20rem, 0.78fr) minmax(34rem, 1.22fr);
  gap: clamp(3rem, 7vw, 8rem);
  align-items: center;
}

.gallery-hero-copy {
  position: relative;
  z-index: 3;
  max-width: 38rem;
}

.gallery-hero-copy .eyebrow {
  margin-bottom: 1.15rem;
  color: var(--gallery-accent);
}

.gallery-hero-copy h1 {
  max-width: 8ch;
  margin: 0;
  font-size: clamp(4.8rem, 8.5vw, 9.5rem);
  font-weight: 710;
  letter-spacing: -0.075em;
  line-height: 0.77;
}

.gallery-hero-copy h1 span {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(155, 145, 255, 0.95);
  text-stroke: 1.5px rgba(155, 145, 255, 0.95);
}

.gallery-hero-copy > p:not(.eyebrow) {
  max-width: 34rem;
  margin: clamp(2rem, 4vw, 3.5rem) 0 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 1.4vw, 1.25rem);
  line-height: 1.65;
}

.gallery-scroll-link {
  display: inline-flex;
  min-height: 3.2rem;
  margin-top: 1.8rem;
  padding: 0 0.25rem;
  border-bottom: 1px solid rgba(155, 145, 255, 0.62);
  align-items: center;
  gap: 1.25rem;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 680;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-scroll-link span {
  color: var(--gallery-accent);
  font-size: 1.1rem;
  transition: transform 260ms var(--ease-out);
}

.gallery-scroll-link:hover span {
  transform: translateY(0.3rem);
}

.gallery-hero-stage {
  position: relative;
  min-height: clamp(34rem, 66vh, 48rem);
  perspective: 75rem;
}

.gallery-hero-main,
.gallery-hero-detail {
  position: absolute;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line-strong);
  background: #0d0d12;
  box-shadow: 0 2.5rem 8rem rgba(0, 0, 0, 0.52);
}

.gallery-hero-main {
  inset: 3% 8% 2% 14%;
  border-radius: 2rem;
  transform: translate3d(var(--gallery-shift-x, 0), var(--gallery-shift-y, 0), 0) rotateY(-4deg) rotateX(1deg);
  transform-origin: center;
  transition: transform 700ms var(--ease-out);
}

.gallery-hero-main::after,
.gallery-hero-detail::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(97, 86, 199, 0.08), transparent 45%, rgba(0, 0, 0, 0.42));
  content: "";
  pointer-events: none;
}

.gallery-hero-main img,
.gallery-hero-detail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-hero-main img {
  object-position: center 39%;
  scale: 1.02;
  animation: galleryHeroBreath 12s ease-in-out infinite alternate;
}

.gallery-hero-main figcaption {
  position: absolute;
  z-index: 2;
  right: 1.4rem;
  bottom: 1.35rem;
  left: 1.4rem;
  display: flex;
  min-height: 3.8rem;
  padding: 0.8rem 1.05rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.8rem;
  background: rgba(9, 9, 13, 0.72);
  -webkit-backdrop-filter: blur(1rem);
  backdrop-filter: blur(1rem);
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-family: "Geist Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-hero-main figcaption span {
  color: var(--gallery-accent);
}

.gallery-hero-detail {
  z-index: 3;
  width: clamp(8.5rem, 16vw, 14rem);
  border-radius: 1.15rem;
}

.gallery-hero-detail-top {
  top: 0;
  right: -1%;
  aspect-ratio: 1.15;
  animation: galleryFloat 7s ease-in-out infinite;
}

.gallery-hero-detail-bottom {
  bottom: 7%;
  left: 0;
  aspect-ratio: 0.82;
  animation: galleryFloat 8.5s ease-in-out -2.5s infinite reverse;
}

.gallery-hero-orbit,
.gallery-hero-orbit span {
  position: absolute;
  border: 1px solid rgba(155, 145, 255, 0.22);
  border-radius: 50%;
  pointer-events: none;
}

.gallery-hero-orbit {
  z-index: -1;
  top: 50%;
  left: 50%;
  width: 112%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(-16deg);
}

.gallery-hero-orbit span:first-child {
  inset: 9%;
}

.gallery-hero-orbit span:last-child {
  inset: 21%;
}

.gallery-hero-index {
  position: absolute;
  right: 4vw;
  bottom: 1.35rem;
  left: 4vw;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-family: "Geist Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-hero-index i {
  height: 1px;
  background: linear-gradient(90deg, var(--gallery-accent), rgba(255, 255, 255, 0.08));
  flex: 1;
}

.gallery-showcase {
  padding: clamp(6rem, 11vw, 11rem) 0 clamp(5rem, 9vw, 9rem);
}

.gallery-showcase-head {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.7fr);
  gap: clamp(2rem, 8vw, 9rem);
  align-items: end;
}

.gallery-showcase-head h2 {
  max-width: 10ch;
  margin: 0.45rem 0 0;
  font-size: clamp(3.3rem, 7vw, 7.4rem);
  letter-spacing: -0.065em;
  line-height: 0.9;
}

.gallery-intro {
  margin: 0 0 0.4rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--gallery-accent-strong);
  color: var(--text-soft);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.gallery-filter {
  display: flex;
  overflow-x: auto;
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
  padding-block: 0.3rem 0.7rem;
  gap: 0.55rem;
  scrollbar-width: thin;
}

.gallery-filter button {
  min-height: 2.65rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-transform: uppercase;
  transition: border-color 220ms var(--ease-out), background 220ms var(--ease-out), color 220ms var(--ease-out), transform 220ms var(--ease-out);
}

.gallery-filter button:hover,
.gallery-filter button.is-active {
  border-color: rgba(155, 145, 255, 0.7);
  background: rgba(97, 86, 199, 0.2);
  color: var(--text);
  transform: translateY(-0.12rem);
}

.gallery-grid {
  display: grid;
  margin-top: clamp(2rem, 4vw, 3rem);
  grid-auto-flow: dense;
  grid-auto-rows: clamp(15rem, 23vw, 25rem);
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.35rem);
}

.gallery-card {
  position: relative;
  grid-column: span 4;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: clamp(1rem, 1.5vw, 1.5rem);
  background: #101016;
  cursor: zoom-in;
  text-align: left;
  transition: border-color 300ms var(--ease-out), box-shadow 400ms var(--ease-out), transform 400ms var(--ease-out), opacity 240ms ease;
}

.gallery-card-wide {
  grid-column: span 8;
}

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

.gallery-card[hidden] {
  display: none;
}

.gallery-card::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 8, 0.92), transparent 52%);
  content: "";
  pointer-events: none;
}

.gallery-card::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  border: 1px solid transparent;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(155, 145, 255, 0.62), transparent 30%, transparent 70%, rgba(155, 145, 255, 0.2)) border-box;
  content: "";
  opacity: 0;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-out), filter 500ms ease;
}

.gallery-card:nth-child(1) img,
.gallery-card:nth-child(5) img {
  object-position: center 38%;
}

.gallery-card:nth-child(7) img {
  object-position: center 25%;
}

.gallery-card-meta {
  position: absolute;
  z-index: 4;
  right: 1.25rem;
  bottom: 1.2rem;
  left: 1.25rem;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  align-items: baseline;
  color: var(--text);
}

.gallery-card-meta i {
  grid-row: span 2;
  color: var(--gallery-accent);
  font-family: "Geist Mono", monospace;
  font-size: 0.66rem;
  font-style: normal;
}

.gallery-card-meta strong {
  font-size: clamp(1.05rem, 1.6vw, 1.5rem);
  line-height: 1.1;
}

.gallery-card-meta small {
  margin-top: 0.2rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.76rem;
}

.gallery-card-open {
  position: absolute;
  z-index: 4;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(9, 9, 13, 0.66);
  -webkit-backdrop-filter: blur(0.75rem);
  backdrop-filter: blur(0.75rem);
  place-items: center;
  font-size: 1.05rem;
  opacity: 0;
  transform: translateY(0.5rem) rotate(-18deg);
  transition: opacity 280ms ease, transform 380ms var(--ease-out);
}

.gallery-card:hover,
.gallery-card:focus-visible {
  border-color: rgba(155, 145, 255, 0.48);
  box-shadow: 0 2.5rem 6rem rgba(0, 0, 0, 0.42), 0 0 4rem rgba(97, 86, 199, 0.12);
  outline: none;
  transform: translateY(-0.4rem);
}

.gallery-card:hover::after,
.gallery-card:focus-visible::after,
.gallery-card:hover .gallery-card-open,
.gallery-card:focus-visible .gallery-card-open {
  opacity: 1;
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
  filter: saturate(1.08) contrast(1.03);
  transform: scale(1.045);
}

.gallery-card:hover .gallery-card-open,
.gallery-card:focus-visible .gallery-card-open {
  transform: translateY(0) rotate(0);
}

.gallery-empty {
  width: var(--container);
  margin: 2rem auto 0;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--text-soft);
  text-align: center;
}

.gallery-cta {
  position: relative;
  padding-top: 0;
}

.gallery-cta-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(2.2rem, 6vw, 6rem);
  border: 1px solid rgba(155, 145, 255, 0.25);
  border-radius: clamp(1.4rem, 3vw, 2.4rem);
  background:
    linear-gradient(135deg, rgba(97, 86, 199, 0.22), transparent 52%),
    #111118;
  box-shadow: var(--shadow-brand);
}

.gallery-cta-panel::before {
  position: absolute;
  z-index: -1;
  top: -60%;
  right: -8%;
  width: 38rem;
  aspect-ratio: 1;
  border: 1px solid rgba(155, 145, 255, 0.16);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5rem rgba(97, 86, 199, 0.04), inset 0 0 0 10rem rgba(97, 86, 199, 0.03);
  content: "";
}

.gallery-cta-panel h2 {
  max-width: 15ch;
  margin: 0.6rem 0 1rem;
  font-size: clamp(2.6rem, 6vw, 6rem);
  letter-spacing: -0.06em;
  line-height: 0.92;
}

.gallery-cta-panel > p:not(.eyebrow) {
  max-width: 45rem;
  color: var(--text-soft);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.gallery-cta-panel .btn-row {
  margin-top: 1.8rem;
}

.gallery-lightbox {
  width: min(92vw, 78rem);
  max-width: none;
  max-height: 92dvh;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1.4rem;
  background: #0b0b10;
  color: var(--text);
  box-shadow: 0 3rem 10rem rgba(0, 0, 0, 0.78);
}

.gallery-lightbox::backdrop {
  background: rgba(3, 3, 6, 0.86);
  -webkit-backdrop-filter: blur(0.65rem);
  backdrop-filter: blur(0.65rem);
}

.gallery-lightbox-shell {
  position: relative;
  display: grid;
  max-height: 92dvh;
  grid-template-rows: minmax(0, 1fr) auto;
}

.gallery-lightbox-stage {
  display: grid;
  overflow: hidden;
  min-height: 18rem;
  max-height: calc(92dvh - 5.25rem);
  background:
    radial-gradient(circle at center, rgba(97, 86, 199, 0.12), transparent 55%),
    #08080c;
  place-items: center;
}

.gallery-lightbox-stage img {
  width: 100%;
  height: 100%;
  max-height: calc(92dvh - 5.25rem);
  object-fit: contain;
  opacity: 0.2;
  transform: scale(0.985);
  transition: opacity 240ms ease, transform 480ms var(--ease-out);
}

.gallery-lightbox-stage img.is-ready {
  opacity: 1;
  transform: scale(1);
}

.gallery-lightbox-close {
  position: absolute;
  z-index: 2;
  top: 0.9rem;
  right: 0.9rem;
  display: grid;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(9, 9, 13, 0.76);
  -webkit-backdrop-filter: blur(1rem);
  backdrop-filter: blur(1rem);
  cursor: pointer;
  place-items: center;
  font-size: 1.55rem;
  line-height: 1;
}

.gallery-lightbox-bar {
  display: flex;
  min-height: 5.25rem;
  padding: 1rem 1.25rem 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.gallery-lightbox-bar p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.gallery-lightbox-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.gallery-lightbox-controls button {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--ink-soft);
  cursor: pointer;
  place-items: center;
}

.gallery-lightbox-controls span {
  min-width: 4.25rem;
  color: var(--text-muted);
  font-family: "Geist Mono", monospace;
  font-size: 0.7rem;
  text-align: center;
}

@keyframes galleryHeroBreath {
  from { transform: scale(1.01); }
  to { transform: scale(1.075); }
}

@keyframes galleryFloat {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-1deg); }
  50% { transform: translate3d(0, -0.8rem, 0) rotate(1.4deg); }
}

@media (max-width: 72rem) {
  .gallery-hero-grid {
    grid-template-columns: minmax(18rem, 0.75fr) minmax(27rem, 1.25fr);
    gap: 2.5rem;
  }

  .gallery-hero-copy h1 {
    font-size: clamp(4.4rem, 9.5vw, 7rem);
  }

  .gallery-hero-stage {
    min-height: 35rem;
  }
}

@media (max-width: 60rem) {
  .gallery-hero {
    min-height: auto;
    padding-top: calc(var(--header-height) + 3.5rem);
  }

  .gallery-hero-grid {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  .gallery-hero-copy {
    max-width: 46rem;
  }

  .gallery-hero-copy h1 {
    max-width: 10ch;
    font-size: clamp(4.7rem, 14vw, 8rem);
  }

  .gallery-hero-stage {
    width: min(100%, 44rem);
    min-height: 39rem;
    margin-inline: auto;
  }

  .gallery-hero-main {
    inset-inline: 11% 9%;
  }

  .gallery-showcase-head {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .gallery-intro {
    max-width: 43rem;
  }

  .gallery-grid {
    grid-auto-rows: clamp(16rem, 42vw, 25rem);
  }

  .gallery-card,
  .gallery-card-wide {
    grid-column: span 6;
  }
}

@media (max-width: 48rem) {
  .gallery-hero {
    padding: calc(var(--header-height) + 2.3rem) 4vw 4.25rem;
  }

  .gallery-hero-copy h1 {
    font-size: clamp(3.9rem, 20vw, 6.3rem);
    line-height: 0.8;
  }

  .gallery-hero-copy > p:not(.eyebrow) {
    margin-top: 1.7rem;
    font-size: 1rem;
  }

  .gallery-hero-stage {
    min-height: clamp(27rem, 126vw, 36rem);
  }

  .gallery-hero-main {
    inset: 3% 2% 2% 8%;
    border-radius: 1.35rem;
    transform: none;
  }

  .gallery-hero-detail {
    width: clamp(7rem, 31vw, 10rem);
  }

  .gallery-hero-detail-top {
    right: -2%;
  }

  .gallery-hero-detail-bottom {
    left: -1%;
  }

  .gallery-hero-main figcaption {
    right: 0.7rem;
    bottom: 0.7rem;
    left: 0.7rem;
    min-height: 3rem;
    font-size: 0.62rem;
  }

  .gallery-hero-index {
    display: none;
  }

  .gallery-showcase {
    padding-top: 5.25rem;
  }

  .gallery-showcase-head h2 {
    font-size: clamp(3.1rem, 15vw, 5rem);
  }

  .gallery-filter {
    width: auto;
    margin-inline: 4vw 0;
    padding-right: 4vw;
  }

  .gallery-grid {
    grid-auto-rows: clamp(19rem, 112vw, 30rem);
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .gallery-card,
  .gallery-card-wide,
  .gallery-card-tall {
    grid-column: 1;
    grid-row: auto;
  }

  .gallery-card-wide {
    aspect-ratio: 1.1;
  }

  .gallery-card-meta {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
  }

  .gallery-card-open {
    opacity: 1;
    transform: none;
  }

  .gallery-lightbox {
    width: calc(100vw - 1rem);
    border-radius: 1rem;
  }

  .gallery-lightbox-bar {
    min-height: 6.3rem;
    padding: 0.85rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .gallery-lightbox-controls {
    width: 100%;
    justify-content: space-between;
  }

  .gallery-lightbox-stage {
    max-height: calc(92dvh - 6.3rem);
  }

  .gallery-lightbox-stage img {
    max-height: calc(92dvh - 6.3rem);
  }
}

@media (max-width: 25rem) {
  .gallery-hero-copy h1 {
    font-size: clamp(3.4rem, 19vw, 4.6rem);
  }

  .gallery-hero-stage {
    min-height: 27rem;
  }

  .gallery-hero-detail-bottom {
    display: none;
  }
}

@media (max-width: 60rem) and (max-height: 32rem) and (orientation: landscape) {
  .gallery-hero {
    padding-top: calc(var(--header-height) + 1.2rem);
    padding-bottom: 2.2rem;
  }

  .gallery-hero-grid {
    grid-template-columns: minmax(17rem, 0.8fr) minmax(22rem, 1.2fr);
    gap: 1.5rem;
    align-items: center;
  }

  .gallery-hero-copy .eyebrow {
    margin-bottom: 0.65rem;
  }

  .gallery-hero-copy h1 {
    max-width: 8ch;
    font-size: clamp(3.2rem, 9vw, 5rem);
  }

  .gallery-hero-copy > p:not(.eyebrow) {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 1rem;
    font-size: 0.84rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .gallery-scroll-link {
    min-height: 2.4rem;
    margin-top: 0.55rem;
    font-size: 0.66rem;
  }

  .gallery-hero-stage {
    min-height: calc(100svh - var(--header-height) - 2.4rem);
  }

  .gallery-hero-main {
    inset: 0 5% 0 9%;
  }

  .gallery-hero-detail {
    width: 7rem;
  }

  .gallery-hero-detail-bottom,
  .gallery-hero-index {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-hero-main img,
  .gallery-hero-detail {
    animation: none;
  }

  .gallery-card,
  .gallery-card img,
  .gallery-card-open,
  .gallery-scroll-link span {
    transition-duration: 0.01ms;
  }
}
