/* ==========================================================
   María Andrea Maldonado — Art Advisor
   Desktop: escenario de 1024 unidades que escala con el ancho
   de la ventana (igual que el visor de Readymag).
   Móvil (<769px): diseño en columna.
   ========================================================== */

:root {
  --bg: #f9f7f2;
  --ink: #131313;
  --line: rgba(0, 0, 0, .32);
  --pill: rgba(0, 0, 0, .04);
  --pill-active: rgba(0, 0, 0, .10);
  --u: calc(100vw / 1024); /* JS lo corrige sin la barra de scroll */
  --sc: "Alegreya SC", Georgia, serif;          /* versalitas */
  --serif: "Alegreya", Georgia, serif;          /* texto */
  --display: "Alegreya", Georgia, serif;        /* titulares en negrita */
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }

/* ---------- Pre-carga ---------- */
.loader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .6s ease .2s, visibility 0s linear .8s;
}
.loader img {
  width: calc(109px); height: auto;
  animation: loader-spin 1.6s linear forwards;
}
@keyframes loader-spin {
  0%   { transform: rotate(0deg) scale(1); opacity: 1; }
  100% { transform: rotate(720deg) scale(1); opacity: 0; }
}
.is-loaded .loader { opacity: 0; visibility: hidden; }

/* ---------- Logo fijo (arriba a la derecha) ---------- */
.logo {
  position: fixed; z-index: 50;
  top: 0; right: calc(11.8 * var(--u));
  width: calc(247 * var(--u));
  opacity: 0;
  transform: translate(calc(33 * var(--u)), calc(29 * var(--u)));
  transition: opacity 1s ease-out, transform 1.2s cubic-bezier(.2, .7, .2, 1);
}
.is-loaded .logo { opacity: 1; transform: none; transition-delay: 1.1s; }
.logo { transform-origin: top right; }
.ready .logo { transition-delay: 0s; }
.is-loaded .logo.small { transform: scale(.42); }
.logo img { width: 100%; }

/* ---------- Navegación fija ---------- */
.nav {
  position: fixed; z-index: 60; top: calc(11.94 * var(--u)); left: 50%;
  width: 0; height: calc(25 * var(--u));
  opacity: 0; transition: opacity .8s ease-out 1.4s;
}
.is-loaded .nav { opacity: 1; }
.nav a {
  position: absolute; top: 0;
  height: calc(25 * var(--u));
  line-height: calc(25 * var(--u));
  padding: 0 calc(6 * var(--u));
  border-radius: calc(18 * var(--u));
  background: rgba(249, 247, 242, .72);
  box-shadow: inset 0 0 0 100px var(--pill);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-family: var(--sc); font-size: calc(14 * var(--u));
  color: var(--ink); text-decoration: none; white-space: nowrap; text-align: center;
  transition: background .35s ease, transform .35s ease;
}
.nav a:hover { box-shadow: inset 0 0 0 100px var(--pill-active); transform: translateY(-1px); }
.nav a.active { box-shadow: inset 0 0 0 100px var(--pill-active); }
.nav a:nth-child(1) { margin-left: calc(-272 * var(--u)); min-width: calc(76 * var(--u)); }
.nav a:nth-child(2) { margin-left: calc(-122.2 * var(--u)); min-width: calc(75 * var(--u)); }
.nav a:nth-child(3) { margin-left: calc(27 * var(--u)); min-width: calc(75 * var(--u)); }
.nav a:nth-child(4) { margin-left: calc(181.3 * var(--u)); min-width: calc(92 * var(--u)); }

/* ---------- Escenario (desktop) ---------- */
.stage {
  position: relative;
  width: 100%;
  height: calc(9300 * var(--u));
  overflow: hidden;
}
.el {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  z-index: var(--z, 2);
}
.el.img img, .el.img video {
  width: 100%;
  height: calc(var(--h) * var(--u));
  object-fit: cover;
}
.el.img.contain img { object-fit: contain; }

