.gallery {
  padding: var(--space-2xl) 0 var(--space-3xl);
  overflow: hidden;
}

.gallery__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 48px;
}

.gallery__title {
  margin: 0 0 24px;
  max-width: 18em;
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--fg);
}

.gallery__subtitle {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--muted);
}

.gallery__categories {
  position: relative;
  margin-bottom: 48px;
}

.gallery__categories-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.chip svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.chip:hover svg {
  transform: scale(1.2);
}

.chip:hover {
  color: var(--fg);
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
}

.chip.is-active {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.gallery__grid {
  display: grid;
  grid-template-columns: minmax(280px, 34%) minmax(0, 66%);
  align-items: stretch;
  min-height: var(--carousel-frame);
}

.gallery__info {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  height: var(--carousel-frame);
  pointer-events: none;
  background: var(--bg);
}

.gallery__info::before {
  content: "";
  position: absolute;
  top: -40px;
  bottom: -40px;
  right: 100%;
  width: 100vw;
  background: var(--bg);
  z-index: 3;
  pointer-events: none;
}

.gallery__info-content {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 150%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding-top: 64px;
  background: transparent;
}

.gallery__info-content > * {
  position: relative;
  z-index: 1;
}

.gallery__info-content .gallery__blur-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: color-mix(in oklch, var(--bg) 14%, transparent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-backdrop-filter: blur(var(--gallery-blur, 10px));
  backdrop-filter: blur(var(--gallery-blur, 10px));
}

.gallery__blur-layer--5 {
  --gallery-blur: 5px;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 3%, #000 6%);
  mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 3%, #000 6%);
}

.gallery__blur-layer--10 {
  --gallery-blur: 10px;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 6%, #000 12%);
  mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 6%, #000 12%);
}

.gallery__blur-layer--15 {
  --gallery-blur: 15px;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 12%, #000 20%);
  mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 12%, #000 20%);
}

.gallery__blur-layer--20 {
  --gallery-blur: 20px;
  background-color: color-mix(in oklch, var(--bg) 18%, transparent);
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 20%, #000 32%);
  mask-image: linear-gradient(to left, transparent 0%, rgb(0 0 0 / 0.6) 20%, #000 32%);
}

.gallery__text-wrapper {
  position: relative;
  z-index: 2;
  width: min(490px, calc(100% - 48px));
  max-width: 490px;
  margin-left: 64px;
  pointer-events: auto;
}

.gallery__model-title {
  margin: 0 0 24px;
  min-height: 1.05em;
  font-family: var(--font-accent);
  font-size: clamp(44px, 5.2vw, 72px);
  font-weight: 700;
  font-style: italic;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 30, "WONK" 1;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--fg);
}

.gallery__description {
  margin: 0;
  min-height: 4.8em;
  font-size: 18px;
  line-height: 1.35;
  color: var(--muted);
}

.gallery__model-title.is-swap,
.gallery__description.is-swap {
  animation: text-fade 200ms ease-out;
}

@keyframes text-fade {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

.gallery__cta {
  position: relative;
  z-index: 25;
  flex-shrink: 0;
  align-self: flex-start;
  width: max-content;
  max-width: calc(100% - 64px);
  margin-top: 32px;
  margin-left: 64px;
  white-space: nowrap;
  pointer-events: auto;
}

.gallery__cta svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.gallery__carousel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--carousel-frame);
  margin-left: -80px;
  overflow: visible;
}

.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}

.carousel__controls {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.carousel__btn {
  position: absolute;
  top: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 2px 8px oklch(0 0 0 / 0.18);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.7;
  translate: 0 -50%;
  transition: opacity 0.3s, background 180ms ease;
}

.carousel__btn:hover {
  background: var(--surface-2);
}

.carousel__btn--prev {
  left: 30%;
  translate: -50% -50%;
}

.carousel__btn--next {
  right: 0;
}

.carousel:hover .carousel__btn,
.carousel:hover .carousel__author {
  opacity: 1;
}

.carousel__btn svg {
  width: 16px;
  height: 16px;
}

.carousel__stage {
  position: relative;
  width: 100%;
  height: var(--carousel-h);
  perspective: 1400px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  transform: translateZ(0);
  pointer-events: none;
}

@media (min-width: 1200px) {
  .carousel__stage {
    perspective: 1800px;
  }
}

.carousel__slide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: var(--carousel-h);
  aspect-ratio: 340 / 600;
  transform-origin: center center;
  transform: translate(-50%, -50%) translate(var(--carousel-tx, 0px))
    translateZ(var(--carousel-tz, 0px)) rotateY(var(--carousel-rotY, 0deg))
    scale(var(--carousel-scale, 1));
  opacity: var(--carousel-opacity, 1);
  z-index: var(--carousel-z, 1);
  pointer-events: var(--carousel-pointer-events, auto);
  transition: var(--carousel-transition);
  will-change: transform, opacity;
}

.carousel__slide.is-off {
  transition: none;
  visibility: hidden;
}

.carousel__media-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  pointer-events: auto;
  box-shadow: 0 18px 40px oklch(0 0 0 / 0.14);
  mask-image: radial-gradient(#fff, #000);
}

.carousel__iris {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 38%, transparent 72%);
  mask-image: linear-gradient(to right, #000 0%, #000 38%, transparent 72%);
}

.carousel__slide.is-peek-left .carousel__iris {
  display: block;
}

@media (max-width: 1199px) {
  .carousel__slide.is-peek-left .carousel__iris,
  .carousel__iris {
    display: none !important;
  }
}

.carousel__iris-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(28px);
  transform: scale(1.18);
}

