/* ==========================================================================
   ZAPPIA · Artículos (/articulos/)
   Listado y página de artículo. Se carga después de base, site y pages.
   Colores siempre con las variables de base.css (modo claro, oscuro y temporadas).
   ========================================================================== */

/* ---------------------------------------------------------- Cabecera del artículo */

.art-hero {
  padding-bottom: clamp(48px, 6vw, 80px);
}

.art-hero__wrap {
  max-width: 980px;
}

.art-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0 0 clamp(20px, 2.6vw, 30px) !important;
  color: var(--fg-mute);
  font: 500 12.5px/1.4 var(--font-code);
}

.art-meta > * + *::before {
  content: "·";
  margin-right: 18px;
  color: var(--fg-mute);
}

.art-cat {
  color: var(--gold);
}

.art-hero h1 {
  max-width: 22ch;
  font-size: clamp(36px, 4.6vw, 70px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.art-lede {
  max-width: 60ch;
  margin-top: clamp(22px, 2.8vw, 32px) !important;
  color: var(--fg-dim);
  font-size: clamp(18px, 1.45vw, 22px);
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.art-byline {
  margin-top: 26px !important;
  color: var(--fg-mute);
  font: 500 12.5px/1.4 var(--font-code);
}

.art-byline b {
  color: var(--fg);
  font-weight: 500;
}

/* ---------------------------------------------------------- Cuerpo */

.art-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(40px, 6vw, 100px);
  align-items: start;
  padding-top: clamp(48px, 6vw, 88px);
  padding-bottom: clamp(64px, 8vw, 110px);
}

.art-side {
  position: sticky;
  top: calc(var(--zh-h) + 40px);
}

.art-keys .plus-list li {
  font-size: 14.5px;
  line-height: 1.5;
}

.art-side__back {
  display: inline-flex;
  gap: 8px;
  margin-top: 28px;
  color: var(--fg-mute);
  font: 500 12.5px/1 var(--font-code);
  text-decoration: none;
  transition: color 0.3s ease;
}

.art-side__back:hover,
.art-side__back:focus-visible {
  color: var(--gold);
}

.art-body {
  max-width: 68ch;
  color: var(--fg-dim);
  font-size: clamp(17px, 1.2vw, 19px);
  line-height: 1.75;
}

.art-body > * + * {
  margin-top: 1.15em !important;
}

.art-body h2 {
  margin-top: 2.1em !important;
  color: var(--fg);
  font-size: clamp(24px, 2.2vw, 32px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: balance;
}

.art-body h2 + p {
  margin-top: 0.7em !important;
}

.art-body strong {
  color: var(--fg);
  font-weight: 600;
}

.art-body a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.3s ease;
}

.art-body a:hover,
.art-body a:focus-visible {
  color: var(--gold);
}

.art-body ul {
  padding: 0;
  list-style: none;
}

.art-body ul li {
  position: relative;
  padding-left: 1.4em;
}

.art-body ul li + li {
  margin-top: 0.5em;
}

.art-body ul li::before {
  content: "+";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-family: var(--font-code);
}

/* Cita destacada */
.art-quote {
  margin-left: 0;
  margin-right: 0;
  padding: 4px 0 4px 24px;
  border-left: 2px solid var(--gold-fill);
}

.art-quote p {
  color: var(--fg);
  font-size: clamp(20px, 1.6vw, 24px);
  line-height: 1.45;
  letter-spacing: -0.015em;
}

.art-quote cite {
  display: block;
  margin-top: 10px;
  color: var(--fg-mute);
  font: 500 12.5px/1.4 var(--font-code);
  font-style: normal;
}

/* Dato en grande */
.art-dato {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 28px;
  margin-left: 0;
  margin-right: 0;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.art-dato b {
  color: var(--gold);
  font-size: clamp(40px, 4.4vw, 64px);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1;
  white-space: nowrap;
}

.art-dato span {
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
}

/* Cierre: la parte que conecta con el negocio del lector */
.art-cta {
  margin-top: 2.6em !important;
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
}

.art-cta p {
  color: var(--fg);
  font-size: 17px;
  line-height: 1.65;
}

.art-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* Los botones no heredan el estilo de los enlaces del texto (en oscuro quedaba texto claro sobre dorado) */
.art-body .art-cta .btn {
  color: var(--btn-fg);
  text-decoration: none;
}

.art-body .art-cta .btn:hover,
.art-body .art-cta .btn:focus-visible {
  color: var(--btn-fg);
}

/* ---------------------------------------------------------- Escuchar el artículo */

.art-listen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 26px !important;
}

.art-listen[hidden] {
  display: none;
}

.art-listen__play {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 20px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 600 14.5px/1 var(--font-ui);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.art-listen__play:hover,
.art-listen__play:focus-visible {
  border-color: var(--gold);
  outline: none;
}

.art-listen__icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-fill);
  color: var(--on-accent);
}

.art-listen__icon svg {
  width: 14px;
  height: 14px;
}

.art-listen__icon .i-pause,
.art-listen.is-playing .art-listen__icon .i-play {
  display: none;
}

.art-listen.is-playing .art-listen__icon .i-pause {
  display: block;
}

.art-listen__stop,
.art-listen__speed {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg-dim);
  font: 500 12.5px/1 var(--font-code);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.art-listen__stop:hover,
.art-listen__speed:hover,
.art-listen__stop:focus-visible,
.art-listen__speed:focus-visible {
  border-color: var(--gold);
  color: var(--fg);
  outline: none;
}

.art-listen:not(.is-on) .art-listen__stop {
  display: none;
}

.art-listen__bar {
  flex-basis: 100%;
  height: 2px;
  max-width: 420px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.art-listen:not(.is-on) .art-listen__bar {
  display: none;
}

.art-listen__bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold-fill);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease;
}

