/* ============================================
   ANIMATIONS & POLISH LAYER — animations.css
   Load AFTER style.css / sale.css / digital.css
   ============================================ */

/* ---------- PRELOADER ---------- */
#pagePreloader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#pagePreloader.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-ring {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(201,168,76,0.15);
    border-top-color: var(--gold);
    animation: preloaderSpin 0.9s linear infinite;
}
.preloader-word {
    font-family: 'Cormorant Garamond', serif;
    letter-spacing: 4px;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.85;
}
@keyframes preloaderSpin { to { transform: rotate(360deg); } }

/* ---------- SCROLL PROGRESS BAR ---------- */
#scrollProgress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    z-index: 99999;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px rgba(201,168,76,0.6);
}

/* ---------- SCROLL REVEAL (Intersection Observer driven) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 0.8s cubic-bezier(.22,1,.36,1), transform 0.8s cubic-bezier(.22,1,.36,1);
    will-change: opacity, transform;
}
.reveal.reveal-left { transform: translateX(-44px); }
.reveal.reveal-right { transform: translateX(44px); }
.reveal.reveal-zoom { transform: scale(0.92); }
.reveal.in-view {
    opacity: 1;
    transform: translateY(0) translateX(0) scale(1);
}

/* Stagger helper: apply .stagger to a container and children get a step delay */
.stagger .reveal:nth-child(1) { transition-delay: 0.02s; }
.stagger .reveal:nth-child(2) { transition-delay: 0.10s; }
.stagger .reveal:nth-child(3) { transition-delay: 0.18s; }
.stagger .reveal:nth-child(4) { transition-delay: 0.26s; }
.stagger .reveal:nth-child(5) { transition-delay: 0.34s; }
.stagger .reveal:nth-child(6) { transition-delay: 0.42s; }
.stagger .reveal:nth-child(7) { transition-delay: 0.50s; }
.stagger .reveal:nth-child(8) { transition-delay: 0.58s; }

/* ---------- SECTION HEAD UNDERLINE ANIMATION ---------- */
.section-head h2 { position: relative; display: inline-block; }
.section-head h2::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -12px;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    transform: translateX(-50%);
    transition: width 0.9s cubic-bezier(.22,1,.36,1);
}
.section-head.in-view h2::after { width: 120px; }

/* ---------- NAV LINK UNDERLINE ---------- */
.navbar-nav .nav-link { position: relative; }
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    left: 50%; bottom: 2px;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width 0.35s ease, left 0.35s ease;
}
.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after { width: 70%; left: 15%; }

/* ---------- LOGO SUBTLE ENTRANCE ---------- */
.nav-logo { transition: transform 0.4s ease, filter 0.4s ease; }
.navbar-brand:hover .nav-logo { transform: scale(1.05); filter: drop-shadow(0 0 10px rgba(201,168,76,0.5)); }

/* ---------- BUTTON SHINE SWEEP ---------- */
.btn-gold, .btn-ghost, .btn-wa, .cta-wa-btn, .buy-btn, .footer-wa {
    position: relative;
    overflow: hidden;
}
.btn-gold::before, .cta-wa-btn::before, .buy-btn::before, .btn-wa::before, .footer-wa::before {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.65s ease;
    pointer-events: none;
}
.btn-gold:hover::before, .cta-wa-btn:hover::before, .buy-btn:hover::before, .btn-wa:hover::before, .footer-wa:hover::before {
    left: 130%;
}

/* ---------- GOLD PULSE GLOW ON PRIMARY CTA ---------- */
.cta-wa-btn {
    animation: ctaGlow 2.6s ease-in-out infinite;
}
@keyframes ctaGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0.35); }
    50% { box-shadow: 0 0 0 12px rgba(37,211,102,0); }
}

/* ---------- HERO FLOATING GOLD ORBS (pure CSS, no images) ---------- */
.hero-slider { position: relative; }
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.22;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(circle, var(--gold), transparent 70%);
}
.hero-orb.orb-1 { width: 340px; height: 340px; top: 8%; left: -80px; animation: orbFloat 9s ease-in-out infinite; }
.hero-orb.orb-2 { width: 260px; height: 260px; bottom: 10%; right: -60px; animation: orbFloat 11s ease-in-out infinite reverse; }
@keyframes orbFloat {
    0%, 100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(30px,-25px) scale(1.08); }
}

