/* ============================================================
   PowerCore site animations
   Shared animation layer for the whole site.
   Everything is gated behind html.js-anim (added by
   site-animations.js) and prefers-reduced-motion, so the site
   stays fully static and readable if JS is off or the user
   prefers reduced motion.
   ============================================================ */

/* ---------- Keyframes ---------- */
@keyframes fx-fade-down {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes fx-fade-up {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: none; }
}

@keyframes fx-grid-in {
    from { opacity: 0; }
    to   { opacity: 0.3; }
}

@keyframes fx-grid-pan {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 50px 50px, 0 0; }
}

@keyframes fx-flow {
    from { background-position: 220% 0; }
    to   { background-position: -120% 0; }
}

@keyframes fx-rise {
    0%   { transform: translateY(0); opacity: 0; }
    10%  { opacity: 0.7; }
    85%  { opacity: 0.25; }
    100% { transform: translateY(-560px); opacity: 0; }
}

@keyframes fx-breathe {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

@keyframes fx-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes fx-ring {
    0%   { transform: scale(0.55); opacity: 1; }
    100% { transform: scale(1.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html.js-anim *,
    html.js-anim *::before,
    html.js-anim *::after {
        animation-duration: 0.001s !important;
        animation-delay: 0s !important;
        transition-duration: 0.001s !important;
    }
}

/* ============================================================
   1. Page-load entrance
   ============================================================ */
html.js-anim .navbar {
    animation: fx-fade-down 0.55s ease both;
}

html.js-anim .hero-grid-bg {
    animation: fx-grid-in 0.9s ease 0.05s both, fx-grid-pan 26s linear 0.9s infinite;
}

html.js-anim .hero-title {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.12s both;
}

html.js-anim .hero-divider {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.22s both;
}

html.js-anim .hero-subtitle {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.32s both;
}

html.js-anim .hero-buttons {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.42s both;
}

html.js-anim .page-hero-title {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.1s both;
}

html.js-anim .page-hero-subtitle {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.2s both;
}

html.js-anim .breadcrumb {
    animation: fx-fade-up 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) 0.3s both;
}

/* ============================================================
   2. Scroll reveal (elements get .is-in from site-animations.js)
   ============================================================ */
html.js-anim .product-card,
html.js-anim .product-card-lg,
html.js-anim .solution-card,
html.js-anim .step-card,
html.js-anim .news-featured,
html.js-anim .news-item,
html.js-anim .cert-card,
html.js-anim .cert-strip-item,
html.js-anim .value-card,
html.js-anim .mini-card,
html.js-anim .highlight-item,
html.js-anim .faq-item,
html.js-anim .section-header,
html.js-anim .section-head-left,
html.js-anim .cta-banner,
html.js-anim .stat-item,
html.js-anim .contact-info-item,
html.js-anim .detail-copy,
html.js-anim .detail-visual,
html.js-anim .spec-table,
html.js-anim .visual-frame,
html.js-anim .two-col > *,
html.js-anim .form-card {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.6s ease, transform 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
    transition-delay: calc(var(--i, 0) * 90ms);
    will-change: opacity, transform;
}

html.js-anim .is-in {
    opacity: 1;
    transform: none;
    will-change: auto;
}

/* ============================================================
   3. Stat count-up pop
   ============================================================ */
html.js-anim .stat-number.is-counted,
html.js-anim .highlight-item .num.is-counted {
    animation: fx-pop 0.5s ease;
}

/* ============================================================
   4. Hero / page-hero ambient tech atmosphere
   ============================================================ */
html.js-anim .hero::before,
html.js-anim .page-hero::before {
    animation: fx-breathe 7s ease-in-out infinite;
}

/* Flowing energy line (injected by JS) */
.fx-energy-line {
    position: absolute;
    left: 50%;
    bottom: 64px;
    transform: translateX(-50%);
    width: min(560px, 72%);
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 107, 26, 0.22) 30%, rgba(255, 107, 26, 0.55) 50%, rgba(255, 107, 26, 0.22) 70%, transparent);
    overflow: hidden;
    opacity: 0.6;
    pointer-events: none;
    z-index: 1;
}

.fx-energy-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(90deg, transparent 40%, rgba(255, 180, 120, 0.95) 50%, transparent 60%);
    background-size: 260% 100%;
    animation: fx-flow 2.6s linear infinite;
}

/* Floating particles (injected by JS) */
.fx-particle {
    position: absolute;
    bottom: -12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(130, 175, 255, 0.95) 0%, rgba(130, 175, 255, 0) 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    animation-name: fx-rise;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

/* ============================================================
   5. Hover micro-interactions
   ============================================================ */
/* Button shine sweep (solid buttons only) */
.btn-primary,
.btn-quote {
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.btn-quote::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.32), transparent);
    transform: skewX(-18deg);
    transition: left 0.5s ease;
    pointer-events: none;
}

.btn-primary:hover::after,
.btn-quote:hover::after {
    left: 130%;
}

/* Nav link underline grows on hover */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-orange);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

/* Card hover glow — accent ring + soft orange halo */
.product-card:hover,
.product-card-lg:hover,
.solution-card:hover,
.step-card:hover,
.news-item:hover,
.news-featured:hover,
.cert-card:hover,
.cert-strip-item:hover,
.value-card:hover,
.mini-card:hover {
    box-shadow: 0 16px 40px rgba(10, 22, 40, 0.13),
        0 0 0 1px rgba(255, 107, 26, 0.28),
        0 0 26px rgba(255, 107, 26, 0.10);
}

/* Step cards gain a hover lift (they had none before) */
.step-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.step-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-orange);
}

/* Icon boxes warm up on hover */
.solution-card:hover .solution-icon,
.mini-card:hover .icon-box,
.cert-strip-item:hover .icon-box,
.value-card:hover .icon-box {
    background: rgba(255, 107, 26, 0.1);
    color: var(--accent-orange);
}

/* ============================================================
   6. Ambient details
   ============================================================ */
/* Timeline node pulse */
.tl-dot::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 107, 26, 0.45);
    animation: fx-ring 2.4s ease-out infinite;
    pointer-events: none;
}

/* CTA banner glow breathing */
.cta-banner::before {
    animation: fx-breathe 6s ease-in-out infinite;
}
