/* Atlas de actuaciones · Fase 1 (V9) — mapa abierto, marcadores, filtros y ficha */

.atlas { padding: var(--s8) 0 var(--s9); background: var(--crema); }

/* ---------- Fase 2 (V10) · Portada y mapa plegado ---------- */
.atlas-intro { position: relative; background: var(--crema); padding-top: var(--header-h); }
.intro-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s5); padding: var(--s7) var(--gutter) var(--s5); }

/* Portada: un panel de papel (proporción del panel plegado, 1 : 2 del mapa 3:2 dividido en 4 × 2 = 3 : 4) */
.fold-cover {
  --cw: min(330px, 78vw); /* ancho de la portada: en el mapa plegado lo fija atlas-pliegue.js */
  position: relative; width: var(--cw); aspect-ratio: 3 / 4;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(var(--cw) * .07) calc(var(--cw) * .08) calc(var(--cw) * .08); background: #fff; color: var(--azul-profundo);
  border-radius: 3px; box-shadow: 0 30px 60px -28px rgba(20, 40, 90, .55), inset 0 0 0 1px rgba(43, 80, 158, .08);
}
.cover-logo { width: 38%; height: auto; align-self: flex-start; }
.cover-mark { width: 92%; height: auto; }
.cover-line { margin: 0; font-size: calc(var(--cw) * .064); letter-spacing: .02em; text-align: center; }
.cover-line strong { font-weight: 900; }
.intro-hint { margin: 0; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--texto-suave); }
.intro-hint-copy { display: inline-flex; align-items: center; gap: 6px; }
.intro-hint-arrow { display: inline-block; animation: hint-bob 1.6s ease-in-out infinite; }
.intro-open-map { pointer-events: auto; border: 1px solid var(--azul); border-radius: 999px; padding: 7px 14px; background: transparent; color: var(--azul); font: inherit; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease); }
.intro-open-map:hover, .intro-open-map:focus-visible { background: var(--azul); color: #fff; transform: translateY(-1px); }
@keyframes hint-bob { 50% { transform: translateY(5px); } }

/* Con coreografía (V11): portada y atlas comparten un escenario fijo dentro de una pista de scroll.
   La altura de la pista y el tamaño del mapa (--map-w, --map-h) los calcula atlas-pliegue.js. */
html.choreo-atlas .atlas-track { position: relative; }
html.choreo-atlas .atlas-stage { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow: hidden; background: var(--crema); }
html.choreo-atlas .atlas-intro { position: absolute; inset: 0; z-index: 4; padding: 0; background: transparent; pointer-events: none; }
html.choreo-atlas .intro-stage { position: absolute; inset: 0; padding: 0; gap: 0; }
html.choreo-atlas .intro-scene { position: absolute; inset: 0; perspective: 2200px; perspective-origin: 50% 35%; }
html.choreo-atlas .atlas-stage.is-joined .atlas-intro { visibility: hidden; }
html.choreo-atlas .atlas { height: 100%; padding: 18px 0 0; background: transparent; }
html.choreo-atlas .atlas-head { margin-bottom: 6px; }
html.choreo-atlas .atlas-head h1 { font-size: clamp(40px, 4.2vw, 60px); }
html.choreo-atlas .atlas-filters { position: static; padding: 6px 0; margin-bottom: 12px; background: transparent; }
html.choreo-atlas .atlas-grid { grid-template-columns: var(--map-w) 360px; justify-content: space-between; }
html.choreo-atlas .atlas-map { border-radius: 3px; }
html.choreo-atlas .atlas-stage:not(.is-joined) .atlas-map { visibility: hidden; }
html.choreo-atlas .atlas-ficha { position: static; max-height: var(--map-h); overflow-y: auto; border-radius: var(--radius); scrollbar-width: thin; }
html.choreo-atlas .atlas-card-img { aspect-ratio: 16 / 9; }
html.choreo-atlas .atlas-ficha-list { max-height: none; }
/* Título, filtros, ficha y nota aparecen tras el relevo (--ui de 0 a 1) */
html.choreo-atlas .atlas-head, html.choreo-atlas .atlas-filters, html.choreo-atlas .atlas-ficha, html.choreo-atlas .atlas-note {
  opacity: var(--ui, 1); transform: translateY(calc((1 - var(--ui, 1)) * 18px));
}
html.choreo-atlas .atlas-stage:not(.is-joined) .atlas { pointer-events: none; }
/* Marcadores: aparecen uno a uno tras el relevo (--pop de 0 a 1) */
.atlas-marker { scale: var(--pop, 1); }
html.choreo-atlas .intro-hint { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; }
.fold-rig { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.fold-sheet, .fold-col, .fold-flap { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.fold-col { transform-origin: 0 50%; }
.fold-flap { top: 100%; transform-origin: 50% 0; }
.fold-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.fold-face.is-map { background-repeat: no-repeat; background-size: 400% 200%; background-color: #fff; }
.fold-face.is-back { transform: rotateY(180deg); background: #FBF9F3; }
.fold-flap > .fold-face.is-back { transform: rotateX(180deg); }
.fold-face.is-back .fold-cover { width: 100%; height: 100%; box-shadow: none; border-radius: 0; }
/* Pliegues marcados en el papel (siguen visibles, muy suaves, con el mapa abierto) */
.fold-face.is-map::before { content: ""; position: absolute; inset: 0; box-shadow: inset 1px 0 0 rgba(0, 0, 0, .06), inset -1px 0 0 rgba(255, 255, 255, .25); pointer-events: none; }
.fold-shade { position: absolute; inset: 0; background: #0d1d3f; opacity: 0; pointer-events: none; }
.fold-ground { position: absolute; left: 0; top: 0; background: rgba(20, 40, 90, .4); filter: blur(28px); border-radius: 12px; }
/* Pliegues marcados también en el mapa del atlas (continuidad con el papel desplegado) */
.atlas-map::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(25% - 1px), rgba(0, 0, 0, .06) calc(25% - 1px), rgba(0, 0, 0, .06) 25%, rgba(255, 255, 255, .25) 25%, transparent calc(25% + 1px)),
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, .06) calc(50% - 1px), rgba(0, 0, 0, .06) 50%, rgba(255, 255, 255, .25) 50%, transparent calc(50% + 1px)),
    linear-gradient(90deg, transparent calc(75% - 1px), rgba(0, 0, 0, .06) calc(75% - 1px), rgba(0, 0, 0, .06) 75%, rgba(255, 255, 255, .25) 75%, transparent calc(75% + 1px)),
    linear-gradient(180deg, transparent calc(50% - 1px), rgba(0, 0, 0, .05) calc(50% - 1px), rgba(0, 0, 0, .05) 50%, transparent 50%);
}
.atlas-markers { z-index: 2; }

/* Recorrido: contador y «Saltar el recorrido», a la derecha del título (fuera del flujo: no mueve el mapa) */
.atlas-head { position: relative; }
.atlas-tour { position: absolute; right: var(--gutter); bottom: 6px; display: flex; align-items: center; gap: 14px; flex: 0 0 auto; font-size: 13px; color: var(--texto-suave); white-space: nowrap; }
.atlas-tour[hidden] { display: none; }
.atlas-tour-count { font-weight: 700; letter-spacing: .04em; }
.atlas-tour-skip { border: 0; background: none; padding: 4px 0; font: inherit; font-size: 13px; color: var(--azul-profundo); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.atlas-head { margin-bottom: var(--s5); }
.atlas-kicker { margin: 0 0 var(--s2); font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--texto-suave); }
.atlas-head h1 { margin: 0; font-size: clamp(40px, 6vw, 80px); font-weight: 900; line-height: 1; color: var(--azul-profundo); }

.atlas-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s6); align-items: start; }

