/* =============================================================
   Habla – Professional Animation System
   Complement to styles.css — does NOT override existing .reveal
   Uses transform/opacity only. Respects prefers-reduced-motion.
   ============================================================= */

/* ── Animation tokens ──────────────────────────────────────── */
:root {
  --ha-fast:    150ms;
  --ha-base:    260ms;
  --ha-slow:    420ms;
  --ha-spring:  cubic-bezier(0.22, 1, 0.36, 1);
  --ha-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ha-ease-in: cubic-bezier(0.64, 0, 0.78, 0);
}

/* ── Scroll-reveal system (hab-reveal) ─────────────────────── */
/* Separate namespace from existing .reveal + .in-view          */
.hab-reveal {
  opacity: 0;
  transform: translateY(26px);
  will-change: opacity, transform;
  transition:
    opacity   var(--ha-slow) var(--ha-spring),
    transform var(--ha-slow) var(--ha-spring);
}
.hab-reveal.hab-from-left  { transform: translateX(-26px); }
.hab-reveal.hab-from-right { transform: translateX(26px);  }
.hab-reveal.hab-scale      { transform: scale(0.93) translateY(10px); }
.hab-reveal.hab-fade       { transform: none; }

.hab-reveal.hab-in {
  opacity: 1;
  transform: none;
}

/* Stagger delays for sibling groups */
.hab-stagger > .hab-reveal:nth-child(1)   { transition-delay:   0ms; }
.hab-stagger > .hab-reveal:nth-child(2)   { transition-delay:  55ms; }
.hab-stagger > .hab-reveal:nth-child(3)   { transition-delay: 110ms; }
.hab-stagger > .hab-reveal:nth-child(4)   { transition-delay: 165ms; }
.hab-stagger > .hab-reveal:nth-child(5)   { transition-delay: 220ms; }
.hab-stagger > .hab-reveal:nth-child(6)   { transition-delay: 275ms; }
.hab-stagger > .hab-reveal:nth-child(n+7) { transition-delay: 330ms; }

/* ── Button press micro-interaction ───────────────────────── */
.btn:active {
  transform: scale(0.96) !important;
  transition-duration: var(--ha-fast) !important;
}

/* ── Nav link animated underline ───────────────────────────── */
.primary-nav > ul > li > a {
  position: relative;
  padding-bottom: 2px;
}
.primary-nav > ul > li > a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--habla-blue);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: width var(--ha-base) var(--ha-spring);
}
.primary-nav > ul > li > a:hover::after {
  width: 80%;
}

/* ── Blog cards hover ─────────────────────────────────────── */
.blog-card, .post-card {
  transition:
    transform  var(--ha-base) var(--ha-spring),
    box-shadow var(--ha-base) var(--ha-spring);
}
.blog-card:hover, .post-card:hover {
  transform:  translateY(-6px);
  box-shadow: 0 20px 48px rgba(43, 124, 255, 0.1);
}

/* ── Plan cards hover ─────────────────────────────────────── */
.mh-plan-card {
  transition:
    transform  var(--ha-base) var(--ha-spring),
    box-shadow var(--ha-base) var(--ha-spring),
    border-color var(--ha-base) ease;
}
.mh-plan-card:hover {
  transform:  translateY(-6px);
  box-shadow: 0 24px 56px rgba(43, 124, 255, 0.13);
  border-color: rgba(43, 124, 255, 0.35);
}

/* ── Sector cards hover ───────────────────────────────────── */
.sector-card {
  transition:
    transform  var(--ha-base) var(--ha-spring),
    box-shadow var(--ha-base) var(--ha-spring);
}
.sector-card:hover {
  transform:  translateY(-5px);
  box-shadow: 0 16px 40px rgba(15, 20, 25, 0.1);
}

/* ── Integration cards hover ──────────────────────────────── */
.intg-card {
  transition:
    transform  var(--ha-base) var(--ha-spring),
    box-shadow var(--ha-base) var(--ha-spring),
    border-color var(--ha-base) ease;
}
.intg-card:hover {
  transform:  translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(43, 124, 255, 0.1);
  border-color: rgba(43, 124, 255, 0.25);
}

/* ── Team photo cards hover ───────────────────────────────── */
.mh-team-photo-card {
  transition:
    transform  var(--ha-base) var(--ha-spring),
    box-shadow var(--ha-base) var(--ha-spring);
}
.mh-team-photo-card:hover {
  transform:  translateY(-5px);
  box-shadow: 0 18px 44px rgba(15, 20, 25, 0.12);
}

/* ── Blog card image zoom ─────────────────────────────────── */
.blog-card-thumb {
  overflow: hidden;
  display: block;
}
.blog-card-thumb img {
  transition: transform 380ms var(--ha-spring);
}
.blog-card:hover .blog-card-thumb img {
  transform: scale(1.05);
}

/* ── Focus ring enhancement ───────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--habla-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Gradient text animation ─────────────────────────────── */
@keyframes ha-gradientText {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}
.ha-gradient-text {
  background: linear-gradient(135deg, var(--habla-blue), #7c3aed, var(--habla-blue));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ha-gradientText 5s ease infinite;
}

/* ── Floating animation ───────────────────────────────────── */
@keyframes ha-float {
  0%, 100% { transform: translateY(0);   }
  50%       { transform: translateY(-8px); }
}
.ha-float {
  animation: ha-float 4s ease-in-out infinite;
}

/* ── Mobile menu slide-in ─────────────────────────────────── */
@media (max-width: 768px) {
  .site-header.mobile-open .primary-nav {
    animation: ha-slideDown 240ms var(--ha-spring) both;
  }
}
@keyframes ha-slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Reduced-motion override ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hab-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .ha-float,
  .ha-gradient-text { animation: none !important; }

  .blog-card, .post-card,
  .mh-plan-card,
  .sector-card,
  .intg-card,
  .mh-team-photo-card {
    transition: none !important;
  }
}
