/* ============================================
   PRECISIONCORE — Animations
   GPU-composited, cinematic gold theme
   ============================================ */

/* ============================================
   Loading Screen
   ============================================ */
#loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 28px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader-icon {
    position: relative;
    width: 72px;
    height: 72px;
}

/* Outer ring — spins */
.loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid transparent;
    border-top-color: #d4a853;
    border-right-color: rgba(212, 168, 83, 0.2);
    animation: loaderSpin 1.2s linear infinite;
}

/* Inner ring — counter spins */
.loader-ring-inner {
    position: absolute;
    inset: 14px;
    border-radius: 50%;
    border: 1px solid transparent;
    border-bottom-color: #b07d2e;
    border-left-color: rgba(176, 125, 46, 0.2);
    animation: loaderSpin 0.8s linear infinite reverse;
}

/* Center crosshair */
.loader-crosshair {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #d4a853;
    filter: drop-shadow(0 0 10px rgba(212, 168, 83, 0.6));
    animation: loaderPulse 1.4s ease-in-out infinite;
}

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

@keyframes loaderPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.88); }
}

/* Logo text during load */
.loader-wordmark {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: #f5f5f0;
    text-transform: uppercase;
    animation: loaderFadeIn 0.6s ease both;
}

.loader-wordmark span {
    background: linear-gradient(135deg, #f0d68a, #d4a853, #b07d2e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Progress bar */
.loader-bar-wrap {
    width: 140px;
    height: 1px;
    background: rgba(212, 168, 83, 0.1);
    border-radius: 1px;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d4a853, #f0d68a);
    border-radius: 1px;
    animation: loaderBar 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    box-shadow: 0 0 6px rgba(212, 168, 83, 0.4);
}

@keyframes loaderBar {
    0%   { width: 0%; }
    60%  { width: 80%; }
    100% { width: 100%; }
}

@keyframes loaderFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Page System — GPU only
   ============================================ */
.page {
    will-change: opacity, transform;
}

.page.active {
    animation: pageEnterAnim 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.page.page-exit {
    animation: pageExitAnim 0.25s ease forwards;
    pointer-events: none;
}

.page.page-enter {
    animation: pageEnterAnim 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pageEnterAnim {
    from { opacity: 0; transform: translateY(16px) scale(0.995); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pageExitAnim {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-10px); }
}

/* ============================================
   Hero animate-in elements
   ============================================ */
.animate-in {
    opacity: 0;
    transform: translateY(24px);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.30s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.60s; }

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Scroll Reveal
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity  0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--delay, 0s);
    will-change: opacity, transform;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Card shine sweep — gold
   ============================================ */
.feature-card,
.tier-card {
    overflow: hidden;
}

.feature-card::after,
.tier-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 168, 83, 0.03),
        transparent
    );
    transition: left 0.6s ease;
    pointer-events: none;
}

.feature-card:hover::after,
.tier-card:hover::after {
    left: 140%;
}

/* ============================================
   Button Ripple
   ============================================ */
.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0);
    animation: ripple 0.55s ease-out forwards;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================
   Add-to-Cart feedback
   ============================================ */
.add-to-cart {
    transition: background 0.25s ease, transform 0.2s ease;
}

.add-to-cart.added {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    transform: scale(0.96);
}

/* ============================================
   Particles
   ============================================ */
.particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: rgba(212, 168, 83, 0.15);
    border-radius: 50%;
    animation: particleFloat linear infinite;
    will-change: transform, opacity;
}

@keyframes particleFloat {
    0%   { transform: translateY(110vh); opacity: 0; }
    8%   { opacity: 0.6; }
    92%  { opacity: 0.6; }
    100% { transform: translateY(-8vh); opacity: 0; }
}

/* ============================================
   Toast
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(10, 10, 8, 0.95);
    border: 1px solid rgba(212, 168, 83, 0.1);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: #f5f5f0;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    max-width: 340px;
    pointer-events: auto;
    will-change: transform, opacity;
    backdrop-filter: blur(16px);
}

.toast.toast-exit {
    animation: toastOut 0.25s ease forwards;
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #10b981;
}

.toast-content { flex: 1; }
.toast-title   { font-weight: 600; font-size: 0.82rem; }
.toast-message { font-size: 0.74rem; color: #8a8a7a; margin-top: 2px; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.92); }
    to   { opacity: 1; transform: translateX(0)   scale(1); }
}

@keyframes toastOut {
    to   { opacity: 0; transform: translateX(60px) scale(0.92); }
}

/* ============================================
   Nav link underline indicator
   ============================================ */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: #d4a853;
    border-radius: 1px;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 16px;
}

/* ============================================
   Badge dot pulse
   ============================================ */
.badge-dot {
    animation: dotPulse 2.5s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(212,168,83,0.3); }
    50%       { opacity: 0.6; transform: scale(0.8); box-shadow: 0 0 0 4px rgba(212,168,83,0); }
}

/* ============================================
   Orb float — CSS fallback
   ============================================ */
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(15px, -25px) scale(1.03); }
    66%       { transform: translate(-10px, 12px) scale(0.97); }
}

.hero-orb {
    animation: orbFloat 25s ease-in-out infinite;
}
.hero-orb-2 { animation-delay: -9s; }
.hero-orb-3 { animation-delay: -17s; }

/* ============================================
   Reduced motion override
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .scroll-reveal { opacity: 1; transform: none; }
    .animate-in    { opacity: 1; transform: none; }
}