/* ---------- Filtros (V10: en fila, bajo el título y encima del mapa) ---------- */
.atlas-filters { position: sticky; top: var(--header-h); z-index: 5; padding: var(--s3) 0; margin-bottom: var(--s4); background: var(--crema); }
.atlas-filters ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
.atlas-filter {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; white-space: nowrap;
  border: 0; border-radius: 999px; background: transparent; font: inherit; font-size: 14px; color: var(--azul-profundo);
  text-align: left; cursor: pointer; opacity: .5; transition: opacity .25s, color .35s;
}
.atlas-filter:hover, .atlas-filter:focus-visible { opacity: 1; }
.atlas-filter:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.atlas-filter[aria-pressed="true"] { opacity: 1; color: #fff; font-weight: 700; }
.atlas-filter-dot {
  position: relative; z-index: 0; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--c);
  transform: scale(1); transform-origin: center; transition: transform .45s var(--ease), border-radius .45s var(--ease);
}
.atlas-filter[aria-pressed="true"] .atlas-filter-dot { transform: scale(50); border-radius: 16%; }
.atlas-filter-name, .atlas-filter-count { position: relative; z-index: 1; }
.atlas-filter-name { flex: 1 1 auto; }
.atlas-filter-count { font-size: 12px; font-weight: 700; opacity: .7; }

