/* Galería editorial tipo collage. Todo lo que hay dentro de la rejilla se mide en % del
   ancho del contenedor (unidades cqw); las posiciones las pone gallery.js a partir de
   layout.json + templates.json. */

:root {
  --bg: #ffffff;
  --text: #222222;
  --muted: #a6a6a6;
  --hero-bg: #f5f5f5;
  --ph: #f2f2f2;
  --side: 48px;
  --maxw: 1600px;
  --bar-h: 172px;
  --bar-hc: 72px;
  --hero-h: 77vh;
  --font: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@supports (height: 1svh) {
  :root { --hero-h: 77svh; }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--bg); padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ───────────── Hero ───────────── */

.hero {
  position: relative;
  height: var(--hero-h);
  min-height: 420px;
  background: var(--hero-bg);
  overflow: hidden;
  display: grid;
  place-items: center;
  container-type: size;
}

/* Pila del hero: 12 huecos fijos (templates.json → hero). Cada pocos ms el de abajo
   salta arriba, sin fundido; el velo deja leer el título. */
.hero-stack {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(100cqh * 16 / 9);
  height: 100%;
  transform: translateX(-52.3%);
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.39, 0.575, 0.565, 1);
}
.hero-stack.is-ready { opacity: 1; }

.hero-slot {
  position: absolute;
  left: calc(var(--l) * 1%);
  top: calc(var(--t) * 1cqh);
  height: calc(var(--s) * 1cqh);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-slot picture { display: contents; }
.hero-slot img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--hero-bg);
  opacity: var(--veil, 0.3);
  pointer-events: none;
}

.hero-text {
  position: relative;
  z-index: 50;
  text-align: center;
  padding: 0 16px;
}

.hero-title {
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, 9.6vw, 70px);
  line-height: 1;
  text-transform: uppercase;
  color: var(--text);
}

.hero-date {
  margin: 27px 0 0;
  font-weight: 500;
  font-size: clamp(16px, 4.6vw, 21.6px);
  line-height: 1.2;
}

/* ───────────── Cabecera sticky ─────────────
   La barra mide siempre --bar-h en el flujo: al compactarse, lo que pierde de alto lo
   gana de margen inferior, así el contenido de debajo no salta. */

.bar-sentinel { height: 1px; margin-bottom: -1px; }

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--bar-h);
  margin-bottom: 0;
  padding: 0 var(--side);
  background: var(--bg);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: height 0.2s ease-out, margin-bottom 0.2s ease-out, box-shadow 0.2s ease-out;
}
.bar.is-compact {
  height: var(--bar-hc);
  margin-bottom: calc(var(--bar-h) - var(--bar-hc));
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.06);
}

.bar-name {
  margin: 0;
  font-weight: 500;
  font-size: clamp(22px, 6vw, 36px);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* la J de Jost baja por debajo de la línea base y su curva sale por la izquierda:
     hueco abajo y a la izquierda para que overflow no la recorte (el margen negativo
     deja el texto en el mismo sitio) */
  padding: 0.12em 0 0.22em 0.25em;
  margin: -0.12em 0 -0.22em -0.25em;
}

/* evita que el margen de la barra compacta colapse con el del banner (provocaría un salto) */
main { display: flow-root; }

.bar-dl {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  line-height: 20px;
  text-decoration: none;
  color: var(--text);
  padding: 8px 0;
  opacity: 0.8;
  transition: opacity 0.2s ease-out;
}
.bar-dl:hover { opacity: 1; }

/* ───────────── Banner ───────────── */

.banner {
  position: relative;
  width: min(100% - 2 * var(--side), var(--maxw));
  margin: 144px auto 0;
  aspect-ratio: 3.2 / 1;
  overflow: hidden;
  background: var(--ph);
  display: grid;
  place-items: center;
}
.banner-media, .banner-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.banner-media img { object-fit: cover; }
.banner-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.26);
}
.banner-title {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0 5%;
  color: #fff;
  font-weight: 500;
  font-size: clamp(26px, 5.5vw, 79px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
}

/* ───────────── Rejilla de collages ───────────── */

.grid {
  width: min(100% - 2 * var(--side), var(--maxw));
  margin: 0 auto;
  container-type: inline-size;
  outline: none;
}

.blk {
  position: relative;
  height: calc(var(--h) * 1cqw);
  margin-top: calc(var(--gap, 7) * 1cqw);
}
.blk.is-px { margin-top: var(--gap-px); }

.ph {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1cqw);
  width: calc(var(--w) * 1%);
}

.ph-open {
  display: block;
  width: 100%;
  aspect-ratio: var(--r);
  overflow: hidden;
  background: var(--ph);
  cursor: pointer;
}
.ph-open img {
  width: 100%;
  height: 100%;
  opacity: 0;
  filter: blur(12px);
  transition: opacity 0.4s ease, filter 0.4s ease;
}
.ph.is-shown .ph-open img { opacity: 1; filter: none; }
.ph-open:focus-visible { outline-offset: 4px; }

