/* ==========================================================================
   IH INDUSTRIAL SUPPLY CO. — animations.css
   Adds: hero auto-carousel, scroll-triggered reveal variants, refined
   hover/transition states. Pure CSS3, no framework, no dependencies.
   Loaded AFTER css/style.css so it can refine existing components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TIMING TOKENS
   -------------------------------------------------------------------------- */
:root {
  --ease-out-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --reveal-duration: 720ms;
  --hero-fade: 1200ms;
}

/* --------------------------------------------------------------------------
   2. HERO AUTOMATIC CAROUSEL
   Slides are stacked absolutely and cross-faded on a timer by JavaScript.
   A slow Ken-Burns zoom keeps the motion subtle and corporate.
   -------------------------------------------------------------------------- */
.hero--carousel { background-image: none; overflow: hidden; }

.hero__slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__slide {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity var(--hero-fade) var(--ease-out-soft),
              transform 9000ms linear;
  will-change: opacity, transform;
}

.hero__slide.is-active {
  opacity: 1;
  transform: scale(1);
}

/* Overlay must sit above the slides but below the content */
.hero--carousel::before { z-index: 1; }
.hero--carousel .container { z-index: 2; }

/* Slide indicators ------------------------------------------------------- */
.hero__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26px;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hero__dot {
  width: 30px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.32);
  cursor: pointer;
  transition: background 260ms var(--ease-out-soft),
              width 260ms var(--ease-out-soft);
}

.hero__dot:hover { background: rgba(255, 255, 255, 0.6); }

.hero__dot.is-active {
  width: 48px;
  background: var(--accent, #f26b0f);
}

.hero__dot:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Entrance animation for the hero copy on first paint --------------------- */
.hero__inner > * {
  animation: heroRise 900ms var(--ease-out-soft) both;
}
.hero__inner > *:nth-child(1) { animation-delay: 80ms; }
.hero__inner > *:nth-child(2) { animation-delay: 180ms; }
.hero__inner > *:nth-child(3) { animation-delay: 280ms; }
.hero__inner > *:nth-child(4) { animation-delay: 380ms; }
.hero__inner > *:nth-child(5) { animation-delay: 480ms; }
.hero__inner > *:nth-child(6) { animation-delay: 580ms; }

@keyframes heroRise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   3. SCROLL-TRIGGERED REVEAL VARIANTS
   Elements start hidden and are revealed by the IntersectionObserver in
   js/dynamic.js, which adds .is-visible.
   -------------------------------------------------------------------------- */
[data-animate] {
  opacity: 0;
  transition: opacity var(--reveal-duration) var(--ease-out-soft),
              transform var(--reveal-duration) var(--ease-out-soft);
  will-change: opacity, transform;
}

[data-animate="fade-up"]    { transform: translateY(28px); }
[data-animate="fade-down"]  { transform: translateY(-24px); }
[data-animate="fade-left"]  { transform: translateX(34px); }
[data-animate="fade-right"] { transform: translateX(-34px); }
[data-animate="fade"]       { transform: none; }
[data-animate="zoom"]       { transform: scale(0.96); }

[data-animate].is-visible {
  opacity: 1;
  transform: none;
}

/* Staggered children (grids, lists) -------------------------------------- */
[data-animate-stagger] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--reveal-duration) var(--ease-out-soft),
              transform var(--reveal-duration) var(--ease-out-soft);
}
[data-animate-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

/* Section headings get a thin accent rule that draws in ------------------- */
.section-head h2 { position: relative; }
.section-head[data-animate] h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -12px;
  width: 0;
  height: 3px;
  border-radius: 3px;
  background: var(--accent, #f26b0f);
  transition: width 780ms var(--ease-out-soft) 220ms;
}
.section-head--center[data-animate] h2::after { left: 50%; transform: translateX(-50%); }
.section-head[data-animate].is-visible h2::after { width: 58px; }

/* Animated counters keep numerals from shifting width -------------------- */
[data-count-to] { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   4. REFINED HOVER STATES
   Subtle lifts, soft shadows and accent underlines — no flashy effects.
   -------------------------------------------------------------------------- */

/* Buttons: gentle sheen sweep on hover */
.btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 620ms var(--ease-out-soft);
}
.btn:hover::after,
.btn:focus-visible::after { transform: translateX(120%); }
.btn:active { transform: translateY(0); }

.btn--outline:hover {
  background: var(--navy, #0b1b2c);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 27, 44, 0.18);
}

/* Cards: slightly deeper lift plus accent top edge */
.card {
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent, #f26b0f);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 420ms var(--ease-out-soft);
  z-index: 2;
}
.card:hover::before,
.card:focus-within::before { transform: scaleX(1); }
.card:hover { transform: translateY(-6px); }

/* Media zoom refinement */
.card__media { overflow: hidden; }
.card__media img { transition: transform 700ms var(--ease-out-soft); }
.card:hover .card__media img { transform: scale(1.07); }

/* Text links: animated underline */
.site-footer a,
.nav a,
.link-arrow {
  position: relative;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  background: var(--accent, #f26b0f);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease-out-soft);
}
.nav a:hover::after,
.nav a.is-active::after { transform: scaleX(1); }
.nav a.btn::after { display: none; }

/* Feature / industry tiles */
.feature,
.industry { transition: transform 320ms var(--ease-out-soft),
                        box-shadow 320ms var(--ease-out-soft),
                        border-color 320ms var(--ease-out-soft),
                        background 320ms var(--ease-out-soft); }
.feature:hover,
.industry:hover { transform: translateY(-5px); }

/* Filter buttons and form controls */
.filter-btn:hover { transform: translateY(-2px); }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--navy, #0b1b2c); }

/* Images inside content blocks lift softly */
.split img {
  transition: transform 600ms var(--ease-out-soft), box-shadow 600ms var(--ease-out-soft);
}
.split img:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(11, 27, 44, 0.16);
}

/* Consistent, visible keyboard focus */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent, #f26b0f);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE + ACCESSIBILITY
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero__dots { bottom: 16px; }
  .hero__dot { width: 22px; }
  .hero__dot.is-active { width: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-animate],
  [data-animate-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .hero__inner > * { animation: none; }
  .hero__slide { transition: opacity 200ms linear; transform: none; }
  .btn::after { display: none; }
}
