/* ═══════════════════════════════════════════════════════════
   BLOG · ENHANCEMENTS EDITORIALES
   Capa de polish top-tier sobre el CSS base de cada página.
   No reemplaza nada — agrega features de revista premium.
   ═══════════════════════════════════════════════════════════ */

/* === GRAIN TEXTURE OVERLAY ================================== */
/* Ruido sutil tipo print magazine sobre fondos oscuros */
.bh::after, .ah::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.35;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 1;
}

/* === READING PROGRESS BAR (artículos) ====================== */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-d), var(--gold) 50%, var(--gold-b));
  width: 0%;
  z-index: 9999;
  transition: width 0.08s linear;
  box-shadow: 0 0 12px rgba(198, 162, 78, 0.5);
}

/* === MASK REVEAL EN HEADLINES =============================== */
/* Aplicable a .ah h1 y .bh h1 */
.mask-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.mask-reveal > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.mask-reveal.in > span,
body.loaded .mask-reveal > span {
  transform: translateY(0);
}
.mask-reveal:nth-child(1) > span { transition-delay: 0.05s; }
.mask-reveal:nth-child(2) > span { transition-delay: 0.12s; }
.mask-reveal:nth-child(3) > span { transition-delay: 0.19s; }
.mask-reveal:nth-child(4) > span { transition-delay: 0.26s; }
.mask-reveal:nth-child(5) > span { transition-delay: 0.33s; }
.mask-reveal:nth-child(6) > span { transition-delay: 0.40s; }
.mask-reveal:nth-child(7) > span { transition-delay: 0.47s; }
.mask-reveal:nth-child(8) > span { transition-delay: 0.54s; }
.mask-reveal:nth-child(9) > span { transition-delay: 0.61s; }
.mask-reveal:nth-child(10) > span { transition-delay: 0.68s; }
.mask-reveal:nth-child(11) > span { transition-delay: 0.75s; }
.mask-reveal:nth-child(12) > span { transition-delay: 0.82s; }

/* === DROP CAP MAGAZINE-STYLE ================================ */
/* Primera letra del primer párrafo después del lead */
.ab-content > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 4.6em;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  margin: 0.08em 0.12em 0 -0.04em;
  color: var(--gold-d);
  font-style: italic;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(198, 162, 78, 0.1);
}

/* === PULL QUOTES MAGAZINE-STYLE ============================= */
/* Override del blockquote para más drama */
.ab-content blockquote {
  position: relative;
  margin: 60px -20px;
  padding: 36px 44px 32px;
  background: linear-gradient(135deg, var(--cloud) 0%, rgba(198, 162, 78, 0.04) 100%);
  border-left: 0;
  border-top: 1px solid rgba(198, 162, 78, 0.2);
  border-bottom: 1px solid rgba(198, 162, 78, 0.2);
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 500;
  font-style: italic;
  color: var(--navy);
  line-height: 1.45;
  letter-spacing: -0.005em;
  opacity: 0;
  transform: scale(0.96) translateY(20px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.ab-content blockquote.in {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.ab-content blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 18px;
  font-family: var(--serif);
  font-size: 5.5rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  font-style: normal;
  opacity: 0.45;
  pointer-events: none;
}
.ab-content blockquote cite {
  display: block;
  margin-top: 16px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.74rem;
  color: var(--steel);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ab-content blockquote cite::before {
  content: '— ';
  color: var(--gold-d);
}

/* === LEAD PARAGRAPH ENHANCED ================================ */
.ab-lead {
  position: relative;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s,
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
}
body.loaded .ab-lead {
  opacity: 1;
  transform: translateY(0);
}
.ab-lead::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  width: 2px;
  height: 0;
  background: var(--gold);
  transition: height 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.6s;
}
body.loaded .ab-lead::before {
  height: 100%;
}
/* Reemplaza el border-left estático del CSS base */
.ab-lead {
  border-left: 0 !important;
}

/* === FACT CARDS ENHANCED ==================================== */
.ab-fact {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.ab-fact.in {
  opacity: 1;
  transform: translateY(0);
}
.ab-fact::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.12 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.4;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.ab-fact::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--gold-b), var(--gold-d));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
}
.ab-fact.in::after {
  transform: scaleY(1);
}
.ab-fact-num {
  position: relative;
  z-index: 2;
}
.ab-fact-lab {
  position: relative;
  z-index: 2;
}

