/* ==========================================================================
   EVER IGNIS — Módulo de artículos
   Índice con filtros + plantilla de artículo SEO (TOC, AdSense, FAQ, promo).
   ========================================================================== */

/* ---------- Barra de progreso de lectura (artículo) ---------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 1200;
}
.read-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--fire-grad);
  border-radius: 0 3px 3px 0;
}

/* ---------- Cabecera del índice ---------- */
.page-hero {
  position: relative;
  padding: calc(var(--nav-h) + clamp(56px, 9vh, 96px)) 0 clamp(40px, 5vw, 64px);
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  top: -260px;
  left: 50%;
  transform: translateX(-50%);
  width: 760px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 44, 0.13) 0%, transparent 62%);
  pointer-events: none;
}
.page-hero .eyebrow { margin-bottom: 18px; }
.page-hero h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); margin-bottom: 16px; max-width: 18ch; }
.page-hero p { color: var(--text-2); max-width: 56ch; font-size: 1.05rem; }

/* ---------- Filtros por categoría ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: clamp(28px, 4vw, 40px) 0 clamp(32px, 4vw, 48px);
}
.chip-filter {
  padding: 9px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: color 0.25s var(--ease-out), border-color 0.25s var(--ease-out),
              background-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.chip-filter:hover { color: var(--text-1); border-color: var(--gold); }
.chip-filter[aria-pressed="true"] {
  background: var(--fire-grad);
  border-color: transparent;
  color: #1F0C02;
  box-shadow: 0 4px 18px rgba(255, 107, 44, 0.28);
}
.filter-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--text-3);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
}

/* ---------- Artículo destacado (índice) ---------- */
.featured-article {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 4.5vw, 60px);
  margin-bottom: clamp(36px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: linear-gradient(155deg, #1A1310 0%, #0F0C0A 72%);
  text-decoration: none;
  transition: border-color 0.4s var(--ease-out), transform 0.4s var(--ease-spring);
}
.featured-article:hover { border-color: var(--line-strong); transform: translateY(-4px); }
.featured-article::before {
  content: "";
  position: absolute;
  top: -160px;
  right: -120px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 44, 0.16) 0%, transparent 60%);
  pointer-events: none;
}
.featured-copy { position: relative; z-index: 1; }
/* Portada del destacado: inclinada con resplandor, como el spotlight del inicio */
.featured-article .cover {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 290px;
  margin: 0 auto;
  transform: rotate(3.5deg);
  box-shadow: 0 32px 72px rgba(0, 0, 0, 0.5), 0 0 70px rgba(255, 107, 44, 0.18);
  transition: transform 0.5s var(--ease-spring), box-shadow 0.4s var(--ease-out);
}
.featured-article:hover .cover { transform: rotate(0deg) scale(1.03); }
.featured-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #1F0C02;
  background: var(--fire-grad);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.featured-copy h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--text-1);
  margin-bottom: 14px;
  line-height: 1.18;
}
.featured-copy p { color: var(--text-2); max-width: 52ch; margin-bottom: 22px; }
.featured-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 0.86rem; color: var(--text-3); }
.featured-meta .article-cat { font-size: 0.74rem; }

.featured-tile {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-m);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(160deg, #2A0E05 0%, #7A1E00 62%, #D4480E 125%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}
.featured-tile::before {
  content: "";
  position: absolute;
  top: -36%;
  right: -30%;
  width: 95%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}
.featured-tile strong {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(3.4rem, 7vw, 5.2rem);
  line-height: 1;
  color: #FFF3E2;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
}
.featured-tile span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 243, 226, 0.78);
}

/* ---------- Tarjetas (extiende .article-card del sistema) ---------- */
.article-card.is-filtered { display: none; }
.article-card time { color: var(--text-3); }

/* ---------- Maquetación del artículo ---------- */
.article-main { padding: calc(var(--nav-h) + clamp(40px, 6vh, 64px)) 0 clamp(64px, 8vw, 100px); }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(40px, 5vw, 72px);
  align-items: start;
}

.article-header { margin-bottom: clamp(32px, 4vw, 44px); }
.article-header .breadcrumb { margin-bottom: 26px; }
.article-header .article-cat { margin-bottom: 16px; display: inline-block; }
.article-header h1 {
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  margin-bottom: 20px;
  max-width: 24ch;
}
.article-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 0.88rem;
  color: var(--text-3);
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.article-meta-line strong { color: var(--text-2); font-weight: 600; }
.article-meta-line .dot { opacity: 0.45; }

/* ---------- Prosa del artículo ---------- */
.article-prose {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.82;
  color: var(--text-1);
}
.article-prose .lead {
  font-size: 1.18rem;
  color: var(--text-1);
}
.article-prose p { margin: 0 0 1.5em; }
.article-prose a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: rgba(255, 200, 115, 0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s;
}
.article-prose a:hover { text-decoration-color: var(--gold); }