.carousel__iris::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--bg) 22%, transparent);
}

.carousel__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r);
}

.carousel img.carousel__media {
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
}

.carousel video.carousel__media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.carousel__slide.is-active .carousel__media-wrapper:hover video.carousel__media {
  opacity: 1;
}

.carousel__volume {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.25s;
}

.carousel__slide.is-active .carousel__volume,
.carousel__media-wrapper:hover .carousel__volume {
  opacity: 1;
}

.carousel__volume-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: oklch(0.18 0.02 50 / 0.55);
  color: var(--card-ink);
  cursor: pointer;
}

.carousel__volume-btn svg {
  width: 16px;
  height: 16px;
}

.prompt-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.prompt-overlay__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(
    to top,
    color-mix(in oklch, var(--overlay) 92%, transparent) 0%,
    color-mix(in oklch, var(--overlay) 70%, transparent) 55%,
    transparent 100%
  );
  color: var(--card-ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.carousel__slide.is-active .carousel__media-wrapper:hover .prompt-overlay__content,
.prompt-overlay__content.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.prompt-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompt-overlay__label {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.prompt-overlay__copy {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.prompt-overlay__copy svg {
  width: 16px;
  height: 16px;
}

.prompt-overlay__text {
  margin: 0;
  max-height: 4.5em;
  font-size: 13px;
  line-height: 1.5;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: currentColor transparent;
}

.carousel__author {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.9;
  transition: opacity 0.3s;
}

.carousel__author:empty,
.carousel__slide--cover .carousel__author,
.carousel__slide--cover .prompt-overlay {
  display: none;
}

@media (max-width: 1199px) {
  .gallery__grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
  }

  .gallery__info,
  .gallery__carousel {
    width: 100%;
    height: auto;
    margin-left: 0;
  }

  .gallery__info {
    height: auto;
    justify-content: flex-start;
    pointer-events: auto;
  }

  .gallery__info-content {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
    padding-top: 0;
    align-items: center;
    text-align: center;
  }

  .gallery__info::before {
    display: none;
  }

  .gallery__info {
    background: transparent;
  }

  .gallery__blur-layer {
    display: none;
  }

  .gallery__text-wrapper {
    margin-left: 0;
    margin-right: 0;
    width: min(480px, 100%);
    max-width: 480px;
    text-align: center;
  }

  .gallery__description {
    max-width: 480px;
    min-height: 0;
    margin-inline: auto;
  }

  .gallery__model-title {
    min-height: 0;
  }

  .gallery__cta {
    align-self: center;
    width: max-content;
    max-width: 100%;
    min-height: 48px;
    margin-top: 24px;
    margin-inline: auto;
    padding: 12px 28px;
  }

  .gallery__carousel {
    height: calc(var(--carousel-h) + 48px);
    overflow: hidden;
  }

  .carousel__btn {
    width: 44px;
    height: 44px;
    opacity: 1;
  }

  .carousel__btn--prev {
    left: 8px;
    translate: 0 -50%;
  }

  .carousel__btn--next {
    right: 8px;
  }

  .carousel__stage {
    perspective: 1400px;
  }

  .carousel:hover .carousel__btn,
  .carousel:hover .carousel__author {
    opacity: 1;
  }
}

@media (max-width: 991px) {
  .gallery {
    padding: 48px 0 64px;
  }

  .gallery__header {
    margin-bottom: 24px;
  }

  .gallery__title {
    margin-bottom: 12px;
  }

  .gallery__subtitle {
    font-size: clamp(16px, 3.6vw, 22px);
  }

  .gallery__categories {
    margin-bottom: 20px;
  }

  .gallery__categories::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 36px;
    background: linear-gradient(90deg, transparent, var(--bg));
    pointer-events: none;
  }

  .gallery__categories-inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
    padding-right: 28px;
    -webkit-overflow-scrolling: touch;
  }

  .gallery__categories-inner::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex-shrink: 0;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .gallery__cta {
    display: flex;
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    min-height: 52px;
    margin-top: 20px;
    padding: 14px 20px;
    font-size: 15px;
  }
}

@media (max-width: 767px) {
  .gallery {
    padding: 36px 0 56px;
  }

  .gallery__model-title {
    font-size: clamp(32px, 10vw, 40px);
    margin-bottom: 12px;
  }

  .gallery__description {
    font-size: 16px;
  }

  .gallery__carousel {
    height: calc(var(--carousel-h) + 40px);
    margin-inline: calc(var(--gutter) * -1);
    width: calc(100% + var(--gutter) * 2);
  }

  .prompt-overlay__content {
    height: 62%;
    padding: 12px;
  }

  .prompt-overlay__text {
    font-size: 12px;
    max-height: 5.5em;
  }
}

@media (min-width: 1200px) and (max-width: 1439px) {
  .gallery__grid {
    grid-template-columns: minmax(260px, 36%) minmax(0, 64%);
  }

  .gallery__carousel {
    margin-left: -64px;
  }

  .gallery__info-content {
    padding-top: 48px;
  }

  .gallery__text-wrapper {
    max-width: 400px;
    width: min(400px, calc(100% - 24px));
    margin-left: 32px;
  }

  .gallery__cta {
    margin-left: 32px;
    max-width: calc(100% - 32px);
  }

  .gallery__description {
    min-height: 4.4em;
  }

  .carousel__btn--prev {
    left: 28%;
  }
}

@media (hover: none) {
  .carousel__slide.is-active .carousel__volume {
    opacity: 1;
  }

  .carousel__btn {
    opacity: 1;
  }
}
