.gallery-page {
  min-height: 100vh;
  min-height: 100svh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 18%),
    var(--paper);
}

.gallery-page .initial-loader {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 247, 244, 0.94)),
    var(--paper);
  color: var(--ink);
}

.gallery-loader-mark {
  gap: 1rem;
}

.gallery-loader-kicker,
.gallery-loader-label {
  margin: 0;
  font-family: "Instrument Serif", "Times New Roman", serif;
  letter-spacing: 0.04em;
}

.gallery-loader-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.18rem 0.52rem 0.24rem;
  background: #2450e6;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.gallery-loader-label {
  width: 20ch;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  color: #173ab0;
}

.gallery-loader-label span {
  display: inline-block;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  animation: gallery-loader-write 1.1s steps(15, end) forwards;
}

.gallery-loader-label span::after {
  background: currentColor;
}

.gallery-loader-note {
  margin: -0.2rem 0 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(16, 26, 36, 0.48);
}

.gallery-page .subpage-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  width: min(86rem, calc(100vw - 2.8rem));
  margin: 0 auto;
  padding: 1.4rem 0 1.1rem;
  background: transparent;
}

.gallery-page .subpage-brand,
.gallery-page .subpage-nav a {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.035em;
  text-shadow: none;
}

.gallery-page .subpage-brand {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.18rem 0.46rem 0.24rem;
  background: #2450e6;
  color: #ffffff;
  line-height: 1;
}

.gallery-page .subpage-nav {
  gap: 0.55rem;
  color: inherit;
}

.gallery-page .subpage-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.18rem 0.42rem 0.24rem;
  background: #2450e6;
  color: #ffffff;
  line-height: 1;
}

.gallery-page .subpage-nav a:hover,
.gallery-page .subpage-nav a:focus-visible {
  background: #1f46cb;
  color: #ffffff;
}

.gallery-page .subpage-nav a[aria-current="page"] {
  background: #173ab0;
  color: #ffffff;
}

.gallery-page .subpage-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.gallery-stage-main {
  display: block;
}

.gallery-spill-shell {
  position: relative;
  min-height: var(--gallery-track-height, 170svh);
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: none;
  box-shadow: none;
}

.gallery-spill-shell::before {
  display: none;
}

.gallery-spill-stage {
  position: relative;
  min-height: inherit;
  isolation: isolate;
  --gallery-piece-drift: 0px;
  --gallery-ghost-drift: 0px;
  --gallery-cursor-x: 0px;
  --gallery-cursor-y: 0px;
}

.gallery-ghost-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transform:
    translate3d(
      calc(var(--gallery-cursor-x, 0px) * 0.28),
      calc(var(--gallery-ghost-drift) + var(--gallery-cursor-y, 0px) * 0.28),
      0
    );
  will-change: transform;
}

.gallery-ghost-layer::after {
  content: "";
  position: absolute;
  left: 50%;
  top: var(--ghost-focus-top, 0px);
  width: var(--ghost-focus-width, 0px);
  height: var(--ghost-focus-height, 0px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.96), rgba(250, 250, 249, 0.84) 18%, rgba(244, 244, 242, 0.28) 58%, rgba(244, 244, 242, 0) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(250, 250, 249, 0.66) 28%, rgba(244, 244, 242, 0.18) 68%, rgba(244, 244, 242, 0) 100%);
  filter: blur(var(--ghost-focus-blur, 24px));
  transition:
    opacity 280ms ease,
    top 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    width 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    height 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    filter 560ms cubic-bezier(0.2, 0.7, 0.15, 1);
}

.gallery-spill-stage.has-active-piece .gallery-ghost-layer::after {
  opacity: 1;
}

.gallery-ghost {
  position: absolute;
  left: var(--ghost-left, 50%);
  top: var(--ghost-top, 20svh);
  width: var(--ghost-width, 8rem);
  aspect-ratio: var(--ghost-ratio, 4 / 5);
  opacity: var(--ghost-opacity, 0.24);
  transform:
    translate(-50%, -50%)
    translate3d(
      calc(var(--gallery-cursor-x, 0px) * var(--ghost-depth, 0.5) * 1.45),
      calc(var(--gallery-cursor-y, 0px) * var(--ghost-depth, 0.5) * 1.45),
      0
    );
  background: rgb(217, 219, 221);
  box-shadow: 0 18px 34px rgba(48, 56, 64, 0.08);
  z-index: 1;
  pointer-events: none;
  will-change: transform;
}

.gallery-piece-layer {
  position: relative;
  z-index: 3;
  transform: translate3d(0, var(--gallery-piece-drift), 0);
  will-change: transform;
}

