/* ============================================================
   ANIMATIONS — animations.css
   All keyframes, scroll-triggered reveals, hover effects,
   micro-interactions. Hardware-accelerated only (transform + opacity).
============================================================ */

/* ============================================================
   REDUCED MOTION — Override everything first
============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   PAGE LOAD ANIMATIONS
   Triggered by adding .page-loaded to <body>
============================================================ */

/* NAV LOGO */
.nav-logo {
  opacity: 0;
  transform: translateY(-18px);
}

.page-loaded .nav-logo {
  animation: fade-slide-down 0.5s 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* NAV LINKS — stagger via nth-child */
.nav-links li {
  opacity: 0;
  transform: translateY(-14px);
}

.nav-contact-link {
  opacity: 0;
  transform: translateY(-14px);
}

.page-loaded .nav-links li:nth-child(1) { animation: fade-slide-down 0.4s 0.10s ease forwards; }
.page-loaded .nav-links li:nth-child(2) { animation: fade-slide-down 0.4s 0.15s ease forwards; }
.page-loaded .nav-links li:nth-child(3) { animation: fade-slide-down 0.4s 0.20s ease forwards; }
.page-loaded .nav-links li:nth-child(4) { animation: fade-slide-down 0.4s 0.25s ease forwards; }
.page-loaded .nav-links li:nth-child(5) { animation: fade-slide-down 0.4s 0.30s ease forwards; }
.page-loaded .nav-links li:nth-child(6) { animation: fade-slide-down 0.4s 0.35s ease forwards; }
.page-loaded .nav-links li:nth-child(7) { animation: fade-slide-down 0.4s 0.40s ease forwards; }
.page-loaded .nav-links li:nth-child(8) { animation: fade-slide-down 0.4s 0.45s ease forwards; }
.page-loaded .nav-links li:nth-child(9) { animation: fade-slide-down 0.4s 0.50s ease forwards; }
.page-loaded .nav-contact-link        { animation: fade-slide-down 0.4s 0.30s ease forwards; }

/* Nav CTA button */
.nav-cta-wrap {
  opacity: 0;
}
.page-loaded .nav-cta-wrap {
  animation: fade-in 0.4s 0.45s ease forwards;
}

/* HERO TEXT — each .line gets clip-path reveal */
.hero-headline .line {
  clip-path: inset(0 100% 0 0);
}

.page-loaded .hero-headline .line:nth-child(1) {
  animation: text-reveal 0.9s 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.page-loaded .hero-headline .line:nth-child(2) {
  animation: text-reveal 0.9s 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.page-loaded .hero-headline .line:nth-child(3) {
  animation: text-reveal 0.9s 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.page-loaded .hero-headline .line:nth-child(4) {
  animation: text-reveal 0.9s 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Hero sub and CTAs */
.hero-sub {
  opacity: 0;
  transform: translateY(20px);
}
.page-loaded .hero-sub {
  animation: fade-slide-up 0.7s 0.75s ease forwards;
}

.hero-ctas {
  opacity: 0;
  transform: translateY(16px);
}
.page-loaded .hero-ctas {
  animation: fade-slide-up 0.7s 0.9s ease forwards;
}

.hero-eyebrow {
  opacity: 0;
}
.page-loaded .hero-eyebrow {
  animation:
    fade-in 0.5s 0.2s ease forwards,
    eyebrow-glow 2.4s 0.7s ease-in-out infinite;
}

/* ============================================================
   KEYFRAMES
============================================================ */

@keyframes fade-slide-down {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-slide-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  to { opacity: 1; }
}

@keyframes text-reveal {
  to { clip-path: inset(0 0% 0 0); }
}

/* ============================================================
   SCROLL-TRIGGERED REVEALS
   JS adds .is-visible when element enters viewport
============================================================ */

/* Base fade + rise */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.75s ease, transform 0.75s ease;
  will-change: opacity, transform;
}

.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide from right */
.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.75s ease, transform 0.75s ease;
  will-change: opacity, transform;
}

.reveal-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Section heading — clip-path sweep left to right */
.reveal-heading {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: clip-path;
}

.reveal-heading.is-visible {
  clip-path: inset(0 0% 0 0);
}

/* Image reveal — wipe from bottom up */
.reveal-image {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: clip-path;
}

.reveal-image.is-visible {
  clip-path: inset(0% 0 0 0);
}

/* Stagger children — JS sets --stagger-index on each child */
.stagger-children > * {
  transition-delay: calc(var(--stagger-index, 0) * 70ms) !important;
}

/* ============================================================
   TIMELINE ANIMATION
============================================================ */

.timeline-line {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.timeline-line.is-drawing {
  transform: scaleY(1);
}

/* ============================================================
   IMAGE HOVER EFFECTS
============================================================ */

.img-hover-wrap {
  overflow: hidden;
  display: block;
  position: relative;
}

.img-hover-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(25%) brightness(0.88);
  transition: transform 0.6s var(--transition-smooth), filter 0.45s ease;
  will-change: transform, filter;
}

/* Red overlay on hover */
.img-hover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(32, 87, 133, 0.14);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.img-hover-wrap:hover img {
  transform: scale(1.04);
  filter: grayscale(0%) brightness(1);
}

.img-hover-wrap:hover::after {
  opacity: 1;
}

/* ============================================================
   BUTTON HOVER (handled via hero.css ::before sweep)
   Additional micro-states here
============================================================ */

/* Nav link underline removed — island nav uses pill-hover style */

/* ============================================================
   SOCIAL BOUNCE
============================================================ */

.social-link:hover {
  animation: social-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes social-bounce {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-8px); }
  70%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* ============================================================
   FORM — FLOATING LABEL
============================================================ */

.form-group {
  position: relative;
}

.form-group .form-label-float {
  position: absolute;
  top: 0.9rem;
  left: 1rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  pointer-events: none;
  transition: transform 0.22s ease, font-size 0.22s ease, color 0.22s ease;
  transform-origin: top left;
  background: transparent;
}

.form-group input:focus ~ .form-label-float,
.form-group input:not(:placeholder-shown) ~ .form-label-float,
.form-group textarea:focus ~ .form-label-float,
.form-group textarea:not(:placeholder-shown) ~ .form-label-float {
  transform: translateY(-1.85rem) scale(0.78);
  color: var(--color-secondary);
}

/* ============================================================
   SUBMIT BUTTON STATES
============================================================ */

.btn--submit.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn--submit.is-loading .btn-text {
  opacity: 0;
}

.btn--submit.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.btn--submit.is-success {
  background: #166534;
  border-color: #166534;
  pointer-events: none;
}

.btn--submit.is-success::before {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   SCROLL TO TOP — fade in
   (Visibility toggled via JS class)
============================================================ */

/* Already in components.css — .scroll-top-btn.visible */

/* ============================================================
   PRODUCT CARD HOVER PARALLAX
============================================================ */

.blog-card .blog-card-image img {
  transition: transform 0.55s var(--transition-smooth), filter 0.4s ease;
  will-change: transform;
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.06);
}

/* ============================================================
   SECTION SEPARATOR (diagonal clip-path)
============================================================ */

.clip-bottom {
  clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.clip-top {
  clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 100%);
  margin-top: -2px;
}

.clip-both {
  clip-path: polygon(0 5%, 100% 0, 100% 95%, 0 100%);
}


/* Capabilities + equipment polish */
.capability-item.reveal {
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, box-shadow 0.3s ease;
}
.capability-item.is-visible:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}
.capability-item.is-visible .capability-icon {
  animation: cap-icon-pop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes cap-icon-pop {
  from { transform: scale(0.5) rotate(-12deg); opacity: 0; }
  to   { transform: scale(1) rotate(0); opacity: 1; }
}
.equipment-list li.reveal { transform: translateX(-28px); }
.equipment-list li.reveal.is-visible { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .capability-item.is-visible .capability-icon { animation: none; }
}
