/* Cuba Despierta · Portada de Historia (views/historia.php). Se carga solo en /historia.
   Usa los colores de la paleta (site.css) y las animaciones comunes de redesign.css (kenburns, hx-drift, scrollcue). */

/* ---------- 1. Cabecera ---------- */
.hh { position: relative; display: flex; align-items: flex-end; min-height: min(100svh, 940px); padding: calc(var(--hdr-h) + 4rem) 0 4.5rem; background: var(--ink-950); color: #fff; overflow: hidden; isolation: isolate; }
.hh-media { position: absolute; inset: 0; z-index: -3; }
.hh-media img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.5) sepia(.22) contrast(1.05) brightness(.85); transform-origin: 60% 40%; }
html.js .hh-media img { animation: kenburns 26s var(--ease-out) both, hx-drift 46s ease-in-out 26s infinite alternate; }
.hh::before { content: ''; position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, rgba(14,14,14,.95) 0%, rgba(14,14,14,.78) 42%, rgba(14,14,14,.3) 82%), linear-gradient(to top, rgba(14,14,14,.95) 0%, rgba(14,14,14,0) 55%); }
.hh::after { content: ''; position: absolute; inset: 0; z-index: -1; background-image: var(--grain); opacity: .08; mix-blend-mode: overlay; pointer-events: none; }
/* Años gigantes en contorno: js/historia-portada.js los desplaza a distinta velocidad con el scroll. */
.hh-years { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hh-years span { position: absolute; font-family: var(--serif); font-style: italic; font-size: clamp(5rem, 3rem + 9vw, 13rem); line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.16); transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }
.hh-years span:nth-child(1) { top: 13%; right: 3%; }
.hh-years span:nth-child(2) { top: 40%; right: 27%; }
.hh-years span:nth-child(3) { bottom: 16%; right: 5%; }
.hh-years span:nth-child(4) { top: 66%; right: 36%; }
@media (max-width: 767px) { .hh-years span:nth-child(2), .hh-years span:nth-child(4) { display: none; } }
.hh-in { position: relative; width: 100%; }
.hh-kicker { margin-top: 1.8rem; display: flex; align-items: center; gap: .9rem; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.hh-title { margin-top: 1.2rem; font-size: clamp(2.8rem, 1rem + 6vw, 6.2rem); font-weight: 800; line-height: .92; letter-spacing: -.035em; text-transform: uppercase; }
.hh-title .serif { color: var(--brand-light); font-size: 1.05em; }
.hh-lead { margin-top: 1.5rem; max-width: 34rem; font-size: clamp(1rem, .95rem + .35vw, 1.2rem); line-height: 1.65; color: #d4d4d4; }
.hh-ctas { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .8rem; }
.hh-stats { margin: 3rem 0 0; padding-top: 1.4rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 0; max-width: 46rem; border-top: 1px solid rgba(255,255,255,.18); }
@media (min-width: 640px) { .hh-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hh-stats > div { display: flex; flex-direction: column-reverse; gap: .35rem; padding-right: 1rem; }
.hh-stats dd { margin: 0; font-size: clamp(2rem, 1.4rem + 1.8vw, 3rem); font-weight: 900; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hh-stats dt { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.65); }
.hh-scroll { position: absolute; right: 2rem; bottom: 2.2rem; display: none; }
@media (min-width: 1024px) { .hh-scroll { display: block; } }
.hh-scroll span { position: relative; display: block; width: 24px; height: 38px; border: 2px solid rgba(255,255,255,.8); border-radius: 12px; }
.hh-scroll span::after { content: ''; position: absolute; left: 50%; top: 7px; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: #fff; animation: scrollcue 1.8s var(--ease-io) infinite; }

/* ---------- 2. Capítulos: línea del tiempo vertical ---------- */
.hc { padding-block: clamp(4rem, 3rem + 4vw, 7rem); }
.hc-body { position: relative; }
.hc-rail { position: absolute; top: 0; bottom: 0; left: 11px; width: 2px; background: var(--line); }
.hc-fill { position: absolute; inset: 0; background: var(--brand); transform: scaleY(var(--p, 0)); transform-origin: top; }
.hc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: clamp(2.5rem, 2rem + 3vw, 5rem); }
.hc-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 1.2rem; }
.hc-when { display: none; }
.hc-dot { position: relative; z-index: 1; grid-column: 1; grid-row: 1; justify-self: center; width: 16px; height: 16px; margin-top: .5rem; border-radius: 50%; background: var(--page); border: 2px solid var(--line-strong); transition: background-color .4s, border-color .4s, transform .5s var(--ease-out), box-shadow .5s; }
.hc-item.is-active .hc-dot { background: var(--brand); border-color: var(--brand); transform: scale(1.25); box-shadow: 0 0 0 6px var(--brand-tint); }
.hc-card { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; background: #fff; border: 1px solid var(--line); transition: border-color .4s, box-shadow .6s, opacity .8s ease, transform .9s var(--ease-out); }
.hc-item.is-active .hc-card { border-color: var(--line-strong); box-shadow: 0 30px 60px -30px rgba(0,0,0,.25); }
html.js .hc-item:not(.is-in) .hc-card { opacity: 0; transform: translate3d(0, 40px, 0); }
.hc-img { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--thumb); }
.hc-img img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transform: scale(1.06); transition: filter 1s ease, transform 1.4s var(--ease-out); }
.hc-item.is-active .hc-img img, .hc-card:hover .hc-img img { filter: grayscale(0) contrast(1.05); transform: none; }
.hc-txt { min-width: 0; display: flex; flex-direction: column; gap: .6rem; padding: 1.5rem 1.4rem 1.3rem; }
.hc-year-sm { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--brand-dark); }
.hc-title { font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem); font-weight: 800; line-height: 1.08; letter-spacing: -.01em; text-transform: uppercase; }
.hc-title a { color: inherit; text-decoration: none; transition: color .25s; }
.hc-title a:hover { color: var(--brand-dark); }
.hc-desc { font-size: 15px; line-height: 1.7; color: var(--muted); }
.hc-arts { list-style: none; margin: .3rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.hc-arts li { border-bottom: 1px solid var(--line); }
.hc-arts a { display: block; padding: .55rem 0; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .25s, transform .4s var(--ease-out); }
.hc-arts a:hover, .hc-arts a:focus-visible { color: var(--brand-dark); transform: translateX(.4rem); }
.hc-foot { margin-top: auto; padding-top: .6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.hc-count { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-soft); }
.hc-go { display: inline-flex; align-items: center; gap: .4rem; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.hc-go svg { transition: transform .45s var(--ease-out); }
.hc-go:hover { color: var(--brand-dark); }
.hc-go:hover svg { transform: translateX(5px); }
@media (min-width: 900px) {
  /* Columna del año (fija mientras se lee el capítulo) · punto sobre la línea · tarjeta */
  .hc-rail { left: calc(220px + 2rem + 19px); }
  .hc-item { grid-template-columns: 220px 40px minmax(0, 1fr); column-gap: 2rem; }
  .hc-when { position: sticky; top: calc(var(--hdr-h) + 2rem); align-self: start; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
  .hc-num { font-size: 4.2rem; font-weight: 900; line-height: .9; color: transparent; -webkit-text-stroke: 1px var(--line-strong); transition: -webkit-text-stroke-color .4s; }
  .hc-year { margin-top: .4rem; font-family: var(--serif); font-style: italic; font-size: 1.5rem; line-height: 1.15; color: var(--text-soft); transition: color .4s; }
  .hc-item.is-active .hc-num { -webkit-text-stroke-color: var(--brand); }
  .hc-item.is-active .hc-year { color: var(--brand-dark); }
  .hc-dot { grid-column: 2; margin-top: 1.4rem; }
  .hc-card { grid-column: 3; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }
  .hc-item.no-img .hc-card { grid-template-columns: minmax(0, 1fr); }
  .hc-img { aspect-ratio: auto; height: 100%; min-height: 300px; }
  .hc-year-sm { display: none; }
  .hc-txt { padding: 2rem 2rem 1.6rem; }
}

/* ---------- 3. Serie especial: índice de libro ---------- */
.hs { position: relative; padding-block: clamp(4rem, 3rem + 4vw, 7rem); background: var(--ink-900); color: #fff; isolation: isolate; }
.hs::after { content: ''; position: absolute; inset: 0; z-index: -1; background-image: var(--grain); opacity: .05; pointer-events: none; }
.hs-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
@media (min-width: 1024px) {
  .hs-in { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 4rem; }
  .hs-sticky { position: sticky; top: calc(var(--hdr-h) + 2rem); }
}
.hs-title { margin-top: .8rem; font-size: clamp(2rem, 1.2rem + 2.8vw, 3.4rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; text-transform: uppercase; }
.hs-title .serif { display: block; color: var(--brand-light); }
.hs-desc { margin-top: 1rem; max-width: 30rem; font-size: 15px; line-height: 1.7; color: #bdbdbd; }
.hs-preview { position: relative; margin: 1.8rem 0 1.6rem; aspect-ratio: 16 / 10; overflow: hidden; background: #222; border-top: 3px solid var(--brand); }
.hs-preview img { width: 100%; height: 100%; object-fit: cover; transition: opacity .45s ease, transform 1.2s var(--ease-out); }
.hs-preview.is-swapping img { opacity: 0; transform: scale(1.04); }
.hs-preview figcaption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: .6rem; padding: 2.4rem 1rem .85rem; background: linear-gradient(to top, rgba(14,14,14,.92), rgba(14,14,14,0)); font-size: 13px; font-weight: 600; line-height: 1.35; }
.hs-preview figcaption span { font-family: var(--serif); font-style: italic; color: var(--brand-light); }
.hs-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(255,255,255,.16); }
.hs-list li { border-bottom: 1px solid rgba(255,255,255,.12); }
.hs-link { position: relative; display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: 1.05rem .4rem; color: #fff; text-decoration: none; transition: background-color .3s; }
.hs-link::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); transform: scaleY(0); transition: transform .45s var(--ease-out); }
.hs-n { font-family: var(--serif); font-style: italic; font-size: 1.6rem; line-height: 1; color: rgba(255,255,255,.35); transition: color .3s; }
.hs-t { font-size: 15.5px; font-weight: 700; line-height: 1.35; transition: transform .45s var(--ease-out); }
.hs-m { font-size: 12px; color: rgba(255,255,255,.5); white-space: nowrap; }
.hs-go { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; transition: background-color .3s, border-color .3s, transform .45s var(--ease-out); }
.hs-link:hover, .hs-link:focus-visible, .hs-link.is-on { background: rgba(255,255,255,.04); }
.hs-link:hover::before, .hs-link:focus-visible::before, .hs-link.is-on::before { transform: scaleY(1); }
.hs-link:hover .hs-n, .hs-link:focus-visible .hs-n, .hs-link.is-on .hs-n { color: var(--brand-light); }
.hs-link:hover .hs-t, .hs-link:focus-visible .hs-t { transform: translateX(.4rem); }
.hs-link:hover .hs-go, .hs-link:focus-visible .hs-go { background: var(--brand); border-color: var(--brand); transform: rotate(-45deg); }
.hs-link:focus-visible { outline: 2px solid var(--brand-light); outline-offset: -2px; }
@media (max-width: 639px) { .hs-m { display: none; } .hs-link { grid-template-columns: 2.4rem minmax(0, 1fr) auto; } }

/* ---------- 4. Cronología: cinta de efemérides arrastrable ---------- */
.hf { --gut: 1rem; padding-block: clamp(4rem, 3rem + 4vw, 7rem) 3rem; overflow: hidden; }
@media (min-width: 640px) { .hf { --gut: 1.5rem; } }
@media (min-width: 1024px) { .hf { --gut: 2rem; } }
.hf-nav { display: flex; flex-wrap: wrap; gap: .4rem; }
.hf-go { padding: .45rem .8rem; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; transition: background-color .25s, border-color .25s, color .25s; }
.hf-go:hover, .hf-go.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.hf-go:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hf-track { position: relative; display: flex; align-items: stretch; gap: 1rem; overflow-x: auto; padding: 1.2rem max(var(--gut), calc((100% - 1240px) / 2 + var(--gut))) 1.6rem; scrollbar-width: none; overscroll-behavior-x: contain; cursor: grab; }
.hf-track::-webkit-scrollbar { display: none; }
.hf-track:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.hf-track.is-drag { cursor: grabbing; }
.hf-track.is-drag a { pointer-events: none; }
.hf-card { flex: 0 0 240px; display: flex; flex-direction: column; gap: .45rem; padding: 1.2rem 1.2rem 1.3rem; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--ink); color: var(--ink); text-decoration: none; user-select: none; transition: border-color .3s, transform .5s var(--ease-out), box-shadow .5s; }
.hf-card:hover, .hf-card:focus-visible { border-top-color: var(--brand); transform: translateY(-6px); box-shadow: 0 24px 40px -24px rgba(0,0,0,.3); }
.hf-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hf-year { font-family: var(--serif); font-style: italic; font-size: 2.4rem; line-height: 1; letter-spacing: -.02em; color: var(--brand-dark); }
.hf-date { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); }
.hf-title { font-size: 15px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hf-century { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 0 1.4rem; border-left: 2px solid var(--brand); }
.hf-century span { font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--text-soft); }
.hf-century b { font-size: clamp(3rem, 2rem + 3vw, 4.6rem); font-weight: 900; line-height: 1; letter-spacing: -.04em; }
.hf-foot { display: flex; align-items: center; gap: 1.5rem; }
.hf-progress { position: relative; flex: 1; height: 2px; background: var(--line); }
.hf-progress span { position: absolute; inset: 0; background: var(--brand); transform: scaleX(var(--p, 0)); transform-origin: left; }

/* ---------- 6. Cierre ---------- */
.hz { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; align-items: center; padding: 2.4rem 1.6rem; background: var(--ink-900); color: #fff; border-top: 3px solid var(--brand); overflow: hidden; }
@media (min-width: 900px) { .hz { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2.5rem; padding: 2.8rem 3rem; } }
.hz-mark { font-family: var(--serif); font-style: italic; font-size: 6rem; line-height: .8; color: transparent; -webkit-text-stroke: 1px var(--brand-light); }
.hz-title { font-size: clamp(1.4rem, 1rem + 1.4vw, 2.1rem); font-weight: 800; line-height: 1.15; text-transform: uppercase; }
.hz-title .serif { color: var(--brand-light); }
.hz-desc { margin-top: .6rem; max-width: 40rem; font-size: 15px; line-height: 1.6; color: #bdbdbd; }

@media (prefers-reduced-motion: reduce) {
  .hh-years span { transform: none; }
  html.js .hc-item:not(.is-in) .hc-card { opacity: 1; transform: none; }
  .hc-card, .hc-img img, .hs-preview img { transition: none; }
}
