/* Cuba Despierta · Efemérides (views/efemerides.php). Se carga solo en /efemerides.
   «El taco de calendario»: almanaque de pared en papel crema con banda roja, hojas que se arrancan, gráfico de barras
   por siglo y calendario en fichas. Colores por tipo: rojo (hechos), oro (nacimientos), tinta (muertes). */
.ak { --paper: #fbf6ec; --paper-2: #f1e8d6; --gold: #c08a1e; --ink-ak: #141210; }

/* ---------- 1. Cabecera: el taco ---------- */
.akh { position: relative; padding: calc(var(--hdr-h) + 3rem) 0 4.5rem; color: #fff; overflow: hidden; isolation: isolate;
  background: radial-gradient(ellipse 55% 70% at 78% 45%, rgba(220,52,35,.28), transparent 70%), radial-gradient(ellipse 40% 50% at 10% 100%, rgba(220,52,35,.12), transparent 70%), var(--ink-ak); }
/* El número de días, enorme y en contorno, detrás de todo */
.akh::before { content: '366'; position: absolute; z-index: -1; right: -2vw; bottom: -6vw; font-size: clamp(12rem, 6rem + 26vw, 34rem); font-weight: 900; line-height: .8; letter-spacing: -.06em; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.08); pointer-events: none; }
html.js .akh::before { animation: ak-in 2s ease .4s both; }
@keyframes ak-in { from { opacity: 0; transform: translateY(40px); } }
.akh-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; align-items: center; }
@media (min-width: 960px) { .akh-in { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 4rem; } }
.akh-kicker { margin-top: 1.8rem; display: flex; align-items: center; gap: .9rem; font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.akh-title { margin-top: 1.2rem; font-size: clamp(2.8rem, 1rem + 6.4vw, 6.4rem); font-weight: 900; line-height: .9; letter-spacing: -.04em; text-transform: uppercase; }
.akh-title .serif { color: var(--brand-light); font-size: .82em; text-transform: none; letter-spacing: -.02em; }
.akh-lead { margin-top: 1.5rem; max-width: 33rem; font-size: clamp(1rem, .95rem + .3vw, 1.18rem); line-height: 1.65; color: #ddd6cc; }
.akh-ctas { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .8rem; }
/* El almanaque de pared */
.akh-taco { position: relative; justify-self: center; width: min(86vw, 360px); padding-top: 18px; }
.akh-rings { position: absolute; z-index: 5; top: 0; left: 8%; right: 8%; display: flex; justify-content: space-between; }
.akh-rings i { width: 12px; height: 34px; border-radius: 6px; background: linear-gradient(90deg, #6d6a66, #e2ded8 45%, #8d8984); box-shadow: 0 3px 4px rgba(0,0,0,.5); }
.akh-stack { position: relative; aspect-ratio: 4 / 5; filter: drop-shadow(0 30px 40px rgba(0,0,0,.55)); }
.akh-stack::before, .akh-stack::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -8px; height: 100%; background: var(--paper-2); border-radius: 0 0 8px 8px; z-index: -1; }
.akh-stack::after { left: 12px; right: 12px; bottom: -15px; background: #ddd1b8; z-index: -2; }
.akh-sheet { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; overflow: hidden; border: 0; border-radius: 6px 6px 8px 8px; background: var(--paper); color: var(--ink-ak); text-align: center; cursor: default; }
.akh-m { display: block; width: 100%; padding: 1.4rem 1rem .8rem; background: var(--brand); color: #fff; font-size: clamp(1.1rem, .9rem + .8vw, 1.5rem); font-weight: 900; letter-spacing: .28em; text-transform: uppercase; }
.akh-d { display: block; margin-top: .2rem; font-family: var(--serif); font-size: clamp(7rem, 5rem + 8vw, 10rem); font-weight: 600; line-height: 1; letter-spacing: -.04em; color: var(--brand-dark); }
.akh-w { font-size: 11.5px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: #8a7d68; }
.akh-e { margin-top: auto; width: 100%; padding: 1rem 1.3rem 1.3rem; border-top: 1px dashed rgba(20,18,16,.25); font-size: 15px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.akh-y { display: block; margin-bottom: .25rem; font-size: 11px; font-weight: 800; letter-spacing: .2em; color: var(--brand-dark); }
.akh-sheet.is-today { cursor: pointer; transition: transform .5s var(--ease-out); }
.akh-sheet.is-today:hover { transform: translateY(-4px) rotate(-.6deg); }
.akh-sheet.is-today:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
/* Las hojas de los días anteriores se arrancan una tras otra y caen */
.akh-sheet.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
html.js .akh-sheet.is-gone { animation: ak-tear .9s cubic-bezier(.55,0,.8,.4) both; animation-delay: calc(.7s + var(--i) * .38s); transform-origin: 8% 0; }
@keyframes ak-tear {
  0% { opacity: 1; visibility: visible; transform: none; }
  25% { opacity: 1; visibility: visible; transform: rotate(-7deg); }
  100% { opacity: 0; visibility: hidden; transform: translate(-14%, 120%) rotate(-38deg); }
}
@media (max-width: 959px) { .akh-taco { width: min(78vw, 300px); } }

/* ---------- 2. Cinco siglos ---------- */
.aks { padding-block: clamp(4rem, 3rem + 4vw, 6.5rem); background: var(--paper); }
.aks-note { max-width: 24rem; font-size: 15px; line-height: 1.6; color: var(--muted); }
.aks-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: clamp(.4rem, .2rem + 1vw, 1.4rem); height: clamp(220px, 160px + 14vw, 340px); padding-bottom: .5rem; border-bottom: 2px solid var(--ink-ak); }
.aks-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .45rem; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.aks-bar i { display: block; width: 100%; max-width: 92px; height: max(6px, calc(var(--h) * 78%)); border-radius: 6px 6px 0 0; background: linear-gradient(var(--brand), var(--brand-dark)); transform-origin: bottom; transition: transform 1s cubic-bezier(.2,.9,.2,1), background .3s; }
.aks-bar:nth-child(2) i { transition-delay: .08s; } .aks-bar:nth-child(3) i { transition-delay: .16s; } .aks-bar:nth-child(4) i { transition-delay: .24s; }
.aks-bar:nth-child(5) i { transition-delay: .32s; } .aks-bar:nth-child(6) i { transition-delay: .4s; } .aks-bar:nth-child(7) i { transition-delay: .48s; }
html.js .aks-chart[data-reveal]:not(.is-in) .aks-bar i { transform: scaleY(0); }
.aks-n { font-family: var(--serif); font-size: clamp(1.2rem, .9rem + 1vw, 1.9rem); font-weight: 600; color: var(--ink-ak); }
.aks-s { font-size: clamp(9.5px, 8px + .3vw, 11.5px); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.aks-bar:hover i { background: linear-gradient(#ff6a55, var(--brand)); }
.aks-bar[aria-pressed="true"] i { background: var(--ink-ak); }
.aks-bar[aria-pressed="true"] .aks-s { color: var(--ink-ak); }
.aks-bar:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
@media (max-width: 520px) { .aks-s { writing-mode: vertical-rl; transform: rotate(180deg); } }

/* ---------- 3. El calendario ---------- */
.akc { padding-bottom: clamp(4rem, 3rem + 4vw, 7rem); }
.akc-bar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.akc-bar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.4rem; padding-block: .6rem; }
.akc-meses { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.akc-meses::-webkit-scrollbar { display: none; }
.akc-meses a { flex: none; padding: .45rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; transition: background-color .25s, color .25s; }
.akc-meses a:hover { color: var(--ink); }
.akc-meses a.is-on { background: var(--brand); color: #fff; }
.akc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.akc-tipos { display: flex; gap: .25rem; padding: 3px; border-radius: 999px; background: var(--soft); }
.akc-tipos button { padding: .4rem .75rem; border: 0; border-radius: 999px; background: none; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background-color .25s, color .25s; }
.akc-tipos button[aria-pressed="true"] { background: var(--ink-ak); color: #fff; }
.akc-tipos button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.akc-buscar { position: relative; display: flex; align-items: center; }
.akc-buscar svg { position: absolute; left: .75rem; color: var(--text-soft); pointer-events: none; }
.akc-buscar input { width: 220px; padding: .5rem .8rem .5rem 2.2rem; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font-size: 14px; transition: border-color .25s, width .4s var(--ease-out); }
.akc-buscar input:focus { outline: none; border-color: var(--ink); width: 260px; }
@media (max-width: 640px) {
  .akc-tools, .akc-buscar, .akc-buscar input, .akc-buscar input:focus { width: 100%; }
  .akc-tipos { width: 100%; justify-content: space-between; }
  .akc-tipos button { padding-inline: .5rem; }
}
.akc-estado { margin-top: 1.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-size: 14px; font-weight: 700; }
.akc-estado[hidden] { display: none; }
.akc-estado button { padding: .3rem .8rem; border: 1px solid var(--ink); border-radius: 999px; background: none; font-size: 12px; font-weight: 800; cursor: pointer; }
/* Cada mes: número enorme en contorno, nombre y fichas */
.akc-mes { padding-top: clamp(2.5rem, 2rem + 2vw, 4rem); scroll-margin-top: 8rem; }
.akc-mes[hidden] { display: none; }
.akc-mes-h { position: relative; display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.4rem; padding-bottom: .8rem; border-bottom: 3px solid var(--ink-ak); }
.akc-mes-num { position: absolute; right: 0; bottom: -.3rem; font-size: clamp(4rem, 2.5rem + 5vw, 7.5rem); font-weight: 900; line-height: .8; color: transparent; -webkit-text-stroke: 1.5px rgba(220,52,35,.35); pointer-events: none; }
.akc-mes-h h3 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.4rem); font-weight: 900; line-height: 1; letter-spacing: -.03em; text-transform: uppercase; }
.akc-mes-c { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.akc-dias { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .7rem; }
.akc-dias li[hidden] { display: none; }
html.js .akc-mes[data-reveal]:not(.is-in) .akc-dias li { opacity: 0; transform: translateY(18px); }
.akc-dias li { transition: opacity .6s ease, transform .7s var(--ease-out); transition-delay: calc(var(--i) * 28ms); }
/* La ficha del día */
.akc-dia { --c: var(--brand); position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: 'n y' 'n t'; column-gap: .9rem; align-items: start; width: 100%; height: 100%; padding: .9rem 1rem .9rem .9rem; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 4px 10px 10px 4px; background: #fff; color: var(--ink); text-align: left; cursor: pointer;
  transition: transform .4s var(--ease-out), box-shadow .4s, background-color .3s, color .3s; }
.akc-dia.is-nace { --c: var(--gold); }
.akc-dia.is-muere { --c: var(--ink-ak); }
.akc-n { grid-area: n; min-width: 2.2ch; font-family: var(--serif); font-size: 2.3rem; font-weight: 600; line-height: .95; color: var(--c); transition: color .3s; }
.akc-y { grid-area: y; font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.akc-t { grid-area: t; margin-top: .2rem; font-size: 14px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.akc-dia:hover { transform: translateY(-3px); background: var(--ink-ak); color: #fff; box-shadow: 0 14px 24px -14px rgba(0,0,0,.5); }
.akc-dia:hover .akc-n { color: #fff; }
.akc-dia:hover .akc-y { color: rgba(255,255,255,.7); }
.akc-dia:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
/* Hoy: ficha roja con un anillo que late */
.akc-dia.is-hoy { background: var(--brand); border-color: var(--brand); color: #fff; }
.akc-dia.is-hoy .akc-n, .akc-dia.is-hoy .akc-y { color: #fff; }
.akc-dia.is-hoy::after { content: ''; position: absolute; inset: -4px; border: 2px solid var(--brand); border-radius: 6px 12px 12px 6px; animation: ak-pulse 2.2s ease-out infinite; pointer-events: none; }
@keyframes ak-pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.05); } }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html.js .akh::before, html.js .akh-sheet.is-gone, .akc-dia.is-hoy::after { animation: none; }
  .akh-sheet.is-gone { display: none; }
  .aks-bar i, .akc-dias li, .akc-dia, .akh-sheet.is-today { transition: none; }
  html.js .aks-chart[data-reveal]:not(.is-in) .aks-bar i { transform: none; }
  html.js .akc-mes[data-reveal]:not(.is-in) .akc-dias li { opacity: 1; transform: none; }
}
