/**
 * Retro Photos — Base Styles (layout, structure & motion only)
 *
 * "Polaroids on the wall": a grid of taped polaroids at staggered angles. Each
 * straightens, lifts and rises above its neighbours on hover/focus. Visual
 * treatment (paper, polaroid white, tape, type) lives in styles/retro.css. The
 * wized hooks match editorial-photos.
 */

.retro-photos {
  position: relative;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.retro-photos__inner {
  max-width: 80rem;
  margin: 0 auto;
}

/* ───────────────────────────────────────────────────────── HEADER */

.retro-photos__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
  margin-bottom: clamp(2rem, 4.5vw, 3.25rem);
}

.retro-photos__kicker {
  margin: 0;
  font-family: var(--body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.retro-photos__title-h {
  margin: 0;
  font-family: var(--header);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 0.98;
}

/* ──────────────────────────────────────────────────────── GALLERY */

.retro-photos__gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.75rem, 3.5vw, 2.75rem);
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ---- polaroid ---- */

.retro-photos__item {
  position: relative;
  margin: 0;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.32s ease;
}

/* staggered angles — clones become the gallery's children, so nth-child cycles */
.retro-photos__item:nth-child(4n+1) { transform: rotate(-2.5deg); }
.retro-photos__item:nth-child(4n+2) { transform: rotate(1.6deg); }
.retro-photos__item:nth-child(4n+3) { transform: rotate(-1deg); }
.retro-photos__item:nth-child(4n+4) { transform: rotate(2.4deg); }

/* pick it up: straighten, lift, raise above neighbours */
.retro-photos__item:hover,
.retro-photos__item:focus-within {
  transform: rotate(0deg) translateY(-7px) scale(1.02);
  z-index: 2;
}

.retro-photos__content {
  position: relative;
}

/* tape strip pinning the polaroid to the wall */
.retro-photos__tape {
  position: absolute;
  top: -0.7rem;
  left: 50%;
  width: 4.5rem;
  height: 1.5rem;
  transform: translateX(-50%) rotate(-3deg);
  z-index: 3;
  pointer-events: none;
}

.retro-photos__item:nth-child(even) .retro-photos__tape {
  transform: translateX(-50%) rotate(4deg);
}

/* ---- photo ---- */

.retro-photos__image-wrap {
  position: relative;
  overflow: hidden;
}

.retro-photos__image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* download arrow — corner button, appears when the photo is picked up */
.retro-photos__download {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 3px;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s ease, background-color 0.2s ease, color 0.2s ease;
}

.retro-photos__item:hover .retro-photos__download,
.retro-photos__item:focus-within .retro-photos__download {
  opacity: 1;
  transform: translateY(0);
}

.retro-photos__download:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  opacity: 1;
  transform: translateY(0);
}

/* ---- caption (the handwritten bottom strip) ---- */

.retro-photos__caption {
  font-family: var(--body);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.3;
  text-align: center;
  min-height: 1.3em;          /* reserve the strip even when a photo has no caption */
}

/* ───────────────────────────────────────────────────── RESPONSIVE */

@media screen and (max-width: 767px) {
  .retro-photos__gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 479px) {
  .retro-photos__gallery {
    grid-template-columns: 1fr;
    max-width: 22rem;
    margin: 0 auto;
  }
}

/* ───────────────────────────────────────────────── REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
  .retro-photos__item {
    transition: none;
  }
  .retro-photos__item:hover,
  .retro-photos__item:focus-within {
    transform: rotate(0deg);   /* straighten only, no lift/scale */
  }
  .retro-photos__download {
    transition: opacity 0.2s ease;
    transform: none;
  }
}
