/* MCP Video / 3D Face Styles - MCP-82 Terminal */

#mcp-video-container {
    position: absolute;
    top: 50%;
    margin-top: -190px; /* Half of height 380px for centering */
    right: 10px; /* Flush inside the container */
    width: 280px;
    height: 380px; /* Taller for the conical head */
    z-index: 1000;
    display: none;
    border: 2px solid var(--accent-cyan);
    background: rgba(0, 8, 15, 0.7);
    box-shadow: 
        0 0 30px rgba(0, 243, 255, 0.2),
        inset 0 0 15px rgba(0, 243, 255, 0.1);
    border-radius: 4px; /* More industrial */
    overflow: hidden;
    backdrop-filter: blur(15px);
    cursor: move;
    transition: box-shadow 0.3s ease;
    animation: mcp-flicker 0.15s infinite;
}

@media (max-width: 768px) {
    #mcp-video-container {
        width: 180px;
        height: 240px;
        margin-top: -120px; /* Centering for 240px height */
        right: 5px;
    }
    .mcp-header {
        font-size: 7px;
        letter-spacing: 1px;
        padding: 4px 8px;
    }
    #mcp-close-btn {
        font-size: 10px;
        padding: 1px 4px;
    }
}

@keyframes mcp-flicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

#mcp-video-container:hover {
    box-shadow: 
        0 0 45px rgba(0, 243, 255, 0.35),
        inset 0 0 20px rgba(0, 243, 255, 0.15);
}

.mcp-header {
    background: rgba(0, 243, 255, 0.15);
    border-bottom: 2px solid var(--accent-cyan);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-cyan);
    user-select: none;
    z-index: 10;
    text-shadow: 0 0 5px var(--accent-cyan);
}

.mcp-title {
    opacity: 1;
}

#mcp-close-btn {
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    transition: all 0.2s ease;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
}

#mcp-close-btn:hover {
    background: var(--accent-red);
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 15px var(--accent-red);
}

body.terminal-mode .mcp-header {
    background: rgba(255, 42, 0, 0.2);
    border-color: var(--accent-red);
    color: var(--accent-red);
    text-shadow: 0 0 8px var(--accent-red);
}

body.terminal-mode #mcp-close-btn {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

body.terminal-mode #mcp-close-btn:hover {
    background: #fff;
    color: var(--accent-red);
}

#mcp-video-container.active {
    display: flex;
    flex-direction: column;
    animation: mcp-entry 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

#mcp-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(circle at center, rgba(0, 243, 255, 0.05) 0%, transparent 70%);
}

@keyframes mcp-entry {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(40px) skewX(5deg);
        filter: brightness(2);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0) skewX(0);
        filter: brightness(1);
    }
}

.mcp-scanline {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 243, 255, 0.05),
        rgba(0, 243, 255, 0.05) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 2;
    opacity: 0.3;
}

.mcp-noise {
    position: absolute;
    inset: 0;
    /* Procedural SVG Noise to avoid 404 and maintain digital grain */
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
}

.mcp-glitch-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 243, 255, 0.02);
    opacity: 0;
    pointer-events: none;
    z-index: 3;
}

#mcp-video-container.active:hover .mcp-glitch-overlay {
    animation: mcp-subtle-glitch 2s infinite;
}

@keyframes mcp-subtle-glitch {
    0%, 100% { opacity: 0; }
    5%, 15% { opacity: 0.1; transform: translateX(2px); }
    10% { opacity: 0.05; transform: translateX(-2px); }
}

#header-video-toggle.active {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 15px var(--accent-cyan);
    border-color: #fff;
}

body.terminal-mode #mcp-video-container {
    border-color: var(--accent-red);
    box-shadow: 0 0 30px rgba(255, 42, 0, 0.3);
    background: rgba(15, 0, 0, 0.7);
}

body.terminal-mode #mcp-video-container .mcp-scanline {
    background: linear-gradient(to bottom, transparent 50%, rgba(255, 42, 0, 0.05) 50%);
    background-size: 100% 4px;
}