.gallery-active-layer {
  position: fixed;
  inset: 0;
  z-index: 27;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

.gallery-active-layer.is-hidden {
  opacity: 0;
}

.gallery-active-piece {
  position: absolute;
  left: 50%;
  top: 47%;
  width: var(--gallery-active-width, min(42vw, 32rem));
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 34px 48px rgba(55, 72, 88, 0.24));
}

.gallery-active-piece-inner {
  display: block;
  width: 100%;
  transform:
    translate3d(
      var(--gallery-active-origin-x, 0px),
      var(--gallery-active-origin-y, 0px),
      0
    )
    scale(var(--gallery-active-origin-scale, 1));
  transform-origin: center center;
  transition: transform 620ms cubic-bezier(0.18, 0.76, 0.16, 1);
  will-change: transform;
}

.gallery-active-piece-inner img,
.gallery-active-piece-inner .gallery-piece-fallback {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-piece {
  position: absolute;
  left: 50%;
  top: 24svh;
  z-index: var(--piece-z, 4);
  display: block;
  width: clamp(11rem, 18vw, 16rem);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: var(--piece-render-opacity, var(--piece-opacity, 0.92));
  transform:
    translate(-50%, -50%)
    rotate(var(--piece-rotate, 0deg))
    scale(var(--piece-scale, 1));
  transform-origin: center center;
  transition:
    left 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    top 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    width 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    transform 560ms cubic-bezier(0.2, 0.7, 0.15, 1),
    opacity 220ms ease,
    filter 220ms ease;
  filter: drop-shadow(0 26px 38px rgba(84, 101, 117, 0.18));
}

.gallery-piece:hover,
.gallery-piece:focus-visible {
  opacity: 1;
  filter: drop-shadow(0 30px 42px rgba(69, 86, 101, 0.22));
}

.gallery-piece:focus-visible {
  outline: none;
}

.gallery-piece.is-active {
  z-index: 27;
  filter: drop-shadow(0 34px 48px rgba(55, 72, 88, 0.24));
}

.gallery-piece-frame,
.gallery-piece-surface {
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
  border-radius: 0;
  overflow: visible;
  background: none;
  box-shadow: none;
}

.gallery-piece-frame {
  transform:
    translate3d(
      calc(var(--gallery-cursor-x, 0px) * var(--piece-depth, 1) * 1.55),
      calc(var(--gallery-cursor-y, 0px) * var(--piece-depth, 1) * 1.55),
      0
    );
  will-change: transform;
}

.gallery-piece.is-active .gallery-piece-frame {
  transform: translate3d(0, 0, 0);
}

.gallery-piece img {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}

.gallery-piece-fallback {
  display: block;
  width: 100%;
  min-height: 12rem;
  border-radius: 0.7rem;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.46), transparent 24%),
    linear-gradient(160deg, rgba(232, 237, 242, 0.94), rgba(214, 223, 231, 0.94));
}

.gallery-focus-caption {
  position: fixed;
  left: 50%;
  top: var(--gallery-focus-top, auto);
  z-index: 28;
  display: grid;
  gap: 0.28rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 1.4rem 0.75rem;
  border-radius: 0;
  text-align: center;
  background: #2450e6;
  pointer-events: none;
  transform: translateX(-50%);
  transition:
    top 260ms cubic-bezier(0.2, 0.7, 0.15, 1),
    opacity 220ms ease,
    transform 220ms ease;
}

.gallery-focus-caption.is-hidden {
  opacity: 0;
  transform: translate(-50%, 0.8rem);
}

.gallery-focus-date,
.gallery-focus-title {
  margin: 0;
}

.gallery-focus-date {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

.gallery-focus-title {
  font-family: "Instrument Serif", "Times New Roman", serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 3.2vw, 2.7rem);
  line-height: 0.92;
  letter-spacing: 0.035em;
  color: #ffffff;
}

.gallery-empty-state {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 7rem 1.2rem 2rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .gallery-piece {
    width: min(52vw, 14rem);
  }

  .gallery-active-piece {
    width: var(--gallery-active-width, min(76vw, 21rem));
  }

  .gallery-focus-caption {
    padding: 0.65rem 1.1rem 0.7rem;
  }

  .gallery-focus-title {
    font-size: clamp(1.55rem, 7.6vw, 2.1rem);
  }
}

@media (max-width: 680px) {
  .gallery-page .subpage-header {
    width: min(calc(100vw - 2rem), 86rem);
  }

  .gallery-loader-label {
    width: 17ch;
    font-size: clamp(1.15rem, 6vw, 1.6rem);
  }

  .gallery-loader-label span {
    animation: gallery-loader-write-mobile 1.1s steps(15, end) forwards;
  }
}

@keyframes gallery-loader-write {
  from {
    width: 0;
  }

  to {
    width: 20ch;
  }
}

@keyframes gallery-loader-write-mobile {
  from {
    width: 0;
  }

  to {
    width: 17ch;
  }
}