.ph-dl {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.ph:hover .ph-dl, .ph-dl:focus-visible { opacity: 1; }
@media (hover: none) {
  .ph-dl { display: none; }
}

.noscript { text-align: center; margin: 64px 16px; color: var(--muted); }

/* ───────────── Pie ───────────── */

.foot {
  margin-top: 160px;
  padding: 0 16px 64px;
  text-align: center;
  font-size: 16px;
  line-height: 20px;
}
.foot-credit { margin: 0 0 12px; color: var(--muted); }
.foot-credit a { color: var(--text); text-decoration: none; }
.foot-credit a:hover { border-bottom: 1px solid currentColor; }

/* ───────────── Descargar todas (contraseña) ───────────── */

.pw {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--text);
}
.pw::backdrop { background: rgba(255, 255, 255, 0.86); }
.pw[open] { animation: lb-in 0.2s ease-out; }
.pw-form {
  position: relative;
  padding: 48px 40px 36px;
  box-shadow: 0 2px 30px rgba(0, 0, 0, 0.08);
}
.pw-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.pw-title { margin: 0 0 10px; font-weight: 500; font-size: 22px; line-height: 1.2; }
.pw-text, .pw-note { margin: 0 0 24px; color: var(--muted); }
.pw-note { margin: 18px 0 0; font-size: 14px; }
.pw-label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--muted); }
.pw-input {
  display: block;
  width: 100%;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--text);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 18px;
}
.pw-input:focus { outline: none; border-bottom-width: 2px; padding-bottom: 7px; }
.pw-msg { min-height: 20px; margin: 10px 0 14px; font-size: 14px; }
.pw-submit {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--text);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease-out, color 0.2s ease-out;
}
.pw-submit:hover:not(:disabled) { background: var(--text); color: var(--bg); }
.pw-submit:disabled { opacity: 0.6; cursor: progress; }
a.pw-submit { display: block; text-align: center; text-decoration: none; }
.pw-done { display: none; }
.pw-done p { margin: 0 0 16px; color: var(--muted); }
.pw-form.is-done .pw-done { display: block; }
.pw-form.is-done .pw-label, .pw-form.is-done .pw-input, .pw-form.is-done .pw-msg,
.pw-form.is-done > .pw-submit, .pw-form.is-done .pw-note, .pw-form.is-done .pw-text { display: none; }
.foot-top { color: var(--text); text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* ───────────── Lightbox ───────────── */

.lb {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--text);
  overflow: hidden;
  touch-action: pan-y pinch-zoom;
}
.lb::backdrop { background: #fff; }
.lb:focus { outline: none; }
.lb[open] { animation: lb-in 0.25s ease-out; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

.lb-stage {
  position: absolute;
  inset: 64px;
  touch-action: none;
  cursor: zoom-in;
  overflow: visible;
}
.lb-zoom {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
}
.lb-zoom.is-anim { transition: transform 0.25s ease-out; }
.lb-zoom img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.lb.is-zoomed .lb-stage { cursor: grab; }
.lb.is-zoomed .lb-stage.is-grabbing { cursor: grabbing; }
.lb.is-zoomed .lb-btn, .lb.is-zoomed .lb-count { opacity: 0; pointer-events: none; }
.lb-btn, .lb-count { transition: opacity 0.2s ease-out; }

.lb-tools {
  position: absolute;
  top: 10px;
  right: 62px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.lb-tool {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.lb-zoom-btn[aria-pressed="true"] .lb-zoom-plus { display: none; }
.lb-img { opacity: 0; transition: opacity 0.25s ease; }
.lb-img.is-ready { opacity: 1; }

.lb-count {
  position: absolute;
  top: 22px;
  left: 24px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 20px;
}

.lb-btn, .lb-close {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.lb-btn {
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  border: 1px solid rgba(34, 34, 34, 0.28);
  border-radius: 50%;
  transition: border-color 0.2s ease-out;
}
.lb-btn:hover { border-color: rgba(34, 34, 34, 0.7); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lb-close {
  z-index: 2;
  background: rgba(255, 255, 255, 0.92);
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
}

/* ───────────── Móvil ───────────── */

@media (max-width: 767.98px) {
  :root {
    --side: 0px;
    --bar-h: 104px;
    --bar-hc: 60px;
  }
  .hero-stack { left: 0; width: 100%; transform: none; }
  .hero-slot { left: calc(var(--lm) * 1cqw); top: calc(var(--tm) * 1cqh); width: calc(var(--sm) * 1cqw); height: auto; }
  .bar { padding: 0 16px; }
  .bar-dl span { display: none; }
  .banner { margin-top: 32px; min-height: 140px; }
  .foot { margin-top: 96px; }
  .lb-stage { inset: 56px 12px; }
  .lb-tools { right: 58px; }
  .pw-form { padding: 44px 24px 28px; }
  .lb-btn { display: none; }
}

/* ───────────── Movimiento reducido ───────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .ph-open img { opacity: 1; filter: none; }
  html { scroll-behavior: auto; }
}