/* Tipografía (en unidades del escenario) */
.t-small    { font-family: var(--serif); font-size: calc(12 * var(--u)); line-height: calc(16 * var(--u)); }
.t-hero     { font-family: var(--sc); font-size: calc(38 * var(--u)); line-height: calc(50 * var(--u)); }
.t-title    { font-family: var(--serif); font-size: calc(52 * var(--u)); line-height: calc(47 * var(--u)); text-align: center; }
.t-title.one{ line-height: calc(45 * var(--u)); }
.t-muros    { font-size: calc(53 * var(--u)); letter-spacing: .7px; }
.t-body     { font-size: calc(15 * var(--u)); line-height: calc(19 * var(--u)); text-align: center; }
.t-body .h  { font-family: var(--sc); display: block; margin-bottom: calc(16 * var(--u)); }
.t-body .i  { font-style: italic; display: block; }
.t-body.tight .h { margin-bottom: calc(9 * var(--u)); }
.t-body.left { text-align: left; }
.t-body.pad  { padding: 0 calc(10 * var(--u)); }
.t-intro     { line-height: calc(18 * var(--u)); }

/* Bloque "private / advisory / …" */
.label { text-align: center; }
.label .k1, .label .k3 {
  display: block; font-family: var(--sc);
  font-size: calc(12 * var(--u)); line-height: calc(16 * var(--u)); letter-spacing: .2px;
}
.label .k2 {
  display: block; font-family: var(--display); font-weight: 700;
  font-size: calc(52 * var(--u)); line-height: calc(64 * var(--u)); letter-spacing: -2px;
  margin: calc(2 * var(--u)) 0 calc(-2 * var(--u));
}
.t-visuals { font-family: var(--display); font-weight: 700; font-size: calc(40 * var(--u)); line-height: calc(45 * var(--u)); text-align: center; }

/* Líneas divisorias */
.divider { height: 1px; background: var(--line); transform-origin: left center; }

/* Banners a pantalla completa con opacidad 37% */
.banner img { opacity: .37; }

/* Tiras de imágenes (galería en movimiento) */
.strip {
  position: absolute; left: 0; width: 100%;
  top: calc(var(--y) * var(--u));
  height: calc(127 * var(--u));
  overflow: visible; z-index: 3;
}
.strip-track {
  display: flex; height: 100%;
  width: max-content;
  will-change: transform;
}
.strip-track img {
  height: 100%;
  width: calc(var(--iw, 127) * var(--u));
  margin-right: calc(-8 * var(--u));
  object-fit: cover;
  cursor: zoom-in;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), filter .5s ease;
  position: relative;
}
.strip-track img:hover { transform: scale(1.06); z-index: 2; filter: saturate(1.15); }

/* Video + icono animado */
.video-wrap { overflow: hidden; }
.video-wrap video, .video-wrap img { width: 100%; height: calc(158 * var(--u)); object-fit: cover; }
.sound {
  height: calc(35 * var(--u));
  border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; gap: calc(3 * var(--u));
}
.sound span {
  width: calc(4 * var(--u)); background: var(--ink); border-radius: 2px;
  height: 30%; animation: eq 1.1s ease-in-out infinite;
}
.sound span:nth-child(2) { animation-delay: -.3s; }
.sound span:nth-child(3) { animation-delay: -.6s; }
.sound span:nth-child(4) { animation-delay: -.9s; }
.sound.muted span { animation-play-state: paused; height: 20%; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 95%; } }

