/* ==========================================================================
   7. Memórias (Design System 7.9: carrossel)
   Fundo night-900 · fotos grandes com raio 14 · seta anterior em contorno
   creme, próxima em dourado · pontos (ativo em pill dourado de 22 px) ·
   cerca de 1,15 foto visível no celular · sem autoplay · foto ampliada.
   ========================================================================== */

.nes-memorias {
  overflow: hidden;
  background: var(--nes-night-900);
  color: var(--nes-cream-100);
}

.nes-memorias__head {
  max-width: 720px;
}

.nes-memorias__eyebrow {
  color: var(--nes-gold-400); /* dourado sobre azul-noite: AA */
}

.nes-memorias__title {
  color: var(--nes-white);
}

.nes-memorias__text {
  color: rgba(248, 240, 224, .9);
}

/* --- Trilha --- */
.nes-carousel {
  --nes-slide-w: 86%;
  --nes-slide-gap: var(--nes-space-3);
}

.nes-carousel__viewport {
  /* no celular a trilha vai de borda a borda; a próxima foto aparece cortada */
  margin-inline: calc(-1 * var(--nes-margin));
}

.nes-carousel .nes-carousel__track { /* vence o reset de lista (.nes-page :where(ul).nes-list-reset) */
  position: relative;
  display: flex;
  gap: var(--nes-slide-gap);
  padding: 4px var(--nes-margin) 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--nes-margin);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nes-carousel__track::-webkit-scrollbar {
  display: none;
}

.nes-carousel__track:focus-visible {
  outline: 3px solid var(--nes-cream-100);
  outline-offset: -3px;
}

.nes-carousel__slide {
  flex: none;
  width: var(--nes-slide-w);
  scroll-snap-align: start;
}

.nes-carousel__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--nes-night-950);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
  cursor: zoom-in;
  aspect-ratio: 3 / 2;
}

.nes-carousel__open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--nes-ease);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .nes-carousel__open:hover img {
    transform: scale(1.03);
  }
}

.nes-carousel__open:focus-visible {
  outline: 3px solid var(--nes-cream-100);
  outline-offset: 3px;
}

/* --- Setas + pontos --- */
.nes-carousel__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--nes-space-4) var(--nes-space-3);
  margin-top: var(--nes-space-5);
}

.nes-carousel__dots {
  order: -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* 14 pontos de 24 px: no celular a fileira usa a largura toda da tela */
  width: calc(100% + 2 * var(--nes-margin));
  margin-inline: calc(-1 * var(--nes-margin));
}

.nes-carousel__dot {
  display: grid;
  place-items: center;
  width: 24px; /* área de toque mínima WCAG 2.2 (24 × 24) */
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.nes-carousel__dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--nes-radius-pill);
  background: rgba(248, 240, 224, .45);
  transition: width var(--nes-dur) var(--nes-ease), background-color var(--nes-dur) var(--nes-ease);
}

.nes-carousel__dot[aria-current="true"] {
  width: 30px;
}

.nes-carousel__dot[aria-current="true"]::before {
  width: 22px;
  background: var(--nes-gold-400);
}

.nes-carousel__dot:focus-visible {
  outline: 3px solid var(--nes-cream-100);
  outline-offset: -2px;
  border-radius: 6px;
}

.nes-carousel__arrow {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--nes-cream-100);
  border-radius: 50%;
  background: transparent;
  color: var(--nes-cream-100);
  cursor: pointer;
  transition: background-color var(--nes-dur-fast) var(--nes-ease), opacity var(--nes-dur-fast) var(--nes-ease);
}

.nes-carousel__arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nes-carousel__arrow--prev:hover {
  background: rgba(248, 240, 224, .12);
}

.nes-carousel__arrow--next {
  border-color: var(--nes-gold-400);
  background: var(--nes-gold-400);
  color: var(--nes-night-900);
  box-shadow: 0 4px 0 var(--nes-gold-500);
}

.nes-carousel__arrow--next:hover {
  background: #F2B65A;
}

.nes-carousel__arrow:focus-visible {
  outline: 3px solid var(--nes-cream-100);
  outline-offset: 3px;
}

.nes-carousel__arrow:disabled {
  opacity: .35;
  box-shadow: none;
  cursor: default;
}

/* --------------------------------------------------------------------------
   Tablet / desktop
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .nes-carousel {
    --nes-slide-w: 74%;
    --nes-slide-gap: var(--nes-space-5);
  }

  .nes-carousel__controls {
    flex-wrap: nowrap;
    gap: var(--nes-space-5);
  }

  .nes-carousel__dots {
    order: 0;
    width: auto;
    margin-inline: 0;
  }
}

@media (min-width: 1024px) {
  .nes-carousel {
    --nes-slide-w: 62%;
  }

  /* desktop: a trilha passa da margem direita e mostra a próxima foto */
  .nes-carousel__viewport {
    margin-inline: 0 calc(-1 * max(var(--nes-margin), (100vw - var(--nes-container)) / 2 + var(--nes-margin)));
  }

  .nes-carousel .nes-carousel__track {
    padding-inline: 0 var(--nes-margin);
    scroll-padding-inline: 0;
  }

  .nes-carousel__controls {
    justify-content: flex-start;
  }
}

/* --------------------------------------------------------------------------
   Foto ampliada (<dialog>)
   -------------------------------------------------------------------------- */
html.nes-lightbox-open {
  overflow: hidden;
}

.nes-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--nes-cream-100);
}

.nes-lightbox::backdrop {
  background: rgba(10, 14, 28, .94);
}

.nes-lightbox__inner {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 72px var(--nes-margin) 88px;
}

.nes-lightbox__img {
  max-width: 100%;
  max-height: calc(100dvh - 160px); /* espaço para o fechar (topo) e o contador (base) */
  width: auto;
  height: auto;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  touch-action: pan-y;
  user-select: none;
}

.nes-lightbox__counter {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 600;
  font-size: var(--nes-fs-small);
  letter-spacing: .08em;
}

.nes-lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid var(--nes-cream-100);
  border-radius: 50%;
  background: rgba(20, 27, 51, .6);
  color: var(--nes-cream-100);
  cursor: pointer;
}

.nes-lightbox__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nes-lightbox__btn:hover {
  background: rgba(248, 240, 224, .16);
}

.nes-lightbox__btn:focus-visible {
  outline: 3px solid var(--nes-gold-400);
  outline-offset: 3px;
}

.nes-lightbox__close {
  top: 16px;
  right: 16px;
}

.nes-lightbox__prev,
.nes-lightbox__next {
  bottom: 16px;
}

.nes-lightbox__prev { left: var(--nes-margin); }
.nes-lightbox__next { right: var(--nes-margin); }

@media (min-width: 768px) {
  .nes-lightbox__inner {
    padding: 72px 96px;
  }

  .nes-lightbox__img {
    max-height: calc(100dvh - 144px);
  }

  .nes-lightbox__prev,
  .nes-lightbox__next {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .nes-lightbox__prev { left: 24px; }
  .nes-lightbox__next { right: 24px; }
}

/* celulares estreitos: 15 pontos de 24 px não cabem numa linha.
   22 px por ponto; as setas já fazem a mesma função (exceção "controle equivalente" do WCAG 2.5.8). */
@media (max-width: 399px) {
  .nes-carousel__dot {
    width: 22px;
  }

  .nes-carousel__dot[aria-current="true"] {
    width: 28px;
  }
}
