.where {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--color-text-light);
  background: var(--color-primary);
  margin-top: -1px;
}

.where__container {
  width: min(100%, calc(var(--container-width) + var(--container-padding) * 2));
  margin-inline: auto;
  padding: clamp(3.5rem, 7vh, 5.5rem) var(--container-padding)
    clamp(5rem, 10vh, 8rem);
}

.where__header {
  width: min(100%, 980px);
  margin-inline: auto;
  text-align: center;
}

.where__eyebrow {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1rem;
  padding: 0.54rem 0.9rem 0.46rem;
  border: 1px solid var(--color-border-light-soft);
  border-radius: var(--radius-full);
  color: var(--color-secondary);
  background: var(--color-glass-dark-soft);
  backdrop-filter: blur(12px);
  font-size: clamp(0.76rem, 1vw, 0.9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.where__title {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(2.7rem, 5vw, 5.2rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: skewX(-6deg);
  transform-origin: center;
  color: var(--color-white);
  text-shadow: var(--shadow-title);
}

.where__subtitle {
  max-width: 620px;
  margin: clamp(1rem, 2vw, 1.35rem) auto 0;
  color: var(--color-text-light-muted);
  font-size: clamp(1.04rem, 1.35vw, 1.18rem);
  font-weight: 700;
  line-height: 1.5;
}

.where__gallery {
  margin-top: clamp(2rem, 4vw, 3.2rem);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.35rem, 0.75vw, 0.65rem);
}

.where__item,
.where__item--featured,
.where__item--tall,
.where__item--wide {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 0;
  background: var(--color-primary);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
}

.where__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(1.1) contrast(1.04);
  transform: scale(1.01);
  transition:
    transform 480ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 480ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .where__item:hover img,
  .where__item:focus-visible img {
    filter: saturate(1.2) contrast(1.06);
    transform: scale(1.04);
  }
}

/* ================================
   Motion de entrada
   ================================ */

html.motion-enabled .where__eyebrow {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition:
    opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.motion-enabled .where__title {
  opacity: 0;
  transform: translate3d(0, 18px, 0) skewX(-6deg);
  transition:
    opacity 760ms 70ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 760ms 70ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.motion-enabled .where__subtitle {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 680ms 150ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 680ms 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.motion-enabled .where__item {
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(0.985);
  transition:
    opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 750ms cubic-bezier(0.22, 1, 0.36, 1);
}

html.motion-enabled .where__item:nth-child(1) {
  transition-delay: 210ms;
}

html.motion-enabled .where__item:nth-child(2) {
  transition-delay: 255ms;
}

html.motion-enabled .where__item:nth-child(3) {
  transition-delay: 300ms;
}

html.motion-enabled .where__item:nth-child(4) {
  transition-delay: 345ms;
}

html.motion-enabled .where__item:nth-child(5) {
  transition-delay: 390ms;
}

html.motion-enabled .where__item:nth-child(6) {
  transition-delay: 435ms;
}

html.motion-enabled .where__item:nth-child(7) {
  transition-delay: 480ms;
}

html.motion-enabled .where__item:nth-child(8) {
  transition-delay: 525ms;
}

html.motion-enabled .where.is-visible .where__eyebrow {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

html.motion-enabled .where.is-visible .where__title {
  opacity: 1;
  transform: translate3d(0, 0, 0) skewX(-6deg);
}

html.motion-enabled .where.is-visible .where__subtitle {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

html.motion-enabled .where.is-visible .where__item {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* ================================
   Lightbox
   ================================ */

.where-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) clamp(4.75rem, 8vw, 7rem)
    max(1rem, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.94);
  overscroll-behavior: contain;
}

.where-lightbox[hidden] {
  display: none;
}

.where-lightbox:not([hidden]) {
  animation: whereLightboxFadeIn 180ms ease both;
}

.where-lightbox__stage {
  width: min(100%, 72rem);
  height: min(86dvh, 56rem);
  display: grid;
  place-items: center;
  margin: 0;
}

.where-lightbox:not([hidden]) .where-lightbox__stage {
  animation: whereLightboxStageIn 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.where-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 86dvh;
  object-fit: contain;
  box-shadow: var(--shadow-soft);
  user-select: none;
  -webkit-user-drag: none;
}

.where-lightbox__close,
.where-lightbox__control {
  position: absolute;
  z-index: 2;
  width: 3.35rem;
  height: 3.35rem;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--color-border-light-soft);
  border-radius: var(--radius-full);
  color: var(--color-white);
  background: rgba(0, 0, 0, 0.56);
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.where-lightbox__close svg,
.where-lightbox__control svg {
  width: 1.4rem;
  height: 1.4rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.where-lightbox__close {
  top: max(1.25rem, env(safe-area-inset-top));
  right: max(1.25rem, env(safe-area-inset-right));
}

.where-lightbox__control {
  top: 50%;
  transform: translateY(-50%);
}

.where-lightbox__control--prev {
  left: max(1.25rem, env(safe-area-inset-left));
}

.where-lightbox__control--next {
  right: max(1.25rem, env(safe-area-inset-right));
}

@media (hover: hover) and (pointer: fine) {
  .where-lightbox__close:hover {
    border-color: var(--color-border-light-strong);
    background: rgba(0, 0, 0, 0.78);
    transform: scale(1.05);
  }

  .where-lightbox__control:hover {
    border-color: var(--color-border-light-strong);
    background: rgba(0, 0, 0, 0.78);
    transform: translateY(-50%) scale(1.05);
  }
}

.where-lightbox__close:active {
  transform: scale(0.97);
}

.where-lightbox__control:active {
  transform: translateY(-50%) scale(0.97);
}

@keyframes whereLightboxFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes whereLightboxStageIn {
  from {
    opacity: 0;
    transform: scale(0.985);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================
   Responsive
   ================================ */

@media (max-width: 1100px) {
  .where__title {
    font-size: clamp(2.9rem, 6vw, 5rem);
  }

  .where__gallery {
    gap: 0.55rem;
  }
}

@media (max-width: 900px) {
  .where__container {
    padding-top: clamp(3.75rem, 7vh, 5rem);
    padding-bottom: clamp(4.5rem, 8vh, 6rem);
  }

  .where__gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .where__title {
    white-space: normal;
    font-size: clamp(3rem, 8vw, 4.8rem);
  }

  .where__subtitle {
    max-width: 34rem;
  }

  .where-lightbox {
    padding-inline: 4.5rem;
  }

  .where-lightbox__control {
    width: 3.15rem;
    height: 3.15rem;
  }
}

@media (max-width: 760px) {
  .where__container {
    padding-top: 3.75rem;
    padding-bottom: 4.5rem;
  }

  .where__title {
    font-size: clamp(2.9rem, 10vw, 4.4rem);
  }

  .where__subtitle {
    font-size: 1rem;
    line-height: 1.55;
  }

  .where-lightbox {
    padding: max(4.75rem, env(safe-area-inset-top)) 1rem
      max(5.75rem, env(safe-area-inset-bottom));
  }

  .where-lightbox__stage {
    width: 100%;
    height: min(76dvh, 48rem);
  }

  .where-lightbox__image {
    max-height: 76dvh;
  }

  .where-lightbox__close {
    width: 3rem;
    height: 3rem;
    top: max(0.9rem, env(safe-area-inset-top));
    right: max(0.9rem, env(safe-area-inset-right));
  }

  .where-lightbox__control {
    top: auto;
    bottom: max(1.1rem, env(safe-area-inset-bottom));
    width: 3.15rem;
    height: 3.15rem;
    transform: none;
  }

  .where-lightbox__control--prev {
    left: calc(50% - 3.55rem);
  }

  .where-lightbox__control--next {
    right: calc(50% - 3.55rem);
  }

  @media (hover: hover) and (pointer: fine) {
    .where-lightbox__control:hover {
      transform: scale(1.05);
    }
  }

  .where-lightbox__control:active {
    transform: scale(0.97);
  }
}

@media (max-width: 560px) {
  .where__container {
    padding-top: 3.5rem;
    padding-bottom: 4rem;
  }

  .where__eyebrow {
    margin-bottom: 0.9rem;
    padding: 0.5rem 0.8rem 0.44rem;
    font-size: 0.74rem;
  }

  .where__title {
    font-size: clamp(2.7rem, 13vw, 4.2rem);
    line-height: 0.92;
  }

  .where__subtitle {
    margin-top: 0.9rem;
  }

  .where__gallery {
    display: flex;
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .where__gallery::-webkit-scrollbar {
    display: none;
  }

  .where__item,
  .where__item--featured,
  .where__item--tall,
  .where__item--wide {
    flex: 0 0 min(86vw, 22rem);
    height: min(66vw, 18rem);
    aspect-ratio: auto;
    scroll-snap-align: center;
  }

  html.motion-enabled .where__item:nth-child(n) {
    transition-delay: 220ms;
  }
}

@media (max-width: 380px) {
  .where__container {
    padding-top: 3.25rem;
  }

  .where__title {
    font-size: clamp(2.55rem, 12.5vw, 3.7rem);
  }

  .where__item,
  .where__item--featured,
  .where__item--tall,
  .where__item--wide {
    flex-basis: 88vw;
    height: min(68vw, 16rem);
  }

  .where-lightbox__close,
  .where-lightbox__control {
    width: 2.9rem;
    height: 2.9rem;
  }
}

@media (max-height: 680px) and (min-width: 761px) {
  .where-lightbox {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .where-lightbox__stage {
    height: 88dvh;
  }

  .where-lightbox__image {
    max-height: 88dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .where__eyebrow,
  .where__title,
  .where__subtitle,
  .where__item {
    opacity: 1;
    transition: none;
  }

  .where__eyebrow,
  .where__subtitle,
  .where__item {
    transform: none;
  }

  .where__title {
    transform: skewX(-6deg);
  }

  .where-lightbox:not([hidden]),
  .where-lightbox:not([hidden]) .where-lightbox__stage {
    animation: none;
  }
}
