/* ══════════════════════════════════════════════════════════════════════════
   Sannu · Artículos — leer, medir y contestar
   ──────────────────────────────────────────────────────────────────────────
   Un artículo se lee, así que la pieza propia es casi toda tipografía: medida
   de 65–72 caracteres, interlineado 1,7 y titulares con aire encima. El gran
   momento es el dato suelto: si es una fecha que viene, una cuenta atrás de
   verdad con su regla del tiempo (el lenguaje de la portada). Las cifras de
   las fuentes se miden en línea y el artículo cierra con la barra de
   escribir. Lo monta pagina-articulo.js; la barra de progreso es CSS puro.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Progreso de lectura ──────────────────────────────────────────────────
   2 px bajo la cabecera fija, ligado al scroll del documento sin JS. La
   cabecera es `sticky`, así que es el bloque contenedor del ::after. Donde
   no hay `animation-timeline`, pagina-articulo.js pone .art-progreso. */
body.single header.wp-block-template-part::after,
.art-progreso {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--h-verde);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  body.single header.wp-block-template-part::after {
    animation: art-progreso linear both;
    animation-timeline: scroll(root);
  }
  @keyframes art-progreso { to { transform: scaleX(1); } }
}
html[data-tema="claro"] body.single header.wp-block-template-part::after,
html[data-tema="claro"] .art-progreso { background: #087A35; }

/* ── Tipografía de lectura ────────────────────────────────────────────── */

.single .wp-block-post-content { font-size: 1.1rem; }
.single .wp-block-post-content :is(p, li) { line-height: 1.7; }
.art-lectura > .wp-block-group > :is(p, ol, ul),
.art-lectura > :is(p, ol, ul) { max-width: 68ch; }
.art-lectura > .wp-block-group > :is(ol, ul) { padding-left: 1.4em; }
.art-lectura > .wp-block-group > :is(ol, ul) > li { margin-bottom: 0.7em; font-size: 1.1rem; }
.art-lectura > .wp-block-group > :is(ol, ul) > li::marker { color: var(--h-verde); font-weight: 800; font-variant-numeric: tabular-nums; }
/* Más aire encima del titular que debajo: el titular pertenece a lo que
   viene, no a lo que acaba. */
.art-lectura h2.wp-block-heading { margin-top: clamp(2.6rem, 4vw, 3.6rem) !important; margin-bottom: 0.8rem !important; margin-left: 0 !important; margin-right: auto !important; max-width: 22ch; text-wrap: balance; }
.art-lectura h3.wp-block-heading { margin-top: 2rem !important; margin-bottom: 0.4rem !important; text-wrap: balance; }
.art-lectura a:not(.wp-block-button__link) { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.art-lectura a:not(.wp-block-button__link):hover { text-decoration-thickness: 2px; }

/* La cita, como frase destacada y no como burbuja de chat: la letra de
   titular, un trazo corto encima y nada de fondo. */
.art-lectura .wp-block-quote {
  position: relative;
  margin: 2.4rem auto 2.4rem 0 !important;
  padding: 1.2rem 0 0 !important;
  max-width: 42ch;
  background: none !important;
  border-radius: 0 !important;
}
.art-lectura .wp-block-quote::before { content: ""; position: absolute; left: 0; top: 0; width: 2.5rem; height: 2px; background: var(--h-verde); }
.art-lectura .wp-block-quote p { font-family: var(--h-display); font-weight: 700; font-size: clamp(1.35rem, 1vw + 1.05rem, 1.75rem) !important; line-height: 1.3 !important; letter-spacing: -0.02em; color: var(--h-texto) !important; max-width: none; text-wrap: balance; }

/* ── El dato suelto: cuenta atrás ─────────────────────────────────────── */

.dato-suelto.dato-cuenta { padding: clamp(1.4rem, 3vw, 2.2rem) !important; max-width: 68ch; margin-left: 0 !important; }
.cuenta { display: grid; gap: 0.2rem; }
.cuenta-cab { margin: 0 !important; font-size: 0.9rem !important; font-weight: 700; color: var(--h-suave) !important; }
.cuenta-num { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.35rem; margin: 0 !important; color: var(--h-texto) !important; max-width: none !important; }
.cuenta-n {
  font-family: var(--h-display);
  font-size: clamp(3.2rem, 5vw, 4.8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.cuenta-n.menor { font-size: clamp(1.6rem, 2vw, 2.1rem); letter-spacing: -0.03em; margin-left: 0.4rem; }
.cuenta-u { font-family: var(--h-display); font-weight: 700; font-size: 1rem; color: var(--h-suave); }
.cuenta-para, .cuenta-fecha { flex-basis: 100%; font-family: var(--h-display); font-weight: 700; font-size: clamp(1.1rem, 0.6vw + 0.95rem, 1.35rem); letter-spacing: -0.02em; color: var(--h-texto); margin-top: 0.4rem; }
.en-vigor .cuenta-fecha { font-size: clamp(1.8rem, 2.5vw, 2.6rem); margin-top: 0; }

/* La regla corta: del día en que se publicó a la fecha, con hoy marcado. */
.cuenta-regla { position: relative; height: 54px; margin: 1.2rem 0 0.6rem; }
.cuenta-trazo { position: absolute; left: 0; right: 0; top: 22px; height: 2px; background: var(--h-linea-2); }
.cuenta-trazo::before {
  content: "";
  position: absolute;
  left: 0; top: -1px;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, transparent, var(--h-verde));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 900ms var(--h-sale);
}
.cuenta-viva .cuenta-trazo::before { transform: scaleX(var(--hecho, 0)); }
.cuenta-trazo::after { content: ""; position: absolute; right: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--h-verde); background: var(--h-superficie); box-sizing: border-box; }
.en-vigor .cuenta-trazo::after { background: var(--h-verde); }
.cuenta-hoy { position: absolute; top: 0; transform: translateX(-50%); padding: 0.05rem 0.45rem; border-radius: 6px; background: var(--h-texto); color: var(--h-fondo); font-size: 0.7rem; font-weight: 800; line-height: 1.4; }
.cuenta-hoy::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 6px; background: var(--h-texto); }
.en-vigor .cuenta-hoy { display: none; }
.cuenta-extremo { position: absolute; top: 32px; font-size: 0.78rem; font-weight: 600; color: var(--h-tenue); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cuenta-extremo.inicio { left: 0; }
.cuenta-extremo.fin { right: 0; color: var(--h-texto); }
.dato-cuenta .dato-pie { margin-top: 0.4rem !important; max-width: 56ch; }

/* El dato suelto que es un porcentaje: su barra, a lo ancho de la caja. */
.dato-medida { display: block; height: 6px; margin: 0.6rem 0 0.4rem; border-radius: 3px; background: var(--h-linea-2); overflow: hidden; max-width: 28rem; }
.dato-medida::before { content: ""; display: block; height: 100%; border-radius: 3px; background: var(--h-verde); transform-origin: left; transform: scaleX(0); transition: transform 700ms var(--h-sale); }
.medida-viva .dato-medida::before { transform: scaleX(var(--v)); }

/* ── Porcentajes medidos en línea ─────────────────────────────────────── */

/* Una barra corta tras el número, en la línea del texto: la proporción se
   ve sin salir de la frase. Nunca se parte de su número. */
.medida { white-space: nowrap; font-variant-numeric: tabular-nums; }
.medida-barra {
  display: inline-block;
  position: relative;
  width: 2.6em;
  height: 0.36em;
  margin: 0 0 0 0.35em;
  vertical-align: 0.12em;
  border-radius: 2px;
  background: var(--h-linea-2);
  overflow: hidden;
}
.medida-barra::before { content: ""; position: absolute; inset: 0; border-radius: 2px; background: var(--h-verde); transform-origin: left; transform: scaleX(0); transition: transform 600ms var(--h-sale); }
.medida-viva .medida-barra::before { transform: scaleX(var(--v)); }

/* ── El cierre ────────────────────────────────────────────────────────── */

.art-cierre {
  margin: clamp(3rem, 6vw, 4.5rem) 0 0 !important;
  padding: clamp(1.8rem, 4vw, 3rem);
  border-radius: 24px;
  background: var(--h-campo);
  color: #fff;
  max-width: none !important;
}
.art-cierre-t { margin: 0 !important; color: #fff !important; font-size: clamp(1.7rem, 1.6vw + 1.2rem, 2.4rem) !important; letter-spacing: -0.03em; }
.art-cierre-p { margin: 0.5rem 0 0 !important; color: rgb(255 255 255 / 88%) !important; max-width: 46ch; }
.art-redactar { margin: 1.4rem 0 0 !important; max-width: 640px; }
.art-arco { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 200; pointer-events: none; }

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

@media (max-width: 781px) {
  .single .wp-block-post-content { font-size: 1.05rem; }
  .art-lectura > .wp-block-group > :is(ol, ul) > li { font-size: 1.05rem; }
  .medida-barra { width: 2em; }
  .art-cierre { margin-inline: -0.5rem !important; padding: 1.6rem 1.2rem; }
  .art-redactar { padding-left: 1rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .cuenta-trazo::before, .dato-medida::before, .medida-barra::before { transition: none; }
}
