/* Radiate Studio — scroll-directed gallery portal */

.gallery-section.gallery-experience {
  position: relative;
  padding: 0;
  overflow: hidden;
  overflow: clip;
  background: #080b10;
}

.gallery-section.gallery-experience::before {
  display: none;
}

.gallery-portal-track {
  position: relative;
  z-index: 1;
  background: #f2f3ef;
  color: #111318;
}

.gallery-portal-sticky {
  position: relative;
  min-height: min(940px, 100svh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(100px, 12vw, 160px) 22px 64px;
  background: #f2f3ef;
}

.gallery-portal-sticky::after {
  content: '';
  position: absolute;
  z-index: 20;
  inset: 0;
  background: #080b10;
  opacity: var(--gallery-exit, 0);
  pointer-events: none;
}

.gallery-portal-grid {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-image: radial-gradient(circle, rgba(19, 23, 28, 0.16) 1px, transparent 1.4px);
  background-size: 16px 16px;
  opacity: var(--gallery-grid-opacity, 0.56);
  transform: scale(var(--gallery-grid-scale, 1));
  transform-origin: center;
}

.gallery-portal-copy {
  position: relative;
  z-index: 6;
  order: 1;
  width: min(850px, 100%);
  margin: 0 auto;
  text-align: center;
  color: #111318;
}

.gallery-portal-copy[inert] {
  pointer-events: none;
}

.gallery-portal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: rgba(17, 19, 24, 0.62);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.gallery-portal-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #111318;
  box-shadow: 0 0 0 5px rgba(17, 19, 24, 0.08);
}

.gallery-portal-copy h2 {
  margin: 0;
  color: #111318 !important;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Georgia, serif !important;
  font-size: clamp(48px, 6vw, 88px);
  font-weight: 500;
  line-height: 0.93;
  letter-spacing: -0.06em !important;
  text-wrap: balance;
}

.gallery-portal-copy h2 span {
  display: block;
}

.gallery-portal-copy > p {
  width: min(620px, 92%);
  margin: 32px auto 0;
  color: rgba(17, 19, 24, 0.72) !important;
  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.6;
  text-wrap: pretty;
}

.gallery-portal-copy .gallery-art-note {
  margin-top: 24px;
}

.gallery-portal-copy .gallery-art-logo-link {
  border-color: rgba(17, 19, 24, 0.2);
  background: #17191d;
  color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 35px rgba(17, 19, 24, 0.16);
}

.gallery-portal-copy .gallery-art-logo-link__caption {
  border-left-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.66);
}

.gallery-portal-cards {
  position: relative;
  z-index: 2;
  order: 2;
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 52px auto 0;
}

.gallery-portal-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid rgba(17, 19, 24, 0.16);
  border-radius: 10px;
  background: #d9dcd8;
  box-shadow: 0 16px 32px rgba(17, 19, 24, 0.15);
}

.gallery-portal-card:nth-child(n + 9) {
  display: none;
}

.gallery-portal-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.gallery-portal-progress,
.gallery-portal-cue {
  display: none;
}

.gallery-browse {
  position: relative;
  z-index: 2;
  padding-top: clamp(90px, 10vw, 148px);
  padding-bottom: clamp(90px, 10vw, 148px);
}

.gallery-browse::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -1px;
  right: 50%;
  left: 50%;
  width: 100vw;
  height: 280px;
  transform: translateX(-50%);
  background:
    radial-gradient(55% 100% at 50% 0%, rgba(88, 231, 255, 0.11), transparent 70%),
    #080b10;
}

.gallery-browse__header {
  max-width: 760px;
  margin-inline: auto;
  text-align: center;
}

.gallery-browse__header h2 {
  margin-top: 12px;
  color: #ffffff !important;
  font-size: clamp(42px, 5.6vw, 72px);
  font-weight: 560;
  letter-spacing: -0.05em !important;
}

.gallery-browse__header .section-subtitle {
  margin-inline: auto;
}

/* The gallery keeps its dark exhibition floor even when the site theme is light. */
body.theme-light .gallery-experience .gallery-browse__header h2 {
  color: #ffffff !important;
}

body.theme-light .gallery-experience .gallery-browse__header .section-subtitle {
  color: rgba(225, 232, 241, 0.72) !important;
}

body.theme-light .gallery-experience .gallery-grid .gallery-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: #0a0e14;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.3);
}

body.theme-light .gallery-experience .gallery-grid .gallery-card:hover {
  border-color: rgba(58, 216, 255, 0.42);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.4);
}

.gallery-experience .gallery-grid {
  margin-top: clamp(42px, 5vw, 72px);
}

.gallery-experience .gallery-grid .gallery-card {
  padding: 0;
  font: inherit;
  text-align: left;
}

.gallery-experience .gallery-grid .gallery-card__media::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: inherit;
  pointer-events: none;
}

