/* ============================================================================
 * ultra-pro.css v1.0 — Capa visual "Ultra Pro" para todo el portafolio
 * ----------------------------------------------------------------------------
 * Acompaña a js/ultra-pro.js:
 *  • Barra de progreso de scroll con gradiente arcoíris
 *  • Reveals cinematográficos (.up-reveal / .up-revealed)
 *  • Spotlight de cursor en tarjetas (.up-spot)
 *  • Transiciones de página (velo .up-page-veil)
 *  • Botón back-to-top con anillo de progreso
 *  • Command Palette (Ctrl/⌘+K) estilo Raycast
 *  • Typewriter caret y chip de disponibilidad
 * Respeta prefers-reduced-motion y modo día.
 * ========================================================================= */

/* ===================== 1. SCROLL PROGRESS BAR ===================== */
.up-scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    background: linear-gradient(90deg,
        #FF3B30, #FF9500, #FFCC00, #34C759, #007AFF, #AF52DE, #EC4899);
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.45);
}

/* ===================== 2. SCROLL REVEAL ===================== */
.up-reveal {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
    filter: blur(4px);
    transition:
        opacity .7s cubic-bezier(.22, 1, .36, 1) var(--up-delay, 0ms),
        transform .7s cubic-bezier(.22, 1, .36, 1) var(--up-delay, 0ms),
        filter .7s ease var(--up-delay, 0ms);
    will-change: opacity, transform;
}
.up-reveal.up-revealed {
    opacity: 1;
    transform: none;
    filter: none;
}

