/* =========================================================
   FX EFFECTS — FASE 1 PREMIUM — Oldwest
   Cursor · Partículas · Scramble · Tilt · Transitions
   ========================================================= */

/* --- PREMIUM MAGNETIC CURSOR --- */
body { cursor: none !important; }
a, button, [role="button"], .card-producto, .btn, input, select, textarea { cursor: none !important; }

.cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 8px; height: 8px;
    background: #c1121f;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100000;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.23, 1, 0.32, 1), 
                height 0.3s cubic-bezier(0.23, 1, 0.32, 1), 
                background 0.3s ease,
                opacity 0.3s ease;
    mix-blend-mode: difference;
    will-change: transform;
}

.cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 40px; height: 40px;
    border: 1.5px solid rgba(22, 21, 20, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                height 0.4s cubic-bezier(0.23, 1, 0.32, 1), 
                border 0.4s ease,
                background 0.4s ease;
    mix-blend-mode: difference;
    will-change: transform;
}

/* Hover State: Buttons/Links */
body.cursor-hover .cursor-dot {
    width: 4px; height: 4px;
    background: var(--color-surface);
}
body.cursor-hover .cursor-ring {
    width: 70px; height: 70px;
    background: rgba(22, 21, 20, 0.1);
    border: 1px solid rgba(255, 255, 255, 1);
}

/* Text State: Hovering over paragraphs/headings */
body.cursor-text .cursor-dot {
    width: 2px; height: 24px;
    border-radius: 2px;
    background: var(--color-surface);
}
body.cursor-text .cursor-ring {
    width: 0; height: 0;
    opacity: 0;
}

/* Click State */
body.cursor-clicking .cursor-dot { transform: translate(-50%, -50%) scale(0.5); }
body.cursor-clicking .cursor-ring { transform: translate(-50%, -50%) scale(1.4); opacity: 0.5; }

#fire-cursor-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 99998;
    mix-blend-mode: screen;
    opacity: 0.4; /* Sutil trail */
}

/* --- EMBER PARTICLES CANVAS --- */
#ember-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* --- TEXT SCRAMBLE --- */
.scramble-char {
    color: var(--color-dorado);
    opacity: 0.7;
}

/* Char-by-char reveal */
.char-reveal-wrapper {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}
.char-reveal-inner {
    display: inline-block;
    animation: charSlideIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes charSlideIn {
    from { transform: translateY(110%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Word reveal for paragraphs */
.word-reveal .word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.word-reveal .word-inner {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.65s ease;
}
.word-reveal.active .word-inner { transform: translateY(0); opacity: 1; }

/* --- 3D TILT --- */
.tilt-ready { transform-style: preserve-3d; will-change: transform; }
.tilt-glare {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    transition: background 0.15s ease;
}

/* --- PAGE TRANSITIONS --- */
#pt-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 999999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.pt-curtain-top,
.pt-curtain-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    background: #0a0908;
    transform: scaleY(1);
    will-change: transform;
}
.pt-curtain-top    { top: 0;    transform-origin: top;    background: linear-gradient(to bottom, #000, #0a0908); }
.pt-curtain-bottom { bottom: 0; transform-origin: bottom; background: linear-gradient(to top,   #000, #0a0908); }

.pt-logo-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    opacity: 0;
    width: 100%; /* Asegura que el texto no se corte */
}
.pt-logo-wrap img  { width: 180px; height: 180px; border-radius: 50%; border: 3px solid var(--color-dorado, #F77F00); box-shadow: 0 0 30px rgba(217, 83, 79,0.3); }
.pt-logo-wrap span { font-family: 'Cinzel', serif; color: white; font-size: 1.5rem; letter-spacing: 6px; font-weight: 800; }

/* State: entering (curtains close) */
#pt-overlay.pt-entering { pointer-events: all; }
#pt-overlay.pt-entering .pt-curtain-top,
#pt-overlay.pt-entering .pt-curtain-bottom { animation: curtainClose 0.55s cubic-bezier(0.76, 0, 0.24, 1) forwards; }
#pt-overlay.pt-entering .pt-logo-wrap     { animation: logoIn 0.35s ease 0.3s forwards; }

/* State: leaving (curtains open) */
#pt-overlay.pt-leaving .pt-curtain-top,
#pt-overlay.pt-leaving .pt-curtain-bottom { animation: curtainOpen 0.85s cubic-bezier(0.76, 0, 0.24, 1) forwards; }
#pt-overlay.pt-leaving .pt-logo-wrap      { animation: logoOut 0.6s ease forwards; opacity: 1; }

@keyframes curtainClose { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes curtainOpen  { from { transform: scaleY(1); } to { transform: scaleY(0); } }
@keyframes logoIn  { from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes logoOut { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }

/* --- MOBILE: disable cursor canvas --- */
@media (max-width: 768px) {
    body { cursor: auto; }
    .cursor-dot, .cursor-ring, #fire-cursor-canvas { display: none !important; }
}
