/* ===== Reveal-on-scroll ===== */
.js-reveal {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition: opacity .8s cubic-bezier(.22, .61, .36, 1),
              transform .8s cubic-bezier(.22, .61, .36, 1);
  will-change: opacity, transform;
}
.js-reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .js-reveal, .js-reveal.is-visible { opacity: 1; transform: none; transition: none; }
  .card-sector, .card-service, .core-card, .news-card, .btn { transition: none !important; }
  .hero__scroll img { animation: none !important; }
}

/* ===== Hero entrance ===== */
@keyframes fade-up {
  0%   { opacity: 0; transform: translate3d(0, 24px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}
.hero__title       { animation: fade-up .9s cubic-bezier(.22,.61,.36,1) both .15s; }
.hero__lead        { animation: fade-up .9s cubic-bezier(.22,.61,.36,1) both .35s; }
.hero__features-label,
.hero__features-list { animation: fade-up .9s cubic-bezier(.22,.61,.36,1) both .55s; }
.hero__form        { animation: fade-up .9s cubic-bezier(.22,.61,.36,1) both .45s; }

/* Topbar + header fade-in */
@keyframes fade-down {
  0%   { opacity: 0; transform: translate3d(0, -16px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}
.topbar, .header { animation: fade-down .6s ease-out both; }

/* ===== Scroll indicator pulse ===== */
@keyframes mouse-bounce {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%      { transform: translateY(6px); opacity: .6; }
}
.hero__scroll img { animation: mouse-bounce 1.6s ease-in-out infinite; }

/* ===== Card hover refinements ===== */
.card-sector, .card-service, .core-card, .news-card {
  transition: transform .35s cubic-bezier(.22,.61,.36,1),
              box-shadow .35s cubic-bezier(.22,.61,.36,1),
              background-color .45s cubic-bezier(.22,.61,.36,1),
              color .45s cubic-bezier(.22,.61,.36,1),
              filter .35s ease;
}
/* Sus hijos también transitan color para que no haya snap */
.card-sector h3, .card-sector p,
.card-service h3, .card-service p,
.core-card h3, .core-card p,
.news-card h3, .news-card p {
  transition: color .45s cubic-bezier(.22,.61,.36,1);
}
.card-sector:hover,
.card-service:hover,
.core-card:hover,
.news-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -16px rgba(0, 44, 77, .25);
}

/* Arrow badge: SOLO cambia color en hover, sin movimiento (mantiene posición notch). */
.card-sector__arrow,
.news-card__arrow {
  transition: background-color .35s cubic-bezier(.22,.61,.36,1),
              box-shadow .35s ease;
}
.card-sector:hover .card-sector__arrow {
  background: var(--yellow);
  box-shadow: 0 10px 22px rgba(247, 185, 55, .35),
              0 0 0 1px rgba(0, 44, 77, .12) inset;
}
/* News card sigue con su efecto propio (rotate + scale) si lo tuviera; aquí
   evitamos transform y simplemente intensificamos. */
.news-card:hover .news-card__arrow {
  background: var(--yellow);
}
.news-card:hover .news-card__arrow img { filter: none; }
/* Servicios card mantiene su efecto bg amarillo definido en styles.css */

/* ===== Button transitions ===== */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform .15s ease,
              filter .2s ease,
              box-shadow .25s ease;
}
.btn:hover { box-shadow: 0 10px 24px -8px rgba(247, 185, 55, .45); }
.btn--navy:hover { box-shadow: 0 10px 24px -8px rgba(36, 74, 117, .55); }
.btn:active { transform: scale(.97); }

/* Subtle ripple via pseudo-element */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,.4) 0%, transparent 60%);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .4s ease, transform .5s ease;
  pointer-events: none;
}
.btn:hover::after { opacity: 1; transform: scale(1.4); }

/* ===== Form focus glow ===== */
.hero__form input,
.hero__form textarea {
  transition: background .25s ease, box-shadow .25s ease, transform .15s ease;
}
.hero__form input:focus,
.hero__form textarea:focus {
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(247, 185, 55, .25);
}

/* ===== Header nav underline ===== */
.header__nav > a,
.header__nav .has-caret {
  position: relative;
  transition: color .25s ease;
}
.header__nav > a::before,
.header__nav .has-caret::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
}
.header__nav > a:hover::before,
.header__nav > a.is-active::before,
.header__nav .has-caret:hover::before,
.header__nav-item.is-open .has-caret::before { transform: scaleX(1); }
/* Dropdown items: no underline */
.header__nav .dropdown a::before { display: none; }