/* === CARDS DEL LANDING (sin tilt 3D — removido por diseño) === */
.bg-card {
  transition: border-color 0.5s, box-shadow 0.5s;
}
.bg-card-cover-mark {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === HEADER MORPH AL SCROLLEAR ============================== */
header.scrolled .logo-link svg {
  transform: scale(0.92);
  transition: transform 0.4s var(--ease);
}
.logo-link svg {
  transition: transform 0.4s var(--ease);
  transform-origin: left center;
}

/* === TOC FLOTANTE EN ARTÍCULOS ============================== */
.article-toc {
  position: fixed;
  top: 50%;
  right: max(calc((100vw - 1200px) / 2 - 200px), 24px);
  transform: translateY(-50%);
  width: 200px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  pointer-events: none;
}
.article-toc.visible {
  opacity: 1;
  pointer-events: auto;
}
.article-toc-label {
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--steel);
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pearl);
}
.article-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article-toc li {
  margin: 0 0 10px 0;
  position: relative;
  padding-left: 14px;
}
.article-toc li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 1px;
  background: var(--mist);
  transition: background 0.3s, width 0.3s;
}
.article-toc a {
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--steel);
  font-weight: 400;
  transition: color 0.3s;
  display: block;
  border-bottom: 0;
  padding: 2px 0;
}
.article-toc a:hover {
  color: var(--gold-d);
}
.article-toc li.active::before {
  background: var(--gold);
  width: 10px;
}
.article-toc li.active a {
  color: var(--navy);
  font-weight: 600;
}
@media (max-width: 1280px) {
  .article-toc { display: none; }
}

/* === CARDS HOVER ENHANCED =================================== */
.bg-card:hover .bg-card-cover-mark {
  opacity: 0.55;
  transform: scale(1.05);
}
.bg-card-cover-mark {
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.bg-card-cover {
  position: relative;
  overflow: hidden;
}
.bg-card-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(198, 162, 78, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
}
.bg-card:hover .bg-card-cover::after {
  opacity: 1;
}

/* Línea dorada que crece debajo del link */
.bg-card-link {
  position: relative;
}
.bg-card-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.bg-card:hover .bg-card-link::after {
  transform: scaleX(1);
}

/* === CATEGORY TABS CON UNDERLINE ANIMADO ==================== */
.bcat a {
  position: relative;
  overflow: hidden;
}
.bcat a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 12px;
  right: 12px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.bcat a:hover::after,
.bcat a.on::after {
  transform: scaleX(1);
}

/* === BODY ENTRANCE ANIMATION ================================ */
body {
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
body.loaded {
  opacity: 1;
}

/* === HERO TICKER (LANDING) ================================== */
.hero-ticker {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid rgba(198, 162, 78, 0.12);
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s var(--ease) 0.6s, transform 1s var(--ease) 0.6s;
}
body.loaded .hero-ticker {
  opacity: 1;
  transform: translateY(0);
}
.hero-ticker-label {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.2em;
}
.hero-ticker-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 8px;
  vertical-align: middle;
  animation: tickerPulse 2.4s ease-in-out infinite;
}
@keyframes tickerPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(198, 162, 78, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 8px rgba(198, 162, 78, 0); }
}
.hero-ticker-items {
  flex: 1;
  position: relative;
  height: 1em;
  overflow: hidden;
}
.hero-ticker-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  white-space: nowrap;
}
.hero-ticker-item.on {
  opacity: 1;
  transform: translateY(0);
}

/* === SCROLL HINT ============================================ */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--silver);
  font-weight: 600;
  opacity: 0;
  transition: opacity 1s var(--ease) 1.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