.gallery-experience .gallery-grid .gallery-card.gallery-card--reveal {
  animation: gallery-card-resolve 620ms cubic-bezier(0.16, 0.82, 0.22, 1) backwards;
  animation-delay: calc(var(--gallery-reveal-index, 0) * 28ms);
}

@keyframes gallery-card-resolve {
  from { opacity: 0; transform: translateY(34px) scale(0.94); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: none; }
}

.gallery-lightbox {
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.gallery-lightbox.is-open {
  visibility: visible;
  transition-delay: 0s;
}

/* Desktop: the static collage becomes a pinned perspective tunnel. */
@media (min-width: 960px) and (min-height: 720px) and (prefers-reduced-motion: no-preference) {
  .gallery-experience.gallery-scroll-ready .gallery-portal-track {
    height: 350vh;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 0;
    display: block;
    padding: 0;
    perspective: 1400px;
    transform-style: preserve-3d;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-copy {
    position: absolute;
    top: 43%;
    left: 50%;
    width: min(790px, 48vw);
    margin: 0;
    opacity: var(--gallery-copy-opacity, 1);
    transform: translate(-50%, -50%) scale(var(--gallery-copy-scale, 1));
    transform-origin: center;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-copy h2 {
    font-size: clamp(54px, 4.6vw, 88px);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-copy > p {
    width: min(580px, 90%);
    margin-top: 28px;
    font-size: clamp(14px, 1.1vw, 18px);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-copy .gallery-art-note {
    margin-top: 22px;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-cards {
    position: absolute;
    z-index: 3;
    inset: 0;
    width: auto;
    display: block;
    margin: 0;
    perspective: 1200px;
    transform-style: preserve-3d;
    pointer-events: none;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-card,
  .gallery-experience.gallery-scroll-ready .gallery-portal-card:nth-child(n + 9) {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--portal-w, 8vw);
    height: var(--portal-h, 28vh);
    display: block;
    aspect-ratio: auto;
    opacity: 0;
    border-color: rgba(17, 19, 24, 0.2);
    border-radius: clamp(7px, 0.65vw, 13px);
    box-shadow:
      0 34px 70px rgba(17, 19, 24, 0.22),
      0 8px 18px rgba(17, 19, 24, 0.12);
    transform-style: preserve-3d;
    transform-origin: center;
    backface-visibility: hidden;
  }

  .gallery-experience.gallery-scroll-ready.gallery-scroll-active .gallery-portal-copy {
    will-change: opacity, transform;
  }

  .gallery-experience.gallery-scroll-ready.gallery-scroll-active .gallery-portal-card {
    will-change: transform, opacity, filter;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: inherit;
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.06);
    pointer-events: none;
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-progress {
    position: absolute;
    z-index: 12;
    top: calc(var(--header-height, 78px) + 22px);
    bottom: 34px;
    left: 22px;
    width: 2px;
    display: block;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(17, 19, 24, 0.12);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-progress span {
    display: block;
    width: 100%;
    height: var(--gallery-progress, 0%);
    border-radius: inherit;
    background: linear-gradient(#111318, #7060ff, #f04f83);
    box-shadow: 0 0 14px rgba(112, 96, 255, 0.42);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-cue {
    position: absolute;
    z-index: 12;
    right: 28px;
    bottom: 28px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(17, 19, 24, 0.48);
    font-size: 8px;
    font-weight: 750;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: var(--gallery-cue-opacity, 1);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-cue i {
    position: relative;
    width: 34px;
    height: 1px;
    overflow: hidden;
    background: rgba(17, 19, 24, 0.16);
  }

  .gallery-experience.gallery-scroll-ready .gallery-portal-cue i::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #111318;
    transform: translateX(-100%);
    animation: gallery-cue-scan 1.8s ease-in-out infinite;
  }

  @keyframes gallery-cue-scan {
    0% { transform: translateX(-100%); }
    60%, 100% { transform: translateX(100%); }
  }
}

@media (max-width: 760px) {
  .gallery-portal-sticky {
    min-height: 0;
    padding-top: 90px;
  }

  .gallery-portal-copy h2 {
    font-size: clamp(44px, 13vw, 64px);
  }

  .gallery-portal-copy > p {
    font-size: 15px;
  }

  .gallery-portal-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-portal-card:nth-child(n + 7) {
    display: none;
  }
}

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

  .gallery-portal-card:nth-child(n + 5) {
    display: none;
  }

  .gallery-portal-copy .gallery-art-logo-link {
    gap: 9px;
  }

  .gallery-portal-copy .gallery-art-logo-link__caption {
    padding-left: 9px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-experience .gallery-grid .gallery-card,
  .gallery-portal-grid,
  .gallery-portal-sticky::after {
    animation: none !important;
    transition: none !important;
  }
}
