/* ============================================================
   nosotros.css — Storytelling cinemático/pinned + galerías
   1 scrolly section (4 fotos sticky cycling) + 4 galerías
   ============================================================ */

.nosotros {
  display: block;
  background-color: var(--color-bg);
}

/* ════════════════════════════════════════════════════════════
   HERO — cinemático full-viewport
   ════════════════════════════════════════════════════════════ */
.nosotros-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: var(--color-white);
  isolation: isolate;
}

.nosotros-hero__media { position: absolute; inset: 0; z-index: 0; }
.nosotros-hero__media picture,
.nosotros-hero__media img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
}

.nosotros-hero__veil {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg,
      rgba(16, 12, 8, 0.10) 0%,
      rgba(16, 12, 8, 0.18) 32%,
      rgba(16, 12, 8, 0.55) 65%,
      rgba(16, 12, 8, 0.88) 100%);
  pointer-events: none;
}

.nosotros-hero__inner {
  position: relative; z-index: 2; width: 100%;
  padding-block: clamp(5rem, 12vh, 9rem);
}

.nosotros-hero__eyebrow {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
  margin-bottom: clamp(1rem, 2vh, 1.5rem);
}

.nosotros-hero__title {
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 7.4vw, 6.4rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.045em;
  color: var(--color-white);
  max-width: 14ch;
  text-wrap: balance;
  margin: 0;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.18);
}

.nosotros-hero__lead {
  margin: clamp(1.5rem, 3vh, 2.5rem) 0 0 0;
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.85);
  max-width: 58ch;
}

.nosotros-hero__cue {
  position: absolute;
  bottom: clamp(1.5rem, 3vh, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 1px;
  height: clamp(2.4rem, 5vh, 4rem);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
  animation: nosotros-hero-cue 2.6s ease-in-out infinite;
}

@keyframes nosotros-hero-cue {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 1;   transform: translateX(-50%) translateY(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .nosotros-hero__cue { animation: none; }
}

/* ════════════════════════════════════════════════════════════
   STORY — scrollytelling pinned. Foto sticky + 4 capítulos
   Default (mobile/tablet): foto sticky top, steps debajo
   Desktop ≥1024: foto sticky a la izquierda, steps a la derecha
   ════════════════════════════════════════════════════════════ */
.nosotros-story {
  position: relative;
  background-color: var(--color-bg);
  color: var(--color-primary);
  padding-block: clamp(2rem, 5vh, 4rem);
}

.nosotros-story__inner {
  position: relative;
}

/* Foto sticky (default mobile/tablet) */
.nosotros-story__sticky {
  --shield-h: calc(var(--navbar-height) + var(--space-2));
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: var(--shield-h);
  margin-top: calc(var(--shield-h) * -1);
  background-color: var(--color-bg);
}

.nosotros-story__stack {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 48svh;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background-color: rgba(38, 28, 18, 0.04);
}

.nosotros-story__frame {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: opacity;
  pointer-events: none;
}

.nosotros-story__frame.is-active { opacity: 1; }

.nosotros-story__frame picture,
.nosotros-story__frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Frame con 4 fotos en grilla 2x2 (mismo tamaño) */
.nosotros-story__quad {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: clamp(0.4rem, 0.6vw, 0.7rem);
}

.nosotros-story__quad > picture {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background-color: rgba(38, 28, 18, 0.06);
}

.nosotros-story__quad > picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Steps (texto) */
.nosotros-story__steps { position: relative; z-index: 0; }

.nosotros-story__step {
  min-height: 80svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(3rem, 7vh, 5rem);
}

.nosotros-story__step:first-child { padding-top: clamp(2rem, 5vh, 3rem); }
.nosotros-story__step:last-child  { padding-bottom: clamp(4rem, 10vh, 7rem); }

.nosotros-story__roman {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 1vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--color-accent);
  margin-bottom: clamp(0.9rem, 1.8vh, 1.4rem);
}

.nosotros-story__roman::before {
  content: "";
  display: inline-block;
  width: 1.8rem;
  height: 1px;
  background-color: var(--color-accent);
}

.nosotros-story__title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--color-primary);
  margin: 0 0 clamp(1.2rem, 2.4vh, 2rem) 0;
  text-wrap: balance;
}