body.loaded .scroll-hint {
  opacity: 0.7;
}
.scroll-hint::after {
  content: '';
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: scrollHint 2s ease-in-out infinite;
}
@keyframes scrollHint {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* === PROSE ENHANCEMENTS ===================================== */
.ab-content h2 {
  position: relative;
  padding-top: 8px;
}
.ab-content h2::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  width: 32px;
  height: 1px;
  background: var(--gold);
  transition: width 0.6s var(--ease);
}
.ab-content h2.in::before {
  width: 72px;
}

/* Subtítulos editoriales tipo eyebrow antes del h2 */
.ab-content h2 > .h2-eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-d);
  font-weight: 600;
  margin-bottom: 10px;
  font-style: normal;
}

/* === LINKS CON UNDERLINE ANIMADO EN PROSE =================== */
.ab-content a:not(.ab-cta-btn) {
  position: relative;
  border-bottom: 0;
  background-image: linear-gradient(to right, var(--gold-d), var(--gold-d));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.4s var(--ease), color 0.3s;
}
.ab-content a:not(.ab-cta-btn):hover {
  background-size: 100% 2px;
  color: var(--gold);
}

/* === SOURCES ENHANCED ======================================= */
.ab-sources {
  position: relative;
}
.ab-sources::before {
  content: '§';
  position: absolute;
  top: 32px;
  right: 0;
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--gold);
  opacity: 0.3;
  font-style: italic;
}

/* === RELATED CARDS LIFT ===================================== */
.rel-card {
  position: relative;
  overflow: hidden;
}
.rel-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-d), var(--gold) 50%, var(--gold-b));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.rel-card:hover::before {
  transform: scaleX(1);
}
.rel-card::after {
  content: '→';
  position: absolute;
  bottom: 22px;
  right: 24px;
  font-size: 1.2rem;
  color: var(--gold-d);
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.rel-card:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* === RESPONSIVE ============================================= */
@media (max-width: 768px) {
  .ab-content > p:first-of-type::first-letter {
    font-size: 3.6em;
  }
  .ab-content blockquote {
    margin: 40px 0;
    padding: 28px 28px 24px;
    font-size: 1.2rem;
  }
  .ab-content blockquote::before {
    font-size: 4rem;
    top: -4px;
  }
}

/* === REDUCED MOTION ========================================= */
@media (prefers-reduced-motion: reduce) {
  body { opacity: 1; }
  .mask-reveal > span,
  body.loaded .mask-reveal > span,
  .ab-lead, .hero-ticker, .scroll-hint {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
  .ab-content blockquote, .ab-fact {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* === SVG COVERS HOVER (LANDING CARDS) ======================= */
.bg-card-cover svg {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.bg-card:hover .bg-card-cover svg {
  transform: scale(1.04);
}
.bg-card-cover {
  position: relative;
}
.bg-card-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(7, 17, 31, 0.3) 100%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.bg-card:hover .bg-card-cover::before {
  opacity: 0.6;
}

/* === ANÁLISIS TEMPORALES — ENHANCEMENTS ===================== */
/* .atemp-card: sin contexto 3D (tilt removido) */
.atemp-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-d), var(--gold) 50%, var(--gold-b));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.atemp-card:hover::after {
  transform: scaleX(1);
}

/* Subtle rotating mark on stamps */
.atemp-card-stamp {
  transition: border-color 0.4s, color 0.4s;
}
.atemp-card:hover .atemp-card-stamp {
  border-color: rgba(198, 162, 78, 0.4);
  color: var(--gold-b);
}

/* === EMPTY STATE ANIMATION ================================== */
.bg-empty {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.bg-empty.show {
  opacity: 1;
  transform: translateY(0);
}
.bg-empty-mark {
  display: inline-block;
  animation: emptyPulse 3s ease-in-out infinite;
}
@keyframes emptyPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.05); opacity: 0.45; }
}

/* === FILTRO STICKY: tweak para que no se vea cortado ======== */
.bcat {
  transition: box-shadow 0.4s var(--ease);
}
body.scrolled-past-hero .bcat {
  box-shadow: 0 4px 20px rgba(7, 17, 31, 0.04);
}