/* Párrafo que se está leyendo */
.art-body .is-reading {
  color: var(--fg);
  box-shadow: -14px 0 0 -12px var(--gold-fill);
}

/* Fuentes */
.art-sources {
  margin-top: 3em !important;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.art-sources ol {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: fuente;
}

.art-sources li {
  counter-increment: fuente;
  display: flex;
  gap: 12px;
  padding: 8px 0;
  color: var(--fg-mute);
  font: 400 13.5px/1.55 var(--font-ui);
}

.art-sources li::before {
  content: counter(fuente, decimal-leading-zero);
  color: var(--gold);
  font: 500 12px/1.9 var(--font-code);
}

.art-sources a {
  color: var(--fg-dim);
  text-decoration-color: var(--line-strong);
}

.art-note {
  margin-top: 22px !important;
  color: var(--fg-mute);
  font: 500 12px/1.7 var(--font-code);
}

/* ---------------------------------------------------------- Tarjetas (listado y "más artículos") */

.art-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 28px);
}

/* Cajita: foto arriba a sangre, texto debajo, fecha al pie */
.art-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.4s ease, transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.art-card:hover,
.art-card:focus-visible {
  border-color: rgba(234, 191, 63, 0.55);
  box-shadow: 0 18px 40px -24px var(--shadow-strong);
  transform: translateY(-3px);
  outline: none;
}

.art-card > .art-ph {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.art-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  padding: clamp(22px, 2.2vw, 30px);
}