/* Capítulo IV — título más largo, achicar para mantenerlo en 2 líneas */
.nosotros-story__step[data-scrolly-step="3"] .nosotros-story__title {
  font-size: clamp(1.7rem, 3.2vw, 2.8rem);
}

.nosotros-story__step p {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.15vw, 1.12rem);
  line-height: 1.85;
  color: rgba(38, 28, 18, 0.72);
  max-width: 52ch;
  margin: 0;
}

.nosotros-story__step p + p { margin-top: clamp(1rem, 2vh, 1.5rem); }

/* Desktop ≥1024: side-by-side */
@media (min-width: 1024px) {
  .nosotros-story__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: clamp(3rem, 6vw, 6.5rem);
    align-items: start;
  }

  .nosotros-story__sticky {
    --shield-h: 0px;
    position: sticky;
    top: clamp(96px, 14vh, 144px);
    padding-top: 0;
    margin-top: 0;
    height: clamp(440px, 72svh, 720px);
  }

  .nosotros-story__stack {
    height: 100%;
    aspect-ratio: auto;
    max-height: none;
  }

  .nosotros-story__steps { padding-block: clamp(2rem, 6vh, 5rem); }

  .nosotros-story__step { min-height: 78svh; }
  .nosotros-story__step:first-child { padding-top: 0; }
}

/* ════════════════════════════════════════════════════════════
   GALLERIES — 4 bloques temáticos
   ════════════════════════════════════════════════════════════ */
.nosotros-galleries {
  background-color: var(--color-bg);
  padding-block: clamp(4rem, 10vh, 8rem);
  border-top: 1px solid rgba(38, 28, 18, 0.06);
}

.nosotros-gallery-block + .nosotros-gallery-block {
  margin-top: clamp(4rem, 10vh, 8rem);
}

.nosotros-gallery-label {
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 clamp(1.2rem, 2.5vh, 2rem) 0;
  text-align: center;
}

.nosotros-gallery {
  display: grid;
  gap: clamp(0.75rem, 1.4vw, 1.5rem);
}

.nosotros-gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background-color: rgba(38, 28, 18, 0.04);
  position: relative;
}

.nosotros-gallery picture,
.nosotros-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* — Galería 1: close-ups (4 cols tight) — */
.nosotros-gallery--close {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: clamp(180px, 22vw, 260px);
}
.nosotros-gallery--close > figure:nth-child(1),
.nosotros-gallery--close > figure:nth-child(5) {
  grid-row: span 2;
}

/* — Galería 2: casas (3 cols editorial) — */
.nosotros-gallery--houses {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: clamp(220px, 24vw, 320px);
}
.nosotros-gallery--houses > figure:nth-child(1),
.nosotros-gallery--houses > figure:nth-child(5),
.nosotros-gallery--houses > figure:nth-child(8) {
  grid-row: span 2;
}
.nosotros-gallery--houses > figure:nth-child(11) {
  grid-column: span 2;
}

/* — Galería 3: process (5 cols film strip) — */
.nosotros-gallery--process {
  grid-template-columns: repeat(5, 1fr);
}
.nosotros-gallery--process > figure { aspect-ratio: 3 / 4; }

/* — Galería 4: match (2 cols paired) — */
.nosotros-gallery--match {
  grid-template-columns: repeat(2, 1fr);
}
.nosotros-gallery--match > figure { aspect-ratio: 3 / 2; }
.nosotros-gallery--match > figure:last-child:nth-child(odd) {
  grid-column: span 2;
  aspect-ratio: 21 / 9;
}

/* ════════════════════════════════════════════════════════════
   CLOSING — 1 botón quieto
   ════════════════════════════════════════════════════════════ */
