/* ════════════════════════════════════════════════════════════════
   BLOG POST · animated hero — v2 (más movido)
   Cada post tiene un hero SVG animado, parametrizado por categoría.
   No images. Solo CSS + SVG = ~6KB, AI-readable, instant load.
   Multi-capa: shine sweep + particles drift + animaciones por categoría.
   ════════════════════════════════════════════════════════════════ */

.post-hero-anim {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9;
  max-height: 380px;
  margin: 0 0 36px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 100%);
  box-shadow: 0 24px 60px -28px rgba(10, 31, 143, 0.45);
  isolation: isolate;
}

/* ─── Capa 1: shine sweep diagonal (sobre todas las categorías) ─── */
.post-hero-anim::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.08) 45%,
    rgba(171, 255, 151, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 55%,
    transparent 65%
  );
  background-size: 280% 100%;
  background-position: -50% 0;
  animation: ph-shine-sweep 9s ease-in-out infinite;
  mix-blend-mode: screen;
}
@keyframes ph-shine-sweep {
  0%, 8%   { background-position: -60% 0; opacity: 0; }
  18%      { opacity: 1; }
  55%      { background-position: 160% 0; opacity: 0.85; }
  62%, 100% { background-position: 160% 0; opacity: 0; }
}

/* ─── Capa 2: partículas flotando (drift constante) ─── */
.post-hero-anim::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(2px 2px at 12% 28%, rgba(171,255,151,0.85) 50%, transparent 60%),
    radial-gradient(1.5px 1.5px at 28% 72%, rgba(255,255,255,0.7) 50%, transparent 60%),
    radial-gradient(2.5px 2.5px at 48% 18%, rgba(171,255,151,0.5) 50%, transparent 60%),
    radial-gradient(1px 1px at 62% 52%, rgba(255,255,255,0.6) 50%, transparent 60%),
    radial-gradient(2px 2px at 76% 32%, rgba(171,255,151,0.7) 50%, transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 78%, rgba(255,255,255,0.5) 50%, transparent 60%),
    radial-gradient(2.5px 2.5px at 22% 88%, rgba(171,255,151,0.4) 50%, transparent 60%),
    radial-gradient(1px 1px at 95% 12%, rgba(255,255,255,0.8) 50%, transparent 60%);
  background-size: 100% 100%;
  animation: ph-particles-drift 22s linear infinite;
  opacity: 0.7;
}
@keyframes ph-particles-drift {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%  { transform: translate3d(-3%, 2%, 0) rotate(180deg); }
  100% { transform: translate3d(0, 0, 0) rotate(360deg); }
}

/* SVG por encima de partículas, debajo del shine */
.post-hero-anim svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

/* Tag y corner labels van por encima de todo */
.post-hero-anim .ph-tag {
  position: absolute;
  top: 18px;
  left: 22px;
  z-index: 4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: ph-tag-glow 4s ease-in-out infinite;
}
@keyframes ph-tag-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(171,255,151,0); border-color: rgba(255,255,255,0.22); }
  50%      { box-shadow: 0 0 12px 2px rgba(171,255,151,0.35); border-color: rgba(171,255,151,0.6); }
}
.post-hero-anim .ph-corner {
  position: absolute;
  bottom: 18px;
  right: 22px;
  z-index: 4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.65);
}

/* ════════════════════════════════════════════════════════════════
   CATEGORY VARIANTS · cada categoría tiene su animación y paleta
   ════════════════════════════════════════════════════════════════ */

