/* --- Estilos del Ojo para página de Música --- */

/* Ojo decorativo en esquina */
.ojo-musica {
    position: fixed;
    left: 32px;
    bottom: 32px;
    width: 80px;
    height: 40px;
    opacity: 0.7;
    background: transparent;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
}

.ojo-musica:hover {
    opacity: 1;
}

.ojo-musica.ojo-hover {
    animation: ojoTemblor 0.3s infinite;
}

@keyframes ojoTemblor {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-1px, 0.5px) rotate(0.5deg); }
    50% { transform: translate(1px, -0.5px) rotate(-0.5deg); }
    75% { transform: translate(-0.5px, 1px) rotate(0.5deg); }
}

.ojo-musica-img {
    width: 70px;
    height: 35px;
    object-fit: cover;
    object-position: 48% 54%;
    border-radius: 50% / 45%;
    background: transparent;
    filter: grayscale(30%) brightness(0.9);
    transition: filter 0.3s;
    user-select: none;
    pointer-events: none;
}

.ojo-musica:hover .ojo-musica-img {
    filter: grayscale(0%) brightness(1);
}

/* Efecto de mirar arriba/abajo con scroll */
.ojo-musica.look-up .ojo-musica-img {
    transform: translateY(-2px);
}

.ojo-musica.look-down .ojo-musica-img {
    transform: translateY(2px);
}

/* Ojo observando (cuando el usuario interactúa con contenido) */
.ojo-musica.ojo-watching {
    opacity: 1 !important;
}

.ojo-musica.ojo-watching .ojo-musica-img {
    filter: grayscale(0%) brightness(1.1);
    transform: scale(1.05);
}

/* Ojo reaccionando (susurro activo) */
.ojo-musica.ojo-reacting {
    opacity: 1 !important;
    animation: ojoReact 0.4s ease;
}

.ojo-musica.ojo-reacting .ojo-musica-img {
    filter: grayscale(0%) brightness(1.15);
}

@keyframes ojoReact {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Overlay */
#ojo-musica-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: #000;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: auto;
}

#ojo-musica-overlay.active {
    opacity: 0.95;
}

/* Efecto de ruido en overlay */
#ojo-musica-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.025;
    pointer-events: none;
    animation: noiseShiftMusic 0.4s steps(2) infinite;
}

@keyframes noiseShiftMusic {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(1px, -1px); }
}

/* Viñeta en overlay */
#ojo-musica-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.9) 100%);
    pointer-events: none;
}

/* Ojo en modo central */
.ojo-musica.ojo-central-musica {
    position: fixed !important;
    left: 50% !important;
    top: 28% !important;
    bottom: auto !important;
    width: 180px !important;
    height: 90px !important;
    transform: translate(-50%, -50%) scale(2.5);
    z-index: 1100 !important;
    background: transparent !important;
    opacity: 1 !important;
    transition: all 0.6s cubic-bezier(.77,0,.18,1.01);
    pointer-events: none;
    animation: ojoPulse 4s ease-in-out infinite;
}

@keyframes ojoPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(2.5);
        filter: brightness(1);
    }
    50% { 
        transform: translate(-50%, -50%) scale(2.55);
        filter: brightness(1.08);
    }
}

.ojo-musica.ojo-central-musica .ojo-musica-img {
    filter: none;
    width: 100%;
    height: 100%;
}

/* Aura sutil */
.ojo-musica.ojo-central-musica::before {
    content: "";
    position: absolute;
    inset: -30px;
    background: radial-gradient(ellipse at center, 
        rgba(122, 26, 26, 0.1) 0%, 
        transparent 70%);
    animation: auraBreath 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes auraBreath {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Texto del ojo */
.ojo-musica-texto {
    position: fixed;
    left: 50%;
    top: calc(28% + 100px);
    transform: translateX(-50%);
    z-index: 1201;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.25em;
    text-align: center;
    background: none;
    padding: 0.5em;
    letter-spacing: 0.5px;
    min-width: 300px;
    max-width: 85vw;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 2px 8px #000, 0 0 2px #000;
    white-space: pre-line;
    line-height: 1.7;
    animation: textFadeIn 0.4s ease;
}

@keyframes textFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Input del ojo */
.ojo-musica-input {
    position: fixed;
    left: 50%;
    top: calc(28% + 260px);
    transform: translateX(-50%);
    z-index: 1202;
    display: flex;
    gap: 0.6em;
    justify-content: center;
    align-items: center;
    background: none;
    pointer-events: auto;
    animation: inputFadeIn 0.3s ease;
}

@keyframes inputFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ojo-musica-input input {
    width: 240px;
    max-width: 55vw;
    padding: 0.6em 0.8em;
    font-size: 1em;
    border-radius: 0;
    border: 1px solid #333;
    border-bottom: 2px solid #7a1a1a;
    background: rgba(24, 24, 27, 0.9);
    color: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.ojo-musica-input input:focus {
    border-color: #7a1a1a;
    border-bottom-color: #fff;
    box-shadow: 0 4px 15px rgba(122, 26, 26, 0.3);
}

.ojo-musica-input input::placeholder {
    color: #666;
    font-style: italic;
}

.ojo-musica-input button {
    padding: 0.5em 1em;
    font-size: 1.1em;
    border-radius: 0;
    border: 1px solid #7a1a1a;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.ojo-musica-input button:hover {
    background: #7a1a1a;
    transform: scale(1.05);
}

/* Botón cerrar */
.ojo-musica-close {
    position: fixed;
    top: 2em;
    right: 2.5em;
    z-index: 1300;
    color: #666;
    background: none;
    border: none;
    font-size: 2.2em;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.3s, color 0.3s;
    line-height: 1;
}

.ojo-musica-close:hover {
    opacity: 1;
    color: #7a1a1a;
    transform: rotate(90deg);
}

/* Susurros ambientales */
.ojo-susurro {
    position: fixed;
    left: 32px;
    bottom: 85px;
    z-index: 60;
    color: #666;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    font-style: italic;
    letter-spacing: 1px;
    opacity: 0;
    animation: susurroIn 1s ease forwards;
    pointer-events: none;
    text-shadow: 0 0 10px #000;
}

.ojo-susurro.ojo-susurro-hover {
    color: #888;
    font-size: 0.9em;
}

/* Susurro de reacción (cuando interactúa con contenido) */
.ojo-susurro.ojo-susurro-reaction {
    color: #999;
    font-size: 0.88em;
    text-shadow: 0 0 8px rgba(122, 26, 26, 0.5);
}

@keyframes susurroIn {
    0% { opacity: 0; transform: translateY(5px); }
    20% { opacity: 0.7; transform: translateY(0); }
    80% { opacity: 0.7; }
    100% { opacity: 0.7; }
}

.ojo-susurro.fade-out {
    animation: susurroOut 1s ease forwards;
}

@keyframes susurroOut {
    from { opacity: 0.7; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-5px); }
}

/* Responsive */
@media (max-width: 900px) {
    .ojo-musica {
        left: 16px;
        bottom: 16px;
        width: 60px;
        height: 30px;
    }
    
    .ojo-musica-img {
        width: 55px;
        height: 28px;
    }
    
    .ojo-susurro {
        left: 16px;
        bottom: 55px;
        font-size: 0.75em;
    }
    
    .ojo-musica.ojo-central-musica {
        transform: translate(-50%, -50%) scale(2);
    }
    
    .ojo-musica-texto {
        font-size: 1.1em;
        top: calc(28% + 80px);
    }
    
    .ojo-musica-input {
        top: calc(28% + 220px);
    }
}

@media (max-width: 500px) {
    .ojo-musica {
        display: none;
    }
}