/* ===== Sticky topbar + header on scroll (added via JS) ===== */
.hero__topbar.is-stuck {
  position: fixed;
  top: 12px;
  z-index: 1001;
  background: rgba(36, 74, 117, .92); /* navy con leve transparencia para diferenciar */
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 12px 32px rgba(0, 44, 77, .35),
              0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.header.is-stuck {
  position: fixed;
  top: 52px; /* 12 topbar + 33 height + 7 gap */
  z-index: 1000;
}
.header.is-stuck .header__inner {
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 12px 32px rgba(0, 44, 77, .22),
              0 0 0 1px rgba(0, 44, 77, .06) inset;
}
/* Fade-out pills al llegar al footer (added via JS .is-hidden) */
.hero__topbar.is-hidden,
.header.is-hidden {
  animation: none; /* parar fade-down forwards que bloquea el translate */
  opacity: 0;
  transform: translateY(-24px);
  pointer-events: none;
  transition: opacity .45s cubic-bezier(.22, .61, .36, 1),
              transform .45s cubic-bezier(.22, .61, .36, 1),
              visibility 0s linear .45s;
  visibility: hidden;
}
/* Re-aparición */
.hero__topbar,
.header {
  transition: top .3s cubic-bezier(.22,.61,.36,1),
              box-shadow .25s ease,
              backdrop-filter .25s ease,
              opacity .35s cubic-bezier(.22,.61,.36,1),
              transform .35s cubic-bezier(.22,.61,.36,1);
}

/* Si el usuario prefiere reducir movimiento: sin transición */
@media (prefers-reduced-motion: reduce) {
  .hero__topbar, .header,
  .hero__topbar.is-hidden, .header.is-hidden { transition: none; }
}

/* ===== About: stagger stat counters ===== */
.about.is-visible .about__stat:nth-child(1) { animation: pop-in .7s cubic-bezier(.22,.61,.36,1) both .15s; }
.about.is-visible .about__stat:nth-child(2) { animation: pop-in .7s cubic-bezier(.22,.61,.36,1) both .30s; }
.about.is-visible .about__stat:nth-child(3) { animation: pop-in .7s cubic-bezier(.22,.61,.36,1) both .45s; }
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.85); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== Sectores / Servicios / Core: stagger cards ===== */
.sectores.is-visible .card-sector,
.servicios.is-visible .card-service,
.core.is-visible .core-card,
.news.is-visible .news-card {
  animation: fade-up .7s cubic-bezier(.22,.61,.36,1) both;
}
.sectores.is-visible .card-sector:nth-child(1),
.servicios.is-visible .card-service:nth-child(1),
.core.is-visible .core-card:nth-child(1),
.news.is-visible .news-card:nth-child(1) { animation-delay: .05s; }

.sectores.is-visible .card-sector:nth-child(2),
.servicios.is-visible .card-service:nth-child(2),
.core.is-visible .core-card:nth-child(2),
.news.is-visible .news-card:nth-child(2) { animation-delay: .15s; }

.sectores.is-visible .card-sector:nth-child(3),
.servicios.is-visible .card-service:nth-child(3),
.core.is-visible .core-card:nth-child(3),
.news.is-visible .news-card:nth-child(3) { animation-delay: .25s; }

.sectores.is-visible .card-sector:nth-child(4),
.servicios.is-visible .card-service:nth-child(4) { animation-delay: .35s; }

.servicios.is-visible .card-service:nth-child(5) { animation-delay: .45s; }

/* ===== How-it-works: timeline reveal ===== */
.how.is-visible .how__step {
  animation: fade-up .6s cubic-bezier(.22,.61,.36,1) both;
}
.how.is-visible .how__step:nth-child(1) { animation-delay: .10s; }
.how.is-visible .how__step:nth-child(2) { animation-delay: .25s; }
.how.is-visible .how__step:nth-child(3) { animation-delay: .40s; }
.how.is-visible .how__step:nth-child(4) { animation-delay: .55s; }
.how.is-visible .how__step:nth-child(5) { animation-delay: .70s; }

.how__image img { transition: transform .8s ease; }
.how.is-visible .how__image img { animation: zoom-in 1s cubic-bezier(.22,.61,.36,1) both; }
@keyframes zoom-in {
  0%   { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ===== News cards hover (Actualidad) ===== */
.news-card {
  overflow: hidden;
  transition: transform .4s cubic-bezier(.22,.61,.36,1),
              box-shadow .4s ease;
}
.news-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 28px 56px -20px rgba(0, 44, 77, .5);
}

/* Imagen: zoom + desaturada → color */
.news-card__media { overflow: hidden; }
.news-card__media img {
  transition: transform .7s cubic-bezier(.22,.61,.36,1),
              filter .55s ease;
  filter: saturate(.78) brightness(.92);
}
.news-card:hover .news-card__media img {
  transform: scale(1.08);
  filter: saturate(1.05) brightness(1);
}

/* Categoría: amarillo + shift derecha */
.news-card__cat {
  transition: background-color .3s ease,
              color .3s ease,
              transform .35s cubic-bezier(.22,.61,.36,1);
}
.news-card:hover .news-card__cat {
  background: var(--yellow);
  color: #000;
  transform: translateX(4px);
}

/* Título: subrayado amarillo que crece de izquierda a derecha */
.news-card h3 {
  position: relative;
  width: fit-content;
  max-width: 100%;
  transition: transform .35s cubic-bezier(.22,.61,.36,1);
}
.news-card h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--yellow);
  transition: width .45s cubic-bezier(.22,.61,.36,1);
}
.news-card:hover h3::after { width: 60%; }
.news-card--featured:hover h3 { transform: translateX(4px); }

/* Botón "Leer más" */
.news-card .btn--white {
  transition: background-color .3s ease,
              color .3s ease,
              padding-right .3s ease;
}
.news-card:hover .btn--white {
  background: var(--yellow);
  color: #000;
}

/* Featured: illustration bg más visible */
.news-card__bg {
  transition: opacity .6s ease, transform .8s ease;
}
.news-card--featured:hover .news-card__bg {
  opacity: .45;
  transform: scale(1.04);
}

/* Excerpt p: leve color shift */
.news-card p {
  transition: color .3s ease;
}
.news-card:hover p { color: #cdd6e2; }
.news-card--featured:hover p { color: #fff; }

/* ===== Footer link hover ===== */
.footer__links a { transition: color .2s ease, padding-left .25s ease; }
.footer__links a:hover { color: #fff; padding-left: 4px; }

/* ===== Smooth anchor scroll (CSS fallback; JS overrides) ===== */
html { scroll-behavior: smooth; }
