/* ===================================================================
   UNIVERSAL PRODUCTS — Global Animations & Premium UI Enhancements
   Scroll-triggered reveals, micro-interactions, cursor, particles,
   magnetic buttons, page transitions, number counters, and more.
   =================================================================== */

/* ===================================================================
   1. ADVANCED KEYFRAME LIBRARY
   =================================================================== */

@keyframes fadeUpReveal {
    from { opacity: 0; transform: translateY(45px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

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

@keyframes fadeLeftReveal {
    from { opacity: 0; transform: translateX(-50px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeRightReveal {
    from { opacity: 0; transform: translateX(50px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes floatSlow {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33%       { transform: translateY(-10px) rotate(0.5deg); }
    66%       { transform: translateY(-5px) rotate(-0.5deg); }
}

@keyframes floatDelayed {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-12px); }
}

@keyframes shimmerSweep {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

@keyframes goldShimmerWave {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(197, 155, 81, 0); }
    50%       { box-shadow: 0 0 0 12px rgba(197, 155, 81, 0.12); }
}

@keyframes breathe {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.04); }
}

@keyframes rotateSlowCW {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes rotateSlowCCW {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

@keyframes marqueeScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@keyframes gradientShift {
    0%   { background-position: 0%   50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0%   50%; }
}

@keyframes rippleExpand {
    0%   { transform: scale(0);   opacity: 0.5; }
    100% { transform: scale(4);   opacity: 0; }
}

@keyframes blobMorph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25%       { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50%       { border-radius: 50% 60% 30% 60% / 40% 30% 70% 60%; }
    75%       { border-radius: 40% 60% 60% 40% / 60% 40% 50% 60%; }
}

@keyframes lineGrow {
    from { transform: scaleX(0); transform-origin: left; }
    to   { transform: scaleX(1); transform-origin: left; }
}

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

@keyframes borderDraw {
    from { stroke-dashoffset: 1000; }
    to   { stroke-dashoffset: 0; }
}

@keyframes slideInBar {
    from { width: 0; }
    to   { width: var(--target-width, 80%); }
}

@keyframes shimmerLoad {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40%            { transform: scale(1); opacity: 1; }
}

@keyframes curtainReveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0% 0 0); }
}

/* ===================================================================
   2. SCROLL-REVEAL SYSTEM (replaces old .reveal-on-scroll)
   =================================================================== */

.anim-fade-up {
    opacity: 0;
    transform: translateY(50px) scale(0.97);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.anim-fade-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-fade-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-scale-in {
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.anim-fade-up.in-view,
.anim-fade-left.in-view,
.anim-fade-right.in-view,
.anim-scale-in.in-view {
    opacity: 1;
    transform: none;
}

/* backward compat */
.reveal-on-scroll {
    opacity: 0 !important;
    transform: translateY(50px) scale(0.95);
    transition: opacity 0.95s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-on-scroll.revealed,
.reveal-up.revealed {
    opacity: 1 !important;
    transform: none;
}
.reveal-up {
    opacity: 0;
    transform: translateY(45px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger delays */
.delay-1  { transition-delay: 0.08s !important; }
.delay-2  { transition-delay: 0.16s !important; }
.delay-3  { transition-delay: 0.24s !important; }
.delay-4  { transition-delay: 0.32s !important; }
.delay-5  { transition-delay: 0.42s !important; }
.delay-6  { transition-delay: 0.54s !important; }
.stagger-1{ transition-delay: 0.1s  !important; }
.stagger-2{ transition-delay: 0.2s  !important; }
.stagger-3{ transition-delay: 0.3s  !important; }
.stagger-4{ transition-delay: 0.4s  !important; }

/* ── Cursor: normal pointer on interactive elements ── */
a, button, .product-card, [role="button"] {
    cursor: pointer;
}


/* ===================================================================
   4. AMBIENT PARTICLE CANVAS (hero background)
   =================================================================== */

#up-particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
}

/* ===================================================================
   5. HEADER — ENHANCED TRANSITIONS & ACTIVE INDICATOR
   =================================================================== */

.site-header {
    transition: background-color 0.5s cubic-bezier(0.16,1,0.3,1),
                box-shadow 0.5s cubic-bezier(0.16,1,0.3,1),
                border-color 0.5s cubic-bezier(0.16,1,0.3,1);
}

/* Underline slide-in on nav links */
.nav-link {
    position: relative;
    overflow: hidden;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 100%; height: 2px;
    background: var(--brass-gradient);
    border-radius: 9999px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Logo subtle float */
.brand-logo {
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
}
.brand-logo:hover { transform: translateY(-2px); }

/* ===================================================================
   6. TOP-BAR MARQUEE TICKER
   =================================================================== */

.top-bar-ticker {
    overflow: hidden;
    white-space: nowrap;
}

.top-bar-ticker-inner {
    display: inline-flex;
    gap: 3rem;
    animation: marqueeScroll 28s linear infinite;
}

.top-bar-ticker-inner:hover {
    animation-play-state: paused;
}

/* ===================================================================
   7. HERO — ADDITIONAL DEPTH & PARALLAX LAYERS
   =================================================================== */

.hero-scroll-container {
    isolation: isolate;
}

/* Animated ambient blob behind hero text */
.hero-blob {
    position: absolute;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.25;
    animation: blobMorph 18s ease-in-out infinite;
}
.hero-blob-1 {
    width: 600px; height: 500px;
    top: -10%; left: -8%;
    background: radial-gradient(circle, #C59B51 0%, transparent 70%);
}
.hero-blob-2 {
    width: 500px; height: 420px;
    top: 30%; right: -10%;
    background: radial-gradient(circle, #1C4238 0%, transparent 70%);
    animation-delay: -7s;
    animation-direction: reverse;
}
.hero-blob-3 {
    width: 350px; height: 350px;
    bottom: -5%; left: 40%;
    background: radial-gradient(circle, #9E7934 0%, transparent 70%);
    animation-delay: -13s;
}

/* Horizontal gold rule that draws in */
.hero-rule {
    display: block;
    height: 1px;
    background: var(--brass-gradient);
    max-width: 120px;
    margin: 1.5rem auto;
    animation: lineGrow 1.2s cubic-bezier(0.16,1,0.3,1) 0.8s both;
}

/* ===================================================================
   8. SECTION DIVIDERS — ANIMATED GOLD LINE
   =================================================================== */

.section-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(197,155,81,0.4) 30%, rgba(197,155,81,0.7) 50%, rgba(197,155,81,0.4) 70%, transparent 100%);
    margin: 0;
    position: relative;
}

.section-divider::after {
    content: '';
    position: absolute;
    top: -3px; left: 50%;
    transform: translateX(-50%);
    width: 6px; height: 6px;
    background: var(--foundry-brass);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(197,155,81,0.6);
}

/* ===================================================================
   9. PRODUCT CARD — FULL LUXURY REWORK
   =================================================================== */

.product-card {
    background: var(--espresso-card, #211A15);
    border: 1px solid rgba(197, 155, 81, 0.15);
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.16,1,0.3,1),
                box-shadow 0.5s cubic-bezier(0.16,1,0.3,1),
                border-color 0.4s ease;
    cursor: pointer;
    will-change: transform;
}

.product-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(197, 155, 81, 0.1), transparent 60%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

.product-card:hover {
    transform: translateY(-12px) scale(1.015);
    box-shadow: 0 32px 80px rgba(0,0,0,0.7),
                0 0 0 1px rgba(197,155,81,0.35),
                0 0 40px rgba(197,155,81,0.12);
    border-color: rgba(197,155,81,0.4);
}

.product-card:hover::before { opacity: 1; }

/* Image wrapper with Ken Burns zoom */
.product-card-img-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #1a1310;
}

.product-card-img-wrap img,
.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.16,1,0.3,1),
                filter 0.5s ease;
    will-change: transform;
}

.product-card:hover .product-card-img-wrap img,
.product-card:hover img {
    transform: scale(1.08);
    filter: brightness(1.05);
}

/* Quick-view overlay on hover */
.product-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(14,11,8,0.85) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1.25rem;
    z-index: 2;
}

.product-card:hover .product-card-overlay { opacity: 1; }

.product-card-quick-view {
    background: rgba(197,155,81,0.95);
    color: #0E0B08;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.55rem 1.4rem;
    border-radius: 9999px;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16,1,0.3,1) 0.05s,
                opacity 0.4s ease 0.05s;
}

.product-card:hover .product-card-quick-view {
    transform: translateY(0);
    opacity: 1;
}

/* ===================================================================
   10. BUTTONS — MAGNETIC + RIPPLE EFFECT
   =================================================================== */

.btn-magnetic {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1),
                box-shadow 0.25s cubic-bezier(0.16,1,0.3,1);
}

/* Ripple layer */
.btn-magnetic .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: scale(0);
    animation: rippleExpand 0.6s linear forwards;
    pointer-events: none;
}

.btn-brass {
    position: relative;
    overflow: hidden;
}

/* ===================================================================
   11. SCROLLING BRAND MARQUEE BAR
   =================================================================== */

.brand-marquee-bar {
    background: linear-gradient(90deg, var(--espresso-dark) 0%, #1a1410 50%, var(--espresso-dark) 100%);
    border-top: 1px solid rgba(197,155,81,0.18);
    border-bottom: 1px solid rgba(197,155,81,0.18);
    padding: 1.1rem 0;
    overflow: hidden;
    position: relative;
}

.brand-marquee-bar::before,
.brand-marquee-bar::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 120px;
    z-index: 2;
    pointer-events: none;
}
.brand-marquee-bar::before {
    left: 0;
    background: linear-gradient(90deg, var(--espresso-dark), transparent);
}
.brand-marquee-bar::after {
    right: 0;
    background: linear-gradient(-90deg, var(--espresso-dark), transparent);
}

.brand-marquee-track {
    display: flex;
    gap: 0;
    width: max-content;
    animation: marqueeScroll 30s linear infinite;
}

.brand-marquee-track:hover { animation-play-state: paused; }

.brand-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0 2.5rem;
    font-family: var(--font-spec, monospace);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim-dark, #C4B7A5);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.brand-marquee-item:hover { color: var(--foundry-brass, #C59B51); }

.brand-marquee-dot {
    width: 4px; height: 4px;
    background: var(--foundry-brass, #C59B51);
    border-radius: 50%;
    opacity: 0.5;
    flex-shrink: 0;
}

/* ===================================================================
   12. SECTION HEADINGS — ANIMATED UNDERLINE
   =================================================================== */

.section-heading-anim {
    position: relative;
    display: inline-block;
}

.section-heading-anim::after {
    content: '';
    position: absolute;
    left: 0; bottom: -6px;
    width: 100%; height: 2px;
    background: var(--brass-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.16,1,0.3,1);
    border-radius: 9999px;
}

.section-heading-anim.in-view::after,
.section-heading-anim.revealed::after {
    transform: scaleX(1);
}

/* ===================================================================
   13. COUNTER NUMBERS — ANIMATED COUNT-UP
   =================================================================== */

.stat-counter {
    display: inline-block;
    transition: opacity 0.4s ease;
}

.stat-counter[data-counted="false"] {
    opacity: 0;
}

/* ===================================================================
   14. IMAGE SKELETON LOADER
   =================================================================== */

.img-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 0%,
        rgba(255,255,255,0.09) 50%,
        rgba(255,255,255,0.04) 100%
    );
    background-size: 400px 100%;
    animation: shimmerLoad 1.4s ease-in-out infinite;
}

/* ===================================================================
   15. LOADING SPINNER DOTS
   =================================================================== */

.loading-dots {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.loading-dots span {
    width: 8px; height: 8px;
    background: var(--foundry-brass);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ===================================================================
   16. FLOATING ACTION BUTTON (WhatsApp / CTA)
   =================================================================== */

.fab-cta {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.fab-btn {
    width: 58px; height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1),
                box-shadow 0.35s cubic-bezier(0.16,1,0.3,1);
    border: none;
    animation: pulseGlow 3s ease-in-out infinite;
    text-decoration: none;
}

.fab-btn:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 16px 45px rgba(0,0,0,0.6);
    animation: none;
}

.fab-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
}

.fab-label {
    background: rgba(14,11,8,0.9);
    color: var(--linen-bone, #EDE7DA);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid rgba(197,155,81,0.25);
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
    white-space: nowrap;
    position: absolute;
    right: 68px;
    backdrop-filter: blur(8px);
}

.fab-cta:hover .fab-label {
    opacity: 1;
    transform: translateX(0);
}

/* ===================================================================
   17. SCROLL-TO-TOP BUTTON
   =================================================================== */

#scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: rgba(23,18,14,0.85);
    border: 1px solid rgba(197,155,81,0.4);
    color: var(--foundry-brass, #C59B51);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 800;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16,1,0.3,1),
                background 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#scroll-top-btn.visible {
    opacity: 1;
    transform: translateY(0);
}

#scroll-top-btn:hover {
    background: rgba(197,155,81,0.2);
    box-shadow: 0 8px 28px rgba(197,155,81,0.25);
    transform: translateY(-3px);
}

/* ===================================================================
   18. PAGE TRANSITION OVERLAY
   =================================================================== */

#page-transition {
    position: fixed;
    inset: 0;
    background: var(--espresso-dark, #0E0B08);
    z-index: 99997;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#page-transition.fading-out {
    opacity: 1;
    pointer-events: auto;
}

/* ===================================================================
   19. GLASS CARD VARIANTS
   =================================================================== */

.glass-card {
    background: rgba(33, 26, 21, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(197,155,81,0.18);
    border-radius: 18px;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.45s cubic-bezier(0.16,1,0.3,1);
}

.glass-card:hover {
    border-color: rgba(197,155,81,0.4);
    box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 30px rgba(197,155,81,0.1);
    transform: translateY(-6px);
}

/* ===================================================================
   20. FOOTER REVEAL
   =================================================================== */

.site-footer {
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 5%; right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(197,155,81,0.5), transparent);
}

/* ===================================================================
   21. MOBILE RESPONSIVE ADJUSTMENTS
   =================================================================== */

@media (max-width: 768px) {
    .hero-blob { display: none; }
    #up-particle-canvas { opacity: 0.3; }
    .fab-btn { width: 50px; height: 50px; font-size: 1.3rem; }
    #scroll-top-btn { bottom: 1.25rem; left: 1.25rem; }
    .fab-cta { bottom: 1.25rem; right: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