.article-prose h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  margin: 2.4em 0 0.9em;
  scroll-margin-top: calc(var(--nav-h) + 28px);
}
.article-prose h3 {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  margin: 1.8em 0 0.7em;
  scroll-margin-top: calc(var(--nav-h) + 28px);
}

.article-prose ul, .article-prose ol { margin: 0 0 1.6em; padding-left: 1.4em; }
.article-prose li { margin-bottom: 0.55em; padding-left: 0.3em; }
.article-prose ul { list-style: disc; }
.article-prose ul li::marker { color: var(--ember); }
.article-prose ol { list-style: decimal; }
.article-prose ol li::marker {
  color: var(--gold);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}

.article-prose blockquote {
  margin: 2em 0;
  padding: 6px 0 6px 26px;
  border-left: 2px solid;
  border-image: var(--fire-grad) 1;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-2);
}

.table-scroll { overflow-x: auto; margin: 0 0 1.8em; }
.article-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-family: var(--font-ui);
  line-height: 1.5;
}
.article-prose th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--bg-1);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.article-prose td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: top;
}
.article-prose td:first-child { color: var(--text-1); font-weight: 500; }

/* Los bloques publicitarios (.ad-slot) viven en styles.css: son un
   componente global que usan todas las páginas del sitio. */

/* ---------- Barra lateral: TOC + anuncio fijo ---------- */
.article-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.toc {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg-1);
}
.toc-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
}
.toc ul { display: flex; flex-direction: column; gap: 2px; }
.toc a {
  display: block;
  padding: 7px 12px;
  font-size: 0.88rem;
  color: var(--text-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  transition: color 0.25s, border-color 0.25s, background-color 0.25s;
}
.toc a:hover { color: var(--text-1); background: rgba(255, 200, 115, 0.05); }
.toc a.is-active {
  color: var(--gold);
  border-left-color: var(--ember);
  background: rgba(255, 107, 44, 0.07);
}

/* TOC plegable en móvil */
.toc-mobile {
  display: none;
  margin: 0 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg-1);
}
.toc-mobile summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 22px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: "+";
  font-size: 1.3rem;
  color: var(--gold);
  transition: transform 0.3s var(--ease-spring);
}
.toc-mobile[open] summary::after { transform: rotate(45deg); }
.toc-mobile ul { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 10px; }
.toc-mobile a { color: var(--text-2); text-decoration: none; font-size: 0.92rem; }
.toc-mobile a:hover { color: var(--gold); }

/* ---------- FAQ (coincide con el JSON-LD FAQPage) ---------- */
.faq-list { display: flex; flex-direction: column; gap: 12px; margin: 0 0 1.8em; }
.faq-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-1);
  transition: border-color 0.3s;
}
.faq-item[open] { border-color: var(--line-strong); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-1);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex: none;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--gold);
  transition: transform 0.3s var(--ease-spring);
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-answer {
  padding: 0 22px 20px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.7;
}
.faq-item .faq-answer p { margin: 0 0 0.8em; }
.faq-item .faq-answer p:last-child { margin-bottom: 0; }

/* ---------- Marco de imagen reutilizable (banner de tamaño fijo) ----------
   Tamaño FIJO por proporción. Si hay imagen, la recorta para llenar el marco
   (object-fit: cover). Si NO hay imagen (o aún no se ha añadido), se muestra
   el placeholder "Brasa nocturna" de la marca.
   → Crea tus imágenes a 1200×500 px para el hero y 1200×900 px para tarjetas. */
.media-frame {
  position: relative;
  width: 100%;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(120% 150% at 82% 118%, rgba(255, 107, 44, 0.22) 0%, transparent 55%),
    radial-gradient(90% 120% at 6% -12%, rgba(255, 200, 115, 0.10) 0%, transparent 52%),
    linear-gradient(155deg, #1A1310 0%, #0C0A09 78%);
}
.media-frame--hero { aspect-ratio: 1200 / 630; margin-top: 24px; }
.media-frame--tile { aspect-ratio: 4 / 3; }
.media-frame--card { aspect-ratio: 1200 / 630; }
.media-frame--card .media-frame__brand svg { width: clamp(34px, 5vw, 46px); }
.media-frame--card .media-frame__brand span { font-size: 0.85rem; }

.media-frame__img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Marca de agua: llama grande y tenue que sangra por el lado + nombre sutil */
.media-frame__brand {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.media-frame__brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFA64D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% + 18px) center;
  background-size: auto 82%;
  opacity: 0.13;
}
.media-frame__brand svg { display: none; }
.media-frame__brand span {
  position: absolute;
  left: clamp(20px, 4%, 42px);
  bottom: clamp(18px, 5%, 36px);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
  letter-spacing: 0.03em;
  color: var(--text-1);
  opacity: 0.2;
}

