/* Cuba Despierta · Antes y después (views/antesdespues.php). Se carga solo en /descubre-cuba/antes-y-despues.
   Comparador: la mitad izquierda es la misma foto en tono de época (sepia y grano); --pos marca la división.
   Animaciones comunes de redesign.css (fadeup, lineup, data-reveal). Comparador: js/antesdespues.js. */
@property --pos { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
.az { --sepia: #c9a86a; }

/* ---------- 1. Cabecera con comparador ---------- */
.ah { position: relative; display: flex; align-items: flex-end; min-height: min(100svh, 900px); padding: calc(var(--hdr-h) + 4rem) 0 5rem; background: var(--ink-950); color: #fff; overflow: hidden; isolation: isolate; }
/* Al cargar, la barra barre la foto y se queda en el centro. «backwards»: al terminar deja de aplicarse,
   así el valor que pone el control deslizante (estilo en línea) manda. */
html.js .ah { animation: az-intro 2.4s cubic-bezier(.6, 0, .2, 1) .6s backwards; }
@keyframes az-intro { 0% { --pos: 92%; } 60% { --pos: 38%; } 100% { --pos: 50%; } }
.ah-img { position: absolute; inset: 0; z-index: -3; }
.ah-img img { width: 100%; height: 100%; object-fit: cover; }
.ah-then { z-index: -2; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ah-then img { filter: sepia(.85) contrast(1.1) brightness(.85) saturate(.8); }
.ah-grain { position: absolute; inset: 0; opacity: .18; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); box-shadow: inset 0 0 160px 30px rgba(0,0,0,.6); }
.ah::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(to top, rgba(14,14,14,.92) 0%, rgba(14,14,14,.45) 45%, rgba(14,14,14,.15) 75%), linear-gradient(90deg, rgba(14,14,14,.55) 0%, rgba(14,14,14,0) 55%); }
.ah-bar { position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 1; width: 3px; translate: -50% 0; background: #fff; box-shadow: 0 0 20px rgba(0,0,0,.6); pointer-events: none; }
.ah-bar i { position: absolute; top: 50%; left: 50%; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; translate: -50% -50%; border-radius: 50%; background: #fff; color: var(--ink); box-shadow: 0 8px 20px rgba(0,0,0,.4); }
.ah-tag { position: absolute; top: calc(var(--hdr-h) + 1.4rem); z-index: 1; padding: .35rem .7rem; font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; pointer-events: none; }
.ah-tag-then { left: 1.2rem; background: var(--sepia); color: var(--ink); }
.ah-tag-now { right: 1.2rem; background: var(--brand); color: #fff; }
/* El control deslizante cubre la foto, invisible; el texto queda por encima pero deja pasar el arrastre */
.ah-range { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; }
.ah-range:focus-visible ~ .ah-bar i, .ah-range:focus-visible ~ .ah-in .ah-note { outline: 2px solid #fff; outline-offset: 4px; }
html:not(.js) .ah-range { display: none; }
.ah-in { position: relative; z-index: 3; width: 100%; pointer-events: none; }
.ah-in a { pointer-events: auto; }
.ah-kicker { margin-top: 1.8rem; display: flex; align-items: center; gap: .9rem; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.ah-title { margin-top: 1.2rem; font-size: clamp(2.8rem, .9rem + 6.8vw, 6.8rem); font-weight: 800; line-height: .92; letter-spacing: -.035em; text-transform: uppercase; }
.ah-title .serif { color: var(--sepia); font-size: 1.08em; text-transform: none; }
.ah-lead { margin-top: 1.4rem; max-width: 34rem; font-size: clamp(1rem, .95rem + .35vw, 1.2rem); line-height: 1.65; color: #e0e0e0; }
.ah-note { margin-top: 1.4rem; display: inline-flex; align-items: center; gap: .5rem; max-width: 34rem; padding: .55rem .8rem; background: rgba(14,14,14,.6); font-size: 12.5px; line-height: 1.4; color: #e5e5e5; }

/* ---------- 2. Comparaciones ---------- */
.ac { padding-block: clamp(4rem, 3rem + 4vw, 7rem); }
.ac-count { font-size: 14px; color: var(--muted); }
.ac-count b { font-size: 1.6rem; font-weight: 900; color: var(--ink); }
.ac-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem 2rem; }
@media (min-width: 760px) { .ac-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ac-list.is-solo { grid-template-columns: minmax(0, 1fr); } }
.ac-card { display: flex; flex-direction: column; gap: 1.3rem; color: var(--ink); text-decoration: none; }
.ac-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 6px; }
/* La foto empieza en tono de época y pasa a color al pasar el ratón, con una línea que la barre */
.ac-img { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; box-shadow: 0 30px 50px -30px rgba(0,0,0,.6); }
.ac-img img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.85) contrast(1.1) saturate(.8); transition: filter 1.1s var(--ease-out), transform 1.2s var(--ease-out); }
.ac-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0 48%, #fff 49.5% 50.5%, transparent 52%); background-size: 220% 100%; background-position: 100% 0; opacity: 0; transition: background-position 1.1s var(--ease-out), opacity .3s; pointer-events: none; }
.ac-card:hover .ac-img img, .ac-card:focus-visible .ac-img img { filter: none; transform: scale(1.03); }
.ac-card:hover .ac-img::after { opacity: 1; background-position: 0 0; }
.ac-body { display: flex; flex-direction: column; gap: .6rem; }
.ac-meta { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #8a6d3b; }
.ac-t { font-size: clamp(1.15rem, 1rem + .5vw, 1.4rem); font-weight: 800; line-height: 1.2; text-transform: uppercase; transition: color .3s; }
.ac-card:hover .ac-t { color: var(--brand-dark); }
.ac-d { font-size: 15px; line-height: 1.6; color: var(--muted); }
.ac-go { display: inline-flex; align-items: center; gap: .4rem; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-dark); }
.ac-go svg { transition: transform .45s var(--ease-out); }
.ac-card:hover .ac-go svg { transform: translateX(5px); }
@media (min-width: 900px) {
  .ac-list.is-solo .ac-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4rem; align-items: center; }
  .ac-list.is-solo .ac-t { font-family: var(--serif); font-style: italic; font-weight: 400; text-transform: none; font-size: clamp(2rem, 1.4rem + 1.8vw, 3rem); line-height: 1.02; }
}
.ac-empty { padding: 2rem; border: 1px dashed var(--line-strong); color: var(--muted); }

/* ---------- 3. ¿Tienes fotos antiguas? ---------- */
.af { padding-block: clamp(3rem, 2.5rem + 3vw, 5rem); background: var(--ink-900); color: #fff; }
.af-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; align-items: center; }
@media (min-width: 900px) { .af-in { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2.4rem; } }
.af-ico { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: var(--sepia); color: var(--ink); }
.af-t { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem); line-height: 1.05; }
.af-d { margin-top: .6rem; max-width: 40rem; font-size: 15.5px; line-height: 1.65; color: #d6d6d6; }

/* ---------- 4. Sigue descubriendo ---------- */
.ax { padding-block: clamp(3.5rem, 2.5rem + 3vw, 5.5rem); }
.ax ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; }
@media (min-width: 560px) { .ax ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .ax ul { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .ax ul { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ax a { display: flex; align-items: center; gap: .9rem; height: 100%; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .3s, transform .5s var(--ease-out); }
.ax-ico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; background: var(--soft); color: var(--brand-dark); transition: background-color .35s, color .35s, transform .5s var(--ease-out); }
.ax-txt { display: flex; flex: 1; flex-direction: column; gap: .15rem; min-width: 0; }
.ax-n { font-size: 14.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
.ax-c { font-size: 12px; color: var(--muted); }
.ax a > svg { color: var(--brand); transition: transform .45s var(--ease-out); }
.ax a:hover { border-color: var(--ink); transform: translateY(-3px); }
.ax a:hover .ax-ico { background: var(--brand); color: #fff; transform: rotate(-8deg); }
.ax a:hover > svg { transform: translateX(5px); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js .ah { animation: none; }
  .ac-img img, .ac-img::after, .ax a { transition: none; }
}

/* ---------- Archivo (views/_cat_archivo.php): fotos en tono de época que recuperan el color ---------- */
.arc.is-antesdespues { --arc-accent: #8a6d3b; --arc-img-filter: sepia(.85) contrast(1.05) brightness(.95); }