.nosotros-close {
  background-color: var(--color-bg);
  padding-block: clamp(6rem, 16vh, 12rem);
  border-top: 1px solid rgba(38, 28, 18, 0.08);
}

.nosotros-close__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.6rem, 3vh, 2.4rem);
  text-align: center;
}

.nosotros-close__line {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--color-primary);
  margin: 0;
  text-wrap: balance;
}

/* ════════════════════════════════════════════════════════════
   TABLET (768-1023): galerías reducen columnas + cinematic story
   ════════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .nosotros-gallery--close {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: clamp(150px, 24vw, 220px);
  }
  .nosotros-gallery--houses {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: clamp(180px, 30vw, 280px);
  }
  .nosotros-gallery--houses > figure:nth-child(8) { grid-row: auto; }
  .nosotros-gallery--process { grid-template-columns: repeat(3, 1fr); }
  .nosotros-gallery--match > figure:last-child:nth-child(odd) { aspect-ratio: 16 / 9; }

  /* ── Storytelling cinematic (mobile + tablet) ──
     Cada vez que un capítulo se activa, las 4 fotos del quad
     aparecen con un stagger sutil y reciben un ken-burns lento. */
  .nosotros-story__quad > picture {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    transition:
      opacity 0.55s ease,
      transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture:nth-child(1) { transition-delay: 0.05s; }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture:nth-child(2) { transition-delay: 0.16s; }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture:nth-child(3) { transition-delay: 0.27s; }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture:nth-child(4) { transition-delay: 0.38s; }

  .nosotros-story__frame.is-active .nosotros-story__quad > picture > img {
    animation: nosotros-kenburns 14s ease-out forwards;
  }
}

@keyframes nosotros-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .nosotros-story__quad > picture {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .nosotros-story__frame.is-active .nosotros-story__quad > picture > img {
    animation: none;
  }
}

/* ════════════════════════════════════════════════════════════
   MOBILE (≤767)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .nosotros-hero { min-height: 100svh; }
  .nosotros-hero__inner { padding-block: clamp(4rem, 10vh, 6.5rem); }
  .nosotros-hero__title { font-size: clamp(2.4rem, 10vw, 3.6rem); max-width: 12ch; }
  .nosotros-hero__lead { font-size: 1rem; line-height: 1.65; }

  .nosotros-story__stack { aspect-ratio: 4 / 3; max-height: 48svh; }
  .nosotros-story__step { min-height: 70svh; padding-block: clamp(3rem, 7vh, 4.5rem); }
  .nosotros-story__title { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .nosotros-story__step[data-scrolly-step="3"] .nosotros-story__title { font-size: clamp(1.45rem, 6vw, 2rem); }
  .nosotros-story__step p { font-size: 1.02rem; line-height: 1.7; }
  .nosotros-story__roman { letter-spacing: 0.38em; }

  .nosotros-gallery--close,
  .nosotros-gallery--houses,
  .nosotros-gallery--process {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: clamp(130px, 36vw, 180px);
  }
  .nosotros-gallery--close > figure:nth-child(1),
  .nosotros-gallery--close > figure:nth-child(5),
  .nosotros-gallery--houses > figure:nth-child(1),
  .nosotros-gallery--houses > figure:nth-child(5),
  .nosotros-gallery--houses > figure:nth-child(8) { grid-row: auto; }
  .nosotros-gallery--houses > figure:nth-child(11) { grid-column: span 2; }
  .nosotros-gallery--process > figure { aspect-ratio: 4 / 3; }
  .nosotros-gallery--match { grid-template-columns: 1fr; }
  .nosotros-gallery--match > figure,
  .nosotros-gallery--match > figure:last-child:nth-child(odd) {
    aspect-ratio: 4 / 3;
    grid-column: auto;
  }

  .nosotros-close__line { font-size: clamp(1.5rem, 6vw, 2rem); }
}