/* ===================== 3. CURSOR SPOTLIGHT ===================== */
.up-spot {
    position: relative;
    transition: transform .25s ease, box-shadow .3s ease;
    transform-style: preserve-3d;
}
.up-spot::after {
    /* Halo que sigue al cursor */
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(320px circle at var(--up-mx, 50%) var(--up-my, 50%),
        rgba(255, 255, 255, 0.10), transparent 42%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
    z-index: 1;
}
.up-spot:hover::after { opacity: 1; }
body.day-mode .up-spot::after {
    background: radial-gradient(320px circle at var(--up-mx, 50%) var(--up-my, 50%),
        rgba(37, 99, 235, 0.08), transparent 42%);
}

/* ===================== 4. MAGNETIC BUTTONS ===================== */
.up-magnetic {
    transition: transform .22s cubic-bezier(.22, 1, .36, 1);
    will-change: transform;
}

/* ===================== 5. PAGE TRANSITIONS ===================== */
body { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
    body:not(.up-page-in) { opacity: 0; }
    body.up-page-in {
        opacity: 1;
        transition: opacity .45s ease;
    }
}
.up-page-veil {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #06080f;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s ease;
}
.up-page-veil.up-veil-active {
    opacity: 1;
    pointer-events: all;
}

/* ===================== 6. BACK TO TOP ===================== */
.up-backtop {
    position: fixed;
    right: 22px;
    bottom: 96px; /* deja sitio al audio player flotante */
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(14, 18, 32, 0.82);
    color: #E8C766;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
    opacity: 0;
    transform: translateY(14px) scale(0.9);
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease, box-shadow .3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.up-backtop.up-backtop-visible {
    opacity: 1;
    transform: none;
    pointer-events: all;
}
.up-backtop:hover {
    box-shadow: 0 12px 36px rgba(212, 175, 55, 0.30);
    color: #FFD97A;
}
.up-backtop svg {
    position: absolute;
    inset: 3px;
    transform: rotate(-90deg);
}
.up-backtop svg circle {
    fill: none;
    stroke-width: 2.4;
}
.up-backtop-track { stroke: rgba(255, 255, 255, 0.10); }
.up-backtop-ring {
    stroke: url(#upRingGrad), #D4AF37;
    stroke: #D4AF37;
    stroke-linecap: round;
    transition: stroke-dashoffset .15s linear;
}
.up-backtop i { font-size: 16px; position: relative; z-index: 1; }
body.day-mode .up-backtop {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.12);
    color: #2563EB;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}
body.day-mode .up-backtop-track { stroke: rgba(15, 23, 42, 0.10); }
body.day-mode .up-backtop-ring  { stroke: #2563EB; }

@media (max-width: 640px) {
    .up-backtop { right: 16px; bottom: 88px; width: 46px; height: 46px; }
}

/* ===================== 7. COMMAND PALETTE (Ctrl/⌘+K) ===================== */
.up-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: min(16vh, 140px) 16px 16px;
    background: rgba(4, 6, 12, 0.62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
.up-palette-overlay.up-palette-open {
    opacity: 1;
    pointer-events: all;
}
.up-palette {
    width: 100%;
    max-width: 620px;
    border-radius: 18px;
    background: rgba(16, 20, 34, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(212, 175, 55, 0.10),
        0 0 60px rgba(168, 85, 247, 0.12);
    overflow: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: transform .24s cubic-bezier(.22, 1, .36, 1);
}
.up-palette-open .up-palette { transform: none; }

.up-palette-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #B8B0A0;
}
.up-palette-head i { font-size: 15px; color: #E8C766; }
.up-palette-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #F5F1E8;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
}
.up-palette-input::placeholder { color: #6b7280; }
.up-palette kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #9aa0b4;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    padding: 3px 7px;
    line-height: 1;
}
.up-palette-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 340px;
    overflow-y: auto;
}
.up-palette-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s ease;
}
.up-palette-item.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(168, 85, 247, 0.10));
}
.up-palette-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #D4AF37, #A855F7);
    flex-shrink: 0;
}
.up-palette-icon-action {
    background: linear-gradient(135deg, #38BDF8, #8B5CF6);
}
.up-palette-texts { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.up-palette-texts strong {
    color: #F5F1E8;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
}
.up-palette-texts small { color: #9aa0b4; font-size: 12px; }
.up-palette-ext { color: #6b7280; font-size: 12px; }
.up-palette-item.active .up-palette-ext { color: #E8C766; }
.up-palette-empty {
    padding: 22px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}
.up-palette-foot {
    display: flex;
    justify-content: space-between;
    padding: 10px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #6b7280;
    font-size: 11.5px;
}
.up-palette-foot span { display: flex; align-items: center; gap: 6px; }

body.day-mode .up-palette {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(15, 23, 42, 0.10);
}
body.day-mode .up-palette-texts strong { color: #0F172A; }
body.day-mode .up-palette-input { color: #0F172A; }
body.day-mode .up-palette-head,
body.day-mode .up-palette-foot { border-color: rgba(15, 23, 42, 0.08); }
body.day-mode .up-palette-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.10), rgba(168, 85, 247, 0.08));
}

/* Chip que abre la paleta (welcome) */
.up-palette-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #9aa0b4;
    font-size: 12.5px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: border-color .25s ease, color .25s ease, background .25s ease;
    text-decoration: none;
}
.up-palette-hint:hover {
    border-color: rgba(212, 175, 55, 0.45);
    color: #E8C766;
    background: rgba(212, 175, 55, 0.06);
}
.up-palette-hint kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: inherit;
}
@media (pointer: coarse) {
    .up-palette-hint kbd { display: none; }
}
body.day-mode .up-palette-hint {
    border-color: rgba(15, 23, 42, 0.14);
    color: #64748B;
    background: rgba(15, 23, 42, 0.03);
}

/* ===================== 8. TYPEWRITER + DISPONIBILIDAD ===================== */
.up-typed-wrap {
    display: inline-flex;
    align-items: baseline;
    min-height: 1.5em;
}
.up-typed {
    font-weight: 700;
    background: linear-gradient(135deg, #E8C766, #EC4899, #38BDF8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.up-caret {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 3px;
    background: #E8C766;
    animation: upCaretBlink 1s steps(1) infinite;
    transform: translateY(0.15em);
}
@keyframes upCaretBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .up-caret { animation: none; } }

.up-availability {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(52, 199, 89, 0.35);
    background: rgba(52, 199, 89, 0.08);
    color: #4ADE80;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
    margin-bottom: 18px;
}
.up-availability .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34C759;
    box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.6);
    animation: upPing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes upPing {
    0%   { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(52, 199, 89, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}
@media (prefers-reduced-motion: reduce) { .up-availability .dot { animation: none; } }
body.day-mode .up-availability {
    background: rgba(52, 199, 89, 0.10);
    color: #15803D;
}

/* ===================== 9. ACCESIBILIDAD GLOBAL ===================== */
@media (prefers-reduced-motion: reduce) {
    .up-reveal { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
    .up-scroll-progress { transition: none; }
}
