/* ═══════════════════════════════════════════════════════════════
   CW Paint Works — Premium Animations & Micro-Interactions
   Pure CSS + Vanilla JS, no libraries.
   All animations respect prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════ */

/* ── SCROLL PROGRESS BAR ─────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-lo), var(--gold-hi), #E8C84A);
  z-index: 9999;
  transition: width 0.05s linear;
  pointer-events: none;
  /* Subtle glow so it pops on light background */
  box-shadow: 0 0 6px rgba(200,160,32,0.55);
}

/* ── ENHANCED SECTION REVEALS ────────────────────────────── */
/* Deeper stagger set for child-element cascades */
.reveal-d5 { transition-delay: 0.50s; }
.reveal-d6 { transition-delay: 0.62s; }

/* Slide from left — for eyebrow lines, dividers */
.reveal-left {
  opacity: 0;
  transform: translateX(-24px);
  transition:
    opacity 0.75s cubic-bezier(0.16,1,0.3,1),
    transform 0.75s cubic-bezier(0.16,1,0.3,1);
}
.reveal-left.visible { opacity: 1; transform: none; }

/* Scale reveal — for badges, logos, icons */
.reveal-scale {
  opacity: 0;
  transform: scale(0.88);
  transition:
    opacity 0.7s cubic-bezier(0.16,1,0.3,1),
    transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal-scale.visible { opacity: 1; transform: none; }

/* ── STAT COUNTER — gold numbers count up on reveal ─────── */
.trust-badge-num[data-count],
.stat-figure[data-count] {
  /* Numbers rendered by JS; initial state visible so no flash */
}

/* ── NAV ACTIVE LINK ─────────────────────────────────────── */
.nav-links a.nav-active {
  color: var(--ink);
}
.nav-links a.nav-active::after {
  transform: scaleX(1);
}

/* ── ENHANCED SERVICE CARDS ──────────────────────────────── */
.svc-card {
  /* Override base transition with premium version */
  transition:
    transform 0.30s cubic-bezier(0.16,1,0.3,1),
    box-shadow 0.30s cubic-bezier(0.16,1,0.3,1),
    border-color 0.30s ease,
    background 0.25s ease !important;
}
.svc-card:hover {
  transform: translateY(-8px) !important;
  box-shadow:
    0 24px 60px rgba(15,13,8,0.13),
    0 6px 20px rgba(200,160,32,0.10) !important;
  border-color: var(--gold-ring) !important;
}

/* Gold left-border slide-in accent */
.svc-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold-lo), var(--gold-hi));
  border-radius: var(--r) 0 0 var(--r);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.svc-card:hover::after {
  transform: scaleY(1);
}

/* Icon scale on hover */
.svc-card:hover .svc-card-icon {
  transform: scale(1.1) rotate(-3deg);
}
.svc-card-icon {
  transition: transform 0.30s cubic-bezier(0.34,1.56,0.64,1);
}

/* Warranty card — no left border (it's full-width dark) */
.svc-card--warranty::after { display: none; }

/* ── CTA BUTTON ENHANCEMENTS ─────────────────────────────── */
/* Shimmer overlay — inlined gradient that sweeps on hover */
.cta-primary {
  position: relative;
  overflow: hidden;
  transition:
    background 0.2s ease,
    transform 0.22s cubic-bezier(0.16,1,0.3,1),
    box-shadow 0.22s ease !important;
}
.cta-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.22),
    transparent
  );
  transform: skewX(-15deg);
  transition: left 0.55s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
.cta-primary:hover::after {
  left: 125%;
}
.cta-primary:hover {
  transform: scale(1.02) translateY(-2px) !important;
  box-shadow:
    0 10px 36px rgba(200,160,32,0.42),
    0 4px 14px rgba(200,160,32,0.26) !important;
}
.cta-primary:active {
  transform: scale(0.98) translateY(0) !important;
  box-shadow: 0 4px 14px rgba(200,160,32,0.28) !important;
  transition-duration: 0.08s !important;
}

/* Nav book button — same shimmer treatment */
.nav-book-btn {
  position: relative;
  overflow: hidden;
}
.nav-book-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.18),
    transparent
  );
  transform: skewX(-15deg);
  transition: left 0.5s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
.nav-book-btn:hover::after {
  left: 125%;
}
.nav-book-btn:hover {
  transform: translateY(-2px) !important;
}

/* Phone CTA — subtle scale */
.nav-phone:hover {
  transform: translateY(-2px) scale(1.02) !important;
}

/* ── PARALLAX CONTAINER HINTS ────────────────────────────── */
/* These classes are applied by JS rAF scroll handler */
.parallax-layer {
  will-change: transform;
}

/* Hero background gradient — moves at 0.15x scroll rate */
.hero::before {
  will-change: transform;
  transition: none !important; /* JS handles this */
}

/* Floating badge logo — subtle bob on hero badge */
@keyframes badgeFloat {
  0%, 100% { transform: translateY(0px) rotate(-6deg); }
  50%       { transform: translateY(-6px) rotate(-6deg); }
}
.hero-badge {
  animation: badgeFloat 4.5s ease-in-out infinite;
}