/* ---------- SLIDE CONTENT TEXT REVEAL (letter-ish rise) ---------- */
.slide-content h1 { animation: heroRise 1s cubic-bezier(.22,1,.36,1) both; }
.slide-content .hero-eyebrow { animation: heroRise 0.8s cubic-bezier(.22,1,.36,1) both; }
.slide-content p { animation: heroRise 1s 0.15s cubic-bezier(.22,1,.36,1) both; }
@keyframes heroRise {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- SERVICE / PROCESS CARDS — lift + glow ---------- */
.svc-card, .process-card, .sale-card, .digital-card, .cert-card {
    transition: transform 0.45s cubic-bezier(.22,1,.36,1), box-shadow 0.45s ease, border-color 0.4s ease, background 0.4s ease;
}
.svc-card:hover, .process-card:hover {
    box-shadow: 0 18px 40px rgba(0,0,0,0.35), 0 0 0 1px rgba(201,168,76,0.15);
}
.svc-icon, .scf-icon { transition: transform 0.5s cubic-bezier(.34,1.56,.64,1), background 0.4s, border-color 0.4s; }
.svc-card:hover .svc-icon { transform: rotate(-8deg) scale(1.08); }

/* ---------- PORTFOLIO / SALE IMAGE ZOOM ---------- */
.p-box img, .sale-img-wrap img, .port-img-wrap img { transition: transform 0.7s cubic-bezier(.22,1,.36,1), filter 0.5s ease; }
.p-box:hover img { filter: brightness(0.85); }

/* ---------- STAT NUMBERS ---------- */
.stat-item h3 { position: relative; }
.stat-item { transition: transform 0.4s ease; }
.stat-item:hover { transform: translateY(-4px); }

/* ---------- ABOUT SKILL TAGS ---------- */
.skill-tag {
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), background 0.35s, border-color 0.35s;
}
.skill-tag:hover { transform: translateY(-3px) scale(1.04); }

/* ---------- CONTACT FORM FIELD FOCUS GLOW ---------- */
.contact-form input, .contact-form textarea, .contact-form-box input, .contact-form-box textarea {
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.25s ease;
}
.contact-form input:focus, .contact-form textarea:focus,
.contact-form-box input:focus, .contact-form-box textarea:focus {
    box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
    transform: translateY(-1px);
}

/* ---------- SCROLL TO TOP BUTTON ---------- */
#scrollTopBtn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--gold);
    color: #1a0a00;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: opacity 0.35s ease, transform 0.35s ease, background 0.3s ease, visibility 0.35s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
#scrollTopBtn.show { opacity: 1; visibility: visible; transform: translateY(0); }
#scrollTopBtn:hover { background: var(--gold-light); transform: translateY(-4px); }

/* ---------- WHATSAPP FLOATING BUTTON PULSE (if present) ---------- */
.wa-float-pulse {
    position: fixed;
    left: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 9990;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: waPulse 2.4s ease-in-out infinite;
    text-decoration: none;
}
.wa-float-pulse:hover { color: #fff; background: #1fb558; }
@keyframes waPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 0 rgba(37,211,102,0.5); }
    50% { box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 10px rgba(37,211,102,0); }
}

/* ---------- MODAL ENTRANCE POLISH (works with existing .open toggles) ---------- */
.portfolio-modal, .cert-modal { transition: opacity 0.35s ease; }

/* ---------- REDUCED MOTION SUPPORT ---------- */
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .cta-wa-btn, .wa-float-pulse, .hero-orb, .preloader-ring, .scroll-line { animation: none !important; }
    .slide-content h1, .slide-content p, .slide-content .hero-eyebrow { animation: none !important; opacity: 1 !important; }
}

/* ---------- MOBILE TUNING ---------- */
@media (max-width: 576px) {
    #scrollTopBtn { right: 16px; bottom: 16px; width: 42px; height: 42px; }
    .wa-float-pulse { left: 16px; bottom: 16px; width: 46px; height: 46px; font-size: 19px; }
    .hero-orb { display: none; }
}
