/* ==========================================================================
   Silkroad Custom Cursor System
   Cursores: /assets/cursors/cur_95.png (normal) y cur_97.png (interactivo)
   ========================================================================== */

html.sr-cursor-on,
html.sr-cursor-on body {
    cursor: var(--sr-cursor-normal) !important;
}

/* Neutraliza los cursores que trae la plantilla; las excepciones van después */
html.sr-cursor-on :where(body *) {
    cursor: inherit !important;
}

/* Elementos interactivos */
html.sr-cursor-on :where(
    a[href],
    area[href],
    button:not([disabled]),
    input:not([disabled]):is([type="button"], [type="submit"], [type="reset"], [type="image"], [type="checkbox"], [type="radio"]),
    select:not([disabled]),
    summary,
    [role="button"],
    [role="link"],
    [role="menuitem"],
    [role="option"],
    [onclick],
    .btn,
    .nav-link,
    .dropdown-toggle,
    label[for],
    .clickable
) {
    cursor: var(--sr-cursor-interactive) !important;
}

/* Campos de escritura: conservar el cursor de texto nativo */
html.sr-cursor-on :where(
    textarea,
    input:not([type]),
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    [contenteditable="true"],
    [contenteditable=""]
) {
    cursor: text !important;
}

/* Deshabilitados / cargando */
html.sr-cursor-on :where([disabled], .disabled, [aria-disabled="true"], [aria-busy="true"]) {
    cursor: not-allowed !important;
}

/* Hover dorado suave solo en controles, sin tocar animaciones existentes */
html.sr-hover-on :where(
    button:not([disabled]),
    .btn,
    input[type="submit"],
    input[type="button"],
    .nav-link
) {
    transition: filter 0.18s ease, transform 0.12s ease;
}

html.sr-hover-on :where(
    button:not([disabled]),
    .btn,
    input[type="submit"],
    input[type="button"],
    .nav-link
):hover {
    filter: drop-shadow(0 0 7px rgba(236, 203, 95, 0.45));
}

html.sr-hover-on :where(
    button:not([disabled]),
    .btn,
    input[type="submit"],
    input[type="button"],
    .nav-link
):active {
    transform: scale(0.97);
}

/* Efecto de clic */
.sr-click-fx {
    position: fixed;
    z-index: 2147483000;
    width: 0;
    height: 0;
    pointer-events: none;
    contain: layout style;
}

.sr-click-flash,
.sr-click-ring,
.sr-click-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}

.sr-click-flash {
    left: -11px;
    top: -11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff8d6 0%, #ffd166 42%, rgba(255, 209, 102, 0) 72%);
    animation: sr-flash 0.42s ease-out forwards;
}

.sr-click-ring {
    left: -10px;
    top: -10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 209, 102, 0.95);
    box-shadow: 0 0 10px rgba(255, 209, 102, 0.65);
    animation: sr-ring 0.48s ease-out forwards;
}

.sr-click-particle {
    left: 0;
    top: 0;
    width: var(--sr-size, 4px);
    height: var(--sr-size, 4px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff6c9 0%, #ffd166 45%, #f0a63a 100%);
    box-shadow: 0 0 6px rgba(255, 209, 102, 0.8);
    animation: sr-particle 0.52s ease-out forwards;
    animation-delay: var(--sr-delay, 0s);
}

@keyframes sr-flash {
    0% { opacity: 0.95; transform: scale(0.35); }
    100% { opacity: 0; transform: scale(1.35); }
}

@keyframes sr-ring {
    0% { opacity: 0.95; transform: scale(0.45); }
    100% { opacity: 0; transform: scale(2.6); }
}

@keyframes sr-particle {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--sr-tx, 0px)), calc(-50% + var(--sr-ty, 0px))) scale(0.2);
    }
}

/* Accesibilidad: sin animaciones fuertes */
@media (prefers-reduced-motion: reduce) {
    html.sr-hover-on :where(button, .btn, input[type="submit"], input[type="button"], .nav-link) {
        transition: none;
    }

    html.sr-hover-on :where(button, .btn, input[type="submit"], input[type="button"], .nav-link):hover,
    html.sr-hover-on :where(button, .btn, input[type="submit"], input[type="button"], .nav-link):active {
        filter: none;
        transform: none;
    }

    .sr-click-fx { display: none !important; }
}

/* Táctil: cursores y efectos desactivados */
@media (hover: none), (pointer: coarse) {
    html.sr-cursor-on,
    html.sr-cursor-on body,
    html.sr-cursor-on * {
        cursor: auto !important;
    }

    .sr-click-fx { display: none !important; }
}