/* CW badge logo in hero — gentle float */
@keyframes badgeSpin {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50%       { transform: translateY(-4px) rotate(1.5deg); }
}
.hero-badge-logo {
  animation: badgeSpin 6s ease-in-out infinite;
}

/* Trust bar logo — subtle pulse */
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 3px 10px rgba(200,160,32,0.28)); }
  50%       { filter: drop-shadow(0 6px 20px rgba(200,160,32,0.50)); }
}
.trust-bar-logo {
  animation: logoGlow 5s ease-in-out infinite;
}

/* ── SECTION TRANSITION ACCENTS ──────────────────────────── */
/* Angled separator: hero → trust-bar */
.trust-bar {
  position: relative;
}
.trust-bar::before {
  content: '';
  position: absolute;
  top: -28px;
  left: 0;
  right: 0;
  height: 28px;
  background: var(--bg-ink);
  clip-path: polygon(0 100%, 100% 100%, 100% 50%, 0 0);
  pointer-events: none;
}

/* ── HOVER TESTIMONIAL CARD LIFT ─────────────────────────── */
.testimonial-card {
  transition:
    transform 0.28s cubic-bezier(0.16,1,0.3,1),
    box-shadow 0.28s ease !important;
}
.testimonial-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 56px rgba(15,13,8,0.12);
}

/* ── WHY CARD HOVER ──────────────────────────────────────── */
.why-card {
  transition:
    transform 0.28s cubic-bezier(0.16,1,0.3,1),
    box-shadow 0.28s ease,
    border-color 0.25s ease !important;
}
.why-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold-ring) !important;
  box-shadow: 0 20px 48px rgba(200,160,32,0.08);
}

/* ── AREA CARD HOVER ─────────────────────────────────────── */
.area-card {
  transition:
    transform 0.28s cubic-bezier(0.16,1,0.3,1),
    box-shadow 0.28s ease,
    border-color 0.25s ease !important;
}
.area-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-ring) !important;
  box-shadow: 0 16px 36px rgba(200,160,32,0.07);
}

/* ── PORTFOLIO ITEM HOVER ────────────────────────────────── */
.portfolio-item {
  transition: transform 0.28s cubic-bezier(0.16,1,0.3,1) !important;
}
.portfolio-item:hover {
  transform: translateY(-4px) scale(1.01) !important;
}

/* ── STATS BAR — premium dark counter strip ─────────────── */
.stats-bar {
  background: var(--bg-ink);
  padding: 72px 0 80px;
  position: relative;
  overflow: hidden;
}
.stats-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 120% at 50% -10%, rgba(200,160,32,0.07) 0%, transparent 65%);
  pointer-events: none;
}
.stats-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 40% 60% at 80% 100%, rgba(200,160,32,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.stats-bar-eyebrow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(200,160,32,0.60);
  margin: 0 0 40px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  position: relative;
  z-index: 1;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  position: relative;
}
/* Vertical divider between stat items */
.stat-item + .stat-item::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 0;
  bottom: 20%;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(200,160,32,0.22) 20%,
    rgba(200,160,32,0.22) 80%,
    transparent 100%
  );
}
.stat-icon {
  width: 40px;
  height: 40px;
  background: rgba(200,160,32,0.10);
  border: 1px solid rgba(200,160,32,0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.stat-number {
  margin-bottom: 10px;
  line-height: 1;
}
.stat-figure {
  font-family: var(--ff-serif);
  font-size: 52px;
  font-style: italic;
  color: var(--gold-hi);
  line-height: 1;
  display: block;
  will-change: auto;
  letter-spacing: -0.5px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(240,237,229,0.50);
  margin-bottom: 4px;
}
.stat-sublabel {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  color: rgba(200,160,32,0.55);
  font-style: italic;
  margin-top: 2px;
}
/* Gold shimmer under the figure */
.stat-accent {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-hi), transparent);
  border-radius: 2px;
  opacity: 0.4;
}

/* ── STATS BAR — Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .stats-bar { padding: 56px 0 64px; }
  .stats-bar-eyebrow { margin-bottom: 32px; }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }
  /* Remove vertical dividers on mobile */
  .stat-item + .stat-item::before { display: none; }
  .stat-item {
    padding: 24px 16px;
    border-bottom: 1px solid rgba(200,160,32,0.12);
  }
  .stat-item:nth-child(1),
  .stat-item:nth-child(2) {
    border-bottom: 1px solid rgba(200,160,32,0.12);
  }
  .stat-item:nth-child(3),
  .stat-item:nth-child(4) {
    border-bottom: none;
  }
  .stat-figure { font-size: 42px; }
  .stat-label { font-size: 9px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-item { padding: 20px 12px; }
  .stat-figure { font-size: 38px; }
  .stat-icon { width: 32px; height: 32px; margin-bottom: 12px; }
}

/* ── PREFERS-REDUCED-MOTION ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Kill all animations and transitions */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  /* Immediately show all reveal elements */
  .reveal,
  .reveal-left,
  .reveal-scale {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Stats bar counter initial values — show final state immediately */
  .stat-figure { opacity: 1 !important; }

  /* Kill parallax */
  .parallax-layer { transform: none !important; }

  /* Kill scroll progress (distracting with no motion) */
  #scroll-progress { display: none; }
}