/* SOURCING · network nodes pulsing — Yiwu factory network */
.ph-sourcing { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-sourcing .nd {
  fill: #abff97;
  animation: ph-pulse-1 2.8s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
  filter: drop-shadow(0 0 6px rgba(171,255,151,0.6));
}
.ph-sourcing .nd:nth-child(2) { animation-delay: -0.35s; }
.ph-sourcing .nd:nth-child(3) { animation-delay: -0.70s; }
.ph-sourcing .nd:nth-child(4) { animation-delay: -1.05s; }
.ph-sourcing .nd:nth-child(5) { animation-delay: -1.40s; }
.ph-sourcing .nd:nth-child(6) { animation-delay: -1.75s; }
.ph-sourcing .nd:nth-child(7) { animation-delay: -2.10s; }
.ph-sourcing .nd:nth-child(8) { animation-delay: -2.45s; }
.ph-sourcing .ln {
  stroke: rgba(171, 255, 151, 0.55);
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 4 6;
  animation: ph-dash 9s linear infinite;
}
@keyframes ph-pulse-1 {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50%      { transform: scale(2); opacity: 0.25; }
}
@keyframes ph-dash       { to { stroke-dashoffset: -160; } }
@keyframes ph-bg-breath  { 0%, 100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }

/* MODALIDADES · 3 streams flowing (A, B, C) */
.ph-modalidades { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-modalidades .stream {
  stroke: #abff97;
  stroke-width: 2.5;
  fill: none;
  stroke-dasharray: 8 4;
  animation: ph-flow 2.4s linear infinite;
  opacity: 0.7;
  filter: drop-shadow(0 0 4px rgba(171,255,151,0.4));
}
.ph-modalidades .stream:nth-child(2) { stroke: #FFD54F; animation-delay: -0.8s; opacity: 0.85; filter: drop-shadow(0 0 4px rgba(255,213,79,0.4)); }
.ph-modalidades .stream:nth-child(3) { stroke: rgba(255,255,255,0.85); animation-delay: -1.6s; opacity: 0.75; }
.ph-modalidades .container-ico {
  fill: rgba(255,255,255,0.12);
  stroke: rgba(255,255,255,0.40);
  stroke-width: 1.5;
  animation: ph-float 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes ph-flow { to { stroke-dashoffset: -120; } }

/* CALIDAD · checkmark grid with random pulses */
.ph-calidad { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-calidad .cell {
  fill: rgba(171, 255, 151, 0.10);
  stroke: rgba(171, 255, 151, 0.4);
  stroke-width: 0.8;
  animation: ph-check 5s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.ph-calidad .check {
  stroke: #abff97;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  animation: ph-check-show 5s ease-in-out infinite;
  filter: drop-shadow(0 0 5px rgba(171,255,151,0.5));
}
@keyframes ph-check {
  0%, 50% { fill: rgba(171, 255, 151, 0.10); transform: scale(1); }
  55%     { fill: rgba(171, 255, 151, 0.45); transform: scale(1.05); }
  70%, 100% { fill: rgba(171, 255, 151, 0.30); transform: scale(1); }
}
@keyframes ph-check-show {
  0%, 50% { opacity: 0; transform: scale(0.5); }
  60%     { opacity: 1; transform: scale(1.25); }
  70%, 100% { opacity: 1; transform: scale(1); }
}

/* LOGÍSTICA · container moving across */
.ph-logistica { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-logistica .ship {
  animation: ph-glide 7s ease-in-out infinite;
  transform-origin: center;
}
.ph-logistica .wave {
  stroke: rgba(255,255,255,0.28);
  fill: none;
  stroke-width: 1.2;
  stroke-dasharray: 6 8;
  animation: ph-flow 6s linear infinite;
}
.ph-logistica .container-box {
  fill: #abff97;
  stroke: rgba(10, 37, 64, 0.4);
  stroke-width: 1;
  filter: drop-shadow(0 4px 12px rgba(171,255,151,0.35));
}
@keyframes ph-glide {
  0%   { transform: translateX(-70%) translateY(0); }
  50%  { transform: translateX(0%) translateY(-4px); }
  100% { transform: translateX(70%) translateY(0); }
}

/* CASOS · ascending bars / data */
.ph-casos { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-casos .bar {
  fill: #abff97;
  animation: ph-grow 2.6s ease-in-out infinite;
  transform-origin: bottom;
  transform-box: fill-box;
  filter: drop-shadow(0 0 6px rgba(171,255,151,0.4));
}
.ph-casos .bar:nth-child(2) { animation-delay: -0.35s; opacity: 0.9; }
.ph-casos .bar:nth-child(3) { animation-delay: -0.70s; opacity: 0.8; }
.ph-casos .bar:nth-child(4) { animation-delay: -1.05s; opacity: 0.7; }
.ph-casos .bar:nth-child(5) { animation-delay: -1.40s; opacity: 0.6; }
@keyframes ph-grow {
  0%, 100% { transform: scaleY(0.35); }
  50%      { transform: scaleY(1.05); }
}

/* CHINA · chinese seal / red accent */
.ph-china { background: linear-gradient(135deg, #5D0A0A 0%, #DC2626 60%, #F43F5E 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-china .seal {
  fill: none;
  stroke: rgba(255,255,255,0.85);
  stroke-width: 3;
  transform-origin: center;
  transform-box: fill-box;
  animation: ph-rot 18s linear infinite;
}
.ph-china .seal-text {
  fill: #fff;
  font-family: 'Inter Tight', sans-serif;
  font-size: 28px;
  font-weight: 800;
  text-anchor: middle;
  animation: ph-pulse-orb 3.5s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.ph-china .glyph {
  fill: rgba(255,255,255,0.14);
  font-family: serif;
  font-size: 120px;
  font-weight: bold;
  text-anchor: middle;
  animation: ph-pulse-glyph 6s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes ph-rot         { to { transform: rotate(360deg); } }
@keyframes ph-pulse-glyph { 0%, 100% { opacity: 0.14; transform: scale(1); } 50% { opacity: 0.22; transform: scale(1.04); } }

/* PRODUCTO · floating cards pattern */
.ph-producto { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-producto .ccard {
  fill: rgba(255,255,255,0.12);
  stroke: rgba(255,255,255,0.35);
  stroke-width: 1;
  animation: ph-float-card 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.ph-producto .ccard:nth-child(2) { animation-delay: -0.8s; fill: rgba(171, 255, 151, 0.22); }
.ph-producto .ccard:nth-child(3) { animation-delay: -1.6s; }
.ph-producto .ccard:nth-child(4) { animation-delay: -2.4s; fill: rgba(255, 213, 79, 0.22); }
.ph-producto .ccard:nth-child(5) { animation-delay: -3.2s; }
@keyframes ph-float-card {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(2deg); }
}
@keyframes ph-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* FOUNDER · gradient orb pulsing */
.ph-founder { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-founder .orb-bg {
  fill: rgba(255,255,255,0.06);
  animation: ph-pulse-orb 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.ph-founder .orb {
  fill: url(#orb-grad);
  animation: ph-pulse-orb 4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
  animation-delay: -2s;
  filter: drop-shadow(0 0 18px rgba(171,255,151,0.5));
}
.ph-founder .ring {
  fill: none;
  stroke: rgba(171,255,151,0.55);
  stroke-width: 1.5;
  stroke-dasharray: 2 6;
  animation: ph-rot 10s linear infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes ph-pulse-orb {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.15); opacity: 0.85; }
}

/* UPDATES · news ticker / horizontal sweep */
.ph-updates { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-updates .sweep {
  fill: rgba(171, 255, 151, 0.25);
  animation: ph-sweep 4s ease-in-out infinite;
  transform-origin: left center;
  transform-box: fill-box;
}
.ph-updates .dot-row .dot {
  fill: #abff97;
  animation: ph-blink 1.4s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(171,255,151,0.5));
}
.ph-updates .dot-row .dot:nth-child(2) { animation-delay: 0.15s; }
.ph-updates .dot-row .dot:nth-child(3) { animation-delay: 0.30s; }
.ph-updates .dot-row .dot:nth-child(4) { animation-delay: 0.45s; }
.ph-updates .dot-row .dot:nth-child(5) { animation-delay: 0.60s; }
@keyframes ph-sweep {
  0%, 100% { transform: scaleX(0); }
  50%      { transform: scaleX(1); }
}
@keyframes ph-blink {
  0%, 100% { opacity: 0.25; transform: scale(0.9); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* EDUCATIVO · open book / dl-like rows */
.ph-educativo { background: linear-gradient(135deg, #0A1F8F 0%, #2F4FFF 60%, #4D6FFF 100%); background-size: 200% 200%; animation: ph-bg-breath 14s ease-in-out infinite; }
.ph-educativo .row {
  fill: none;
  stroke: rgba(255,255,255,0.45);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: ph-draw 3s ease-in-out infinite;
}
.ph-educativo .row:nth-child(2) { animation-delay: 0.3s; stroke-dasharray: 180; stroke-dashoffset: 180; }
.ph-educativo .row:nth-child(3) { animation-delay: 0.6s; stroke-dasharray: 210; stroke-dashoffset: 210; }
.ph-educativo .row:nth-child(4) { animation-delay: 0.9s; stroke-dasharray: 150; stroke-dashoffset: 150; }
.ph-educativo .accent {
  fill: #abff97;
  animation: ph-bullet 3s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
  filter: drop-shadow(0 0 4px rgba(171,255,151,0.5));
}
.ph-educativo .accent:nth-child(6) { animation-delay: 0.3s; }
.ph-educativo .accent:nth-child(7) { animation-delay: 0.6s; }
.ph-educativo .accent:nth-child(8) { animation-delay: 0.9s; }
@keyframes ph-draw {
  0%        { stroke-dashoffset: var(--len, 240); opacity: 0.3; }
  40%, 70%  { stroke-dashoffset: 0; opacity: 1; }
  100%      { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes ph-bullet {
  0%, 30% { opacity: 0; transform: scale(0.3); }
  40%, 100% { opacity: 1; transform: scale(1.1); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .post-hero-anim,
  .post-hero-anim::before,
  .post-hero-anim::after,
  .post-hero-anim svg * { animation: none !important; }
  .post-hero-anim::before { opacity: 0; }
}