/* ---------- Mapa ---------- */
.atlas-map { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--sombra); background: #fff; }
.atlas-map-img { display: block; width: 100%; height: auto; }
.atlas-markers { position: absolute; inset: 0; }
.atlas-note { margin: var(--s3) 0 0; font-size: 13px; color: var(--texto-suave); }
.atlas-empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
  padding: 14px 22px; border-radius: 999px; background: rgba(255, 255, 255, .92); font-weight: 700; color: var(--azul-profundo); text-align: center;
}

.atlas-marker {
  --size: clamp(30px, 3vw, 42px);
  position: absolute; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  padding: 0; border: 0; border-radius: 50%; background: var(--c); color: #fff;
  font: inherit; font-size: calc(var(--size) * .36); font-weight: 900; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 14px -4px rgba(20, 40, 90, .5);
  transition: transform .25s, opacity .3s, box-shadow .25s;
}
.atlas-marker-n { display: block; }
.atlas-marker:hover, .atlas-marker:focus-visible { transform: scale(1.15); z-index: 3; outline: none; }
.atlas-marker:focus-visible { box-shadow: 0 0 0 3px var(--azul-profundo); }
.atlas-marker.is-sel { transform: scale(1.3); z-index: 4; box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 35%, transparent), 0 6px 14px -4px rgba(20, 40, 90, .5); }
.atlas-marker.is-off { opacity: .18; pointer-events: none; transform: scale(.75); }
/* V12: al señalar un marcador (cursor o teclado), el resto baja al 50 % */
.atlas-markers:has(.atlas-marker:hover, .atlas-marker:focus-visible) .atlas-marker:not(:hover):not(:focus-visible):not(.is-off) { opacity: .5; }
/* V13: durante el recorrido con scroll, también: solo la actuación del paso actual queda al 100 % */
.atlas-stage.is-touring .atlas-marker:not(.is-sel):not(:hover):not(:focus-visible):not(.is-off) { opacity: .5; }
.atlas-marker-tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px);
  padding: 6px 12px; border-radius: 8px; background: var(--azul-profundo); color: #fff;
  font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s, transform .2s;
}
.atlas-marker:hover .atlas-marker-tip, .atlas-marker:focus-visible .atlas-marker-tip { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Ficha ---------- */
.atlas-ficha { position: sticky; top: calc(var(--header-h) + 84px); }
.atlas-ficha-intro, .atlas-card { background: #fff; border-radius: var(--radius); box-shadow: var(--sombra); }
.atlas-ficha-intro { padding: var(--s5); border-top: 6px solid var(--c); }
.atlas-ficha-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--texto-suave); }
.atlas-ficha-intro h2 { margin: 0 0 var(--s3); font-size: 26px; font-weight: 900; line-height: 1.1; color: var(--azul-profundo); }
.atlas-ficha-hint { margin: 0 0 var(--s4); font-size: 14px; color: var(--texto-suave); }
.atlas-ficha-pend { color: var(--texto-suave); font-style: italic; }
.atlas-ficha-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 52vh; overflow-y: auto; }
.atlas-ficha-list button {
  width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 8px 6px; border: 0; border-radius: 8px;
  background: none; font: inherit; font-size: 15px; color: var(--azul-profundo); text-align: left; cursor: pointer;
}
.atlas-ficha-list button:hover, .atlas-ficha-list button:focus-visible { background: var(--crema); }
.atlas-ficha-list .n { flex: 0 0 auto; min-width: 26px; font-weight: 900; color: var(--t, var(--c)); }