/* ---------- Animaciones ---------- */
/* Aparición al hacer scroll (fade + leve subida) */
.reveal { opacity: 0; transform: translateY(calc(18 * var(--u))); transition: opacity 1.1s ease-out, transform 1.1s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.divider.reveal { transform: scaleX(0); opacity: 1; transition: transform 1.6s cubic-bezier(.65, 0, .35, 1); }
.divider.reveal.in { transform: scaleX(1); }

/* Animaciones de carga del hero */
.hero-img { opacity: 0; transition: opacity 1.4s ease-out .9s; }
.hero-text { opacity: 0; transition: opacity 1.2s ease-out 1.5s; }
.is-loaded .hero-img, .is-loaded .hero-text { opacity: 1; }

/* Las imágenes con "data-scrub" las mueve JS; aquí sólo preparamos */
[data-scrub] { will-change: transform, opacity; }
.zoomable { cursor: zoom-in; }
.zoomable img { transition: filter .5s ease; }
.zoomable:hover img { filter: brightness(1.04) saturate(1.08); }

/* ---------- Visor de imágenes (lightbox) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(249, 247, 242, .96);
  display: grid; place-items: center;
  opacity: 0; visibility: hidden;
  transition: opacity .4s ease, visibility 0s linear .4s;
  cursor: zoom-out;
}
.lightbox.open { opacity: 1; visibility: visible; transition: opacity .4s ease; }
.lightbox img {
  max-width: 88vw; max-height: 86vh; object-fit: contain;
  transform: scale(.94); transition: transform .5s cubic-bezier(.2, .7, .2, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .12);
}
.lightbox.open img { transform: none; }
.lightbox .close {
  position: absolute; top: 18px; right: 22px;
  font-family: var(--sc); font-size: 15px; color: var(--ink);
  background: var(--pill); border: 0; border-radius: 18px; padding: 4px 12px; cursor: pointer;
}

/* ---------- Pie ---------- */
.footer {
  text-align: center; font-family: var(--sc);
  font-size: calc(12 * var(--u)); padding: 0 0 calc(60 * var(--u));
}
.footer a { color: var(--ink); }

/* ==========================================================
   MÓVIL
   ========================================================== */
@media (max-width: 768px) {
  :root { --u: 1px; }
  .logo { width: 104px; right: 6px; top: 40px; }
  .is-loaded .logo.small { transform: scale(.6); }
  .nav {
    left: 0; right: 0; width: auto; top: 10px; height: auto;
    display: flex; justify-content: center; gap: 6px; padding: 0 8px;
  }
  .nav a { position: static; margin: 0 !important; min-width: 0 !important; font-size: 13px; height: 26px; line-height: 26px; padding: 0 10px; border-radius: 18px; background: rgba(249, 247, 242, .85); backdrop-filter: blur(6px); }

  .stage { height: auto; overflow: hidden; padding-bottom: 40px; }
  .el { position: relative; left: auto; top: auto; width: auto; }
  .block { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 56px 24px 0; position: relative; }

  .el.img { width: 72%; max-width: 360px; }
  .el.img.wide { width: 100%; max-width: none; }
  .el.img:nth-of-type(even) { align-self: flex-end; }
  .el.img img { height: auto; aspect-ratio: var(--w) / var(--h); }

  .hero-block { padding: 0; }
  .hero-block .el.img { width: 100%; max-width: none; }
  .hero-block .el.img img { aspect-ratio: 1024 / 606; }
  .hero-text { align-self: flex-start; padding: 12px 24px 0; }
  .t-small { font-size: 13px; line-height: 17px; }
  .t-hero { font-size: 34px; line-height: 40px; }
  .t-title { font-size: 40px; line-height: 40px; }
  .t-muros { font-size: 44px; }
  .t-body { font-size: 15px; line-height: 20px; max-width: 420px; }
  .t-body .h { margin-bottom: 12px; }
  .label .k1, .label .k3 { font-size: 12px; line-height: 16px; }
  .label .k2 { font-size: 46px; line-height: 54px; }
  .t-visuals { font-size: 36px; line-height: 40px; }
  .divider { width: 100%; }

  .banner { position: absolute; inset: 0; z-index: 0; width: 100%; }
  .banner img { height: 100%; object-fit: cover; }
  .block.has-banner > *:not(.banner) { z-index: 1; }

  .strip { position: relative; top: auto; height: 120px; margin: 8px 0; }
  .strip-track img { width: calc(var(--iw, 127) * .95px); margin-right: -6px; }

  .video-wrap { width: 100%; max-width: 420px; }
  .video-wrap video, .video-wrap img { height: auto; aspect-ratio: 403 / 158; }
  .sound { position: relative; left: auto; width: 38px; height: 35px; margin-top: 8px; }

  .footer { font-size: 12px; padding: 40px 0; }

  /* Hitos: texto arriba y dos imágenes pequeñas lado a lado */
  .block:has(.tight) { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 14px; padding-top: 44px; }
  .block:has(.tight) .t-body { flex-basis: 100%; order: -1; }
  .block:has(.tight) .el.img { width: calc(50% - 7px); max-width: 220px; align-self: auto; }
}

/* Accesibilidad: menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .hero-img, .hero-text, .logo, .nav { opacity: 1 !important; transform: none !important; }
  .loader { display: none; }
}