/* ---------- Cajas de aviso (tip / clave / aviso / peligro) ---------- */
.caja {
  position: relative;
  margin: 2em 0;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: var(--bg-1);
  font-family: var(--font-ui);
}
.caja .etiqueta {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  color: var(--gold);
}
.caja p { margin: 0; font-size: 0.95rem; color: var(--text-2); line-height: 1.6; }
.caja p + p { margin-top: 0.7em; }
.caja.peligro { border-left-color: #FF5A4D; }
.caja.peligro .etiqueta { color: #FF7A6E; }
.caja.aviso { border-left-color: var(--flame); }
.caja.aviso .etiqueta { color: var(--flame); }

/* ---------- Lista de artículos relacionados (texto) ---------- */
.article-related-list { list-style: none; display: grid; gap: 2px; }
.article-related-list li { margin: 0; padding: 0; }
.article-related-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-1);
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: color 0.25s var(--ease-out), padding-left 0.25s var(--ease-out);
}
.article-related-list a::before { content: "→"; color: var(--gold); transition: transform 0.25s var(--ease-spring); }
.article-related-list a:hover { color: var(--gold); padding-left: 24px; }

/* ---------- Caja de autor (EEAT) ---------- */
.author-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  margin: clamp(40px, 5vw, 56px) 0 0;
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--bg-1);
  font-family: var(--font-ui);
}
.author-box .author-avatar { width: 68px; height: 68px; font-size: 1.25rem; }
.author-box h3 { font-size: 1.15rem; margin-bottom: 2px; }
.author-box .author-role { margin-bottom: 8px; }
.author-box p { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }

/* ---------- Promoción cruzada hacia las obras ---------- */
.promo-obras {
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  margin: clamp(44px, 6vw, 64px) 0 0;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background:
    radial-gradient(80% 140% at 100% 120%, rgba(255, 107, 44, 0.18) 0%, transparent 58%),
    linear-gradient(155deg, #1A1310 0%, #0F0C0A 75%);
  font-family: var(--font-ui);
}
.promo-obras .eyebrow { margin-bottom: 12px; }
.promo-obras h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-bottom: 10px; }
.promo-obras p { color: var(--text-2); font-size: 0.95rem; max-width: 44ch; margin-bottom: 22px; }
.promo-covers {
  display: flex;
  align-items: center;
}
.promo-covers .cover {
  width: 104px;
  padding: 10px;
  border-radius: 10px;
  justify-content: flex-end;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s var(--ease-spring);
}
.promo-covers .cover .cover-title { font-size: 0.66rem; }
.promo-covers .cover .cover-tag { display: none; }
.promo-covers .cover:nth-child(1) { transform: rotate(-7deg) translateX(14px); }
.promo-covers .cover:nth-child(2) { transform: rotate(2deg); z-index: 1; }
.promo-covers .cover:nth-child(3) { transform: rotate(8deg) translateX(-14px); }
.promo-obras:hover .promo-covers .cover:nth-child(1) { transform: rotate(-9deg) translateX(8px) translateY(-4px); }
.promo-obras:hover .promo-covers .cover:nth-child(2) { transform: rotate(0deg) translateY(-6px); }
.promo-obras:hover .promo-covers .cover:nth-child(3) { transform: rotate(10deg) translateX(-8px) translateY(-4px); }

/* ---------- Artículos relacionados ---------- */
.related-articles { margin-top: clamp(56px, 8vw, 88px); }
.related-articles .section-head { margin-bottom: 32px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-body { min-width: 0; }
  .article-sidebar { display: none; }
  .toc-mobile { display: block; }
}

@media (max-width: 900px) {
  .featured-article { grid-template-columns: 1fr; }
  .featured-tile { order: -1; max-height: 220px; }
}

@media (max-width: 640px) {
  .promo-obras { grid-template-columns: 1fr; }
  .promo-covers { justify-content: center; }
  .author-box { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .article-meta-line { font-size: 0.82rem; }
}

/* ---------- Ficha de obra (detalle) ---------- */
.work-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-3); font-size: 0.92rem; margin-top: 8px; }
.work-detail-meta strong { color: var(--text-2); }
.work-synopsis { max-width: 68ch; margin: 28px 0 0; }
.work-detail-cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 26px 0 8px; }
.chapters-block { margin-top: 8px; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.chapter-list a {
  display: flex; align-items: baseline; gap: 16px;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-m);
  text-decoration: none; background: linear-gradient(155deg, #16110E 0%, #0F0C0A 80%);
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-spring);
}
.chapter-list a:hover { border-color: var(--line-strong); transform: translateX(4px); }
.chapter-list .ch-num { font-family: var(--font-display); color: var(--gold); font-size: 0.92rem; white-space: nowrap; }
.chapter-list .ch-name { color: var(--text); font-weight: 500; flex: 1; }
.chapter-list .ch-go { color: var(--text-3); font-size: 0.85rem; white-space: nowrap; }
.chapter-list a:hover .ch-go { color: var(--ember); }