.atlas-card { position: relative; overflow: hidden; }
.atlas-card-close {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--azul-profundo); font-size: 22px; line-height: 1; cursor: pointer;
}
.atlas-card-img { aspect-ratio: 3 / 2; background: var(--c); }
.atlas-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.atlas-card-body { padding: var(--s5); }
.atlas-card-cat { display: flex; align-items: center; gap: 8px; margin: 0 0 var(--s3); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t, var(--c)); }
.atlas-card-n { margin: 0; font-size: 56px; font-weight: 900; line-height: .9; color: var(--t, var(--c)); }
.atlas-card h2 { margin: var(--s2) 0 var(--s3); font-size: 24px; font-weight: 900; line-height: 1.15; color: var(--t, var(--c)); }
.atlas-card-desc { margin: 0 0 var(--s4); font-size: 15px; }
/* V10: «Ver actuación» sin recuadro, solo texto y flecha en el color de la categoría */
.atlas-ficha-cta { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 19px; line-height: 1.2; color: var(--t, var(--c)); text-decoration: none; }
.atlas-ficha-cta span { font-size: 23px; line-height: 1; transition: transform .2s; }
.atlas-ficha-cta:hover span, .atlas-ficha-cta:focus-visible span { transform: translateX(5px); }
.atlas-ficha-cta:hover, .atlas-ficha-cta:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.atlas-ficha-cta.is-disabled { color: var(--texto-suave); font-weight: 400; font-style: italic; cursor: default; text-decoration: none; }
.atlas-card-nav { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--azul-linea); font-size: 13px; color: var(--texto-suave); }
.atlas-card-nav button { border: 0; background: none; font: inherit; font-size: 15px; font-weight: 700; color: var(--azul-profundo); cursor: pointer; padding: 6px; }
.atlas-card-nav button:hover, .atlas-card-nav button:focus-visible { color: var(--t, var(--c)); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .atlas-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .atlas-ficha { position: static; }
}
@media (max-width: 860px) {
  .atlas-filters ul { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .atlas-filters ul::-webkit-scrollbar { display: none; }
  .atlas-filters li { flex: 0 0 auto; }
  .atlas-filter { opacity: .5; font-size: 14px; padding: 8px 14px; }
  .atlas-marker { --size: 26px; border: 0; }
  .atlas-marker-tip { display: none; }
  .atlas-map { border-radius: var(--radius-s); }
}

/* ---------- V16 · Comunicación y formación: postales sujetas con chinchetas ---------- */
.comunica { position: relative; background: var(--crema); padding: clamp(72px, 10vw, 140px) 0 clamp(80px, 11vw, 150px); overflow: hidden; }
/* V17: título en el rojo de la categoría y centrado · V18: más pequeño (máx. 48 px; antes 72) */
.comunica-title { margin: 0 0 clamp(44px, 5vw, 72px); font-size: clamp(30px, 3.4vw, 48px); font-weight: 900; line-height: 1; color: var(--c); text-align: center; }
.comunica-title .cw { display: inline-block; will-change: transform, opacity; }
/* V18: más separación entre las postales (máx. 150 px; antes 96) */
.postales { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(48px, 10vw, 150px); max-width: 1080px; }
.postal {
  /* --fall-*: animación de entrada (js/comunicacion.js); --rot: inclinación final de cada postal */
  transform: translateY(var(--fall-y, 0px)) rotate(calc(var(--rot, 0deg) + var(--fall-r, 0deg))) scale(var(--fall-s, 1));
  opacity: var(--fall-o, 1); transform-origin: 50% 0; will-change: transform, opacity;
}
.postal-link { display: block; color: inherit; text-decoration: none; }
.postal-card {
  position: relative; display: block; padding: 14px 14px 18px; background: #fff; border-radius: 3px;
  /* sombra: amplia y difusa mientras cae (--lift = 1), corta y nítida al quedar clavada */
  box-shadow:
    0 calc(4px + var(--lift, 0) * 34px) calc(10px + var(--lift, 0) * 40px) calc(var(--lift, 0) * -6px) rgba(20, 40, 90, calc(.22 + var(--lift, 0) * .08)),
    0 1px 2px rgba(20, 40, 90, .12);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.postal-img { display: grid; place-items: center; aspect-ratio: 3 / 2; background: #D3D3D3; overflow: hidden; }
.postal-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Chincheta: cabeza redonda con brillo, en el color de la categoría, y su sombra sobre la postal */
.postal-pin {
  position: absolute; left: 50%; top: -9px; z-index: 2; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 9%, color-mix(in srgb, var(--c) 70%, #fff) 10% 24%, var(--c) 45%, color-mix(in srgb, var(--c) 72%, #000) 100%);
  box-shadow: 2px 4px 5px rgba(20, 40, 90, .35);
  opacity: var(--pin, 1); transform: translateY(calc((1 - var(--pin, 1)) * -26px)) scale(calc(1 + (1 - var(--pin, 1)) * 1.1));
}
.postal-pin::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 9px; margin-left: -1.5px; border-radius: 2px; background: rgba(20, 40, 90, .25); transform: translate(4px, 7px) rotate(-30deg); filter: blur(1px); }
.postal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 32px;
  opacity: var(--foot, 1); transform: translateY(calc((1 - var(--foot, 1)) * 10px)) rotate(calc(var(--rot, 0deg) * -1));
}
/* V17: nombre en el mismo rojo que la flecha; flecha más pequeña y hacia la derecha */
.postal-name { font-size: clamp(20px, 1.9vw, 26px); font-weight: 900; line-height: 1.15; color: var(--c); }
.postal-arrow {
  flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid var(--c); color: var(--c); transition: background-color .35s var(--ease), color .35s var(--ease), transform .35s var(--ease);
}
.postal-arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.postal-link:hover .postal-card, .postal-link:focus-visible .postal-card { transform: translateY(-4px) rotate(calc(var(--rot, 0deg) * -.4)); }
.postal-link:hover .postal-arrow, .postal-link:focus-visible .postal-arrow { background: var(--c); color: #fff; transform: translateX(4px); }
.postal-link:focus-visible { outline: 3px solid var(--azul-claro); outline-offset: 8px; border-radius: 6px; }
@media (max-width: 760px) {
  .postales { grid-template-columns: 1fr; gap: 72px; max-width: 420px; }
  /* WordPress: la inclinación (giro desde arriba) desplaza el pie de la postal ~20 px; margen para que el nombre
     y la flecha no toquen el borde de la pantalla en móvil */
  .postales { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .postal-card, .postal-arrow { transition: none; }
  .atlas-marker, .atlas-marker-tip, .atlas-filter, .atlas-filter-dot { transition: none; }
}