.art-card__cat {
  color: var(--gold) !important;
  font: 600 11.5px/1.2 var(--font-code) !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.art-card h2,
.art-card h3 {
  color: var(--fg);
  font-size: clamp(20px, 1.6vw, 24px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: balance;
  transition: color 0.3s ease;
}

.art-card__sum {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.6;
}

.art-card__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto !important;
  padding-top: 10px;
  color: var(--fg-mute);
  font-size: 13.5px;
}

.art-card__foot span {
  margin-left: auto;
  color: var(--fg-mute);
  font-family: var(--font-code);
  transition: color 0.3s ease, transform 0.4s var(--ease);
}

.art-card:hover h2,
.art-card:hover h3,
.art-card:focus-visible h2,
.art-card:focus-visible h3 {
  color: var(--gold);
}

.art-card:hover .art-card__foot span,
.art-card:focus-visible .art-card__foot span {
  color: var(--gold);
  transform: translateX(4px);
}

/* Foto de portada 16:9 (o fondo tipográfico si el artículo no tiene foto) */
.art-ph {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(rgba(154, 163, 214, 0.08) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, rgba(154, 163, 214, 0.08) 1px, transparent 1px) 0 0 / 22px 100%,
    var(--panel);
}

.art-ph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease);
}

div.art-ph span {
  position: absolute;
  left: 18px;
  bottom: 16px;
  color: var(--gold);
  font: 500 12.5px/1 var(--font-code);
}

.art-card:hover .art-ph img,
.art-card:focus-visible .art-ph img {
  transform: scale(1.035);
}

.art-figure {
  margin: 0 0 2em !important;
}

.art-figure .art-ph {
  border-radius: 16px;
}

.art-figure figcaption {
  margin-top: 10px;
  color: var(--fg-mute);
  font: 400 12.5px/1.5 var(--font-code);
}

.art-figure figcaption a {
  color: var(--fg-mute);
  text-decoration-color: var(--line-strong);
}

.art-count {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px !important;
}

.art-count span {
  color: var(--fg-mute);
}

/* Paginación del archivo */
.art-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font: 500 13px/1 var(--font-code);
}

.art-pager__step {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.3s ease;
}

.art-pager__step[rel="next"] {
  justify-self: end;
}

.art-pager__nums {
  display: flex;
  gap: 6px;
}

.art-pager__nums > * {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-dim);
  text-decoration: none;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.art-pager__nums [aria-current] {
  border-color: transparent;
  background: var(--gold-fill);
  color: var(--on-accent);
}

.art-pager a:hover,
.art-pager a:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

/* El último artículo: la misma caja, en horizontal y más grande (foto a la izquierda) */
.art-card--lead {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.art-card--lead > .art-ph {
  aspect-ratio: auto;
  min-height: 100%;
  min-width: 0;
  border-bottom: 0;
  border-right: 1px solid var(--line);
}

.art-card--lead > .art-ph img {
  position: absolute;
  inset: 0;
}

.art-card--lead .art-card__body {
  justify-content: center;
  gap: 16px;
  padding: clamp(28px, 3.4vw, 52px);
}

.art-card--lead h2 {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.art-card--lead .art-card__sum {
  font-size: clamp(15.5px, 1.15vw, 17.5px);
  -webkit-line-clamp: 5;
}

.art-card--lead .art-card__foot {
  margin-top: 8px !important;
}

.art-empty {
  max-width: 56ch;
  padding: 40px 0;
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 17px;
}

.art-more h2.art-more__title {
  margin-bottom: 28px;
  font-size: clamp(26px, 2.6vw, 38px);
}

/* Aviso de borrador (solo en la vista previa que llega por Telegram) */
.art-draft {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 10px var(--gutter);
  background: var(--gold-fill);
  color: var(--on-accent);
  font: 600 13px/1.4 var(--font-code);
  text-align: center;
}

/* ---------------------------------------------------------- Móvil */

@media (max-width: 1000px) {
  .art-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .art-card--lead {
    grid-template-columns: 1fr;
  }

  .art-card--lead > .art-ph {
    aspect-ratio: 16 / 9;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .art-pager {
    grid-template-columns: 1fr 1fr;
  }

  .art-pager__nums {
    display: none;
  }
}

@media (max-width: 960px) {
  .art-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .art-side {
    position: static;
    margin-bottom: 44px;
  }

  .art-side__back {
    display: none;
  }

  .art-body {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .art-list {
    grid-template-columns: 1fr;
  }

  .art-dato {
    grid-template-columns: 1fr;
  }
}
