/* Variables del Ecosistema Minimalista */
:root {
    --bg: #050505;
    --fg: #fafafa;
    --accent: #888888;
    --font-stack: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Reset y Normalización Estructural */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-stack);
    background: var(--bg);
    color: var(--fg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Header Delgado y Aislado */
header {
    flex: 0 0 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 100;
}

#logo-container {
    color: inherit;
    text-decoration: none;
    display: inline-block;
}

.typewriter {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

/* 7 Variaciones de Distorsión Postmoderna (Glitch Engine) */
.fx1 { transform: skewX(-25deg); text-shadow: 2px 0 #ff0055, -2px 0 #00ffcc; }
.fx2 { filter: blur(3px) contrast(300%); transform: scale(1.08); }
.fx3 { letter-spacing: 9px; filter: opacity(0.6); }
.fx4 { transform: rotate(-4deg) scaleY(1.4); filter: invert(1); }
.fx5 { color: var(--bg); background: var(--fg); padding: 2px 8px; }
.fx6 { clip-path: polygon(0% 15%, 100% 0%, 100% 85%, 0% 100%); }
.fx7 { animation: glitchJitter 0.18s linear infinite; }

@keyframes glitchJitter {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(-1px, -2px); }
    60% { transform: translate(2px, 1px); }
    80% { transform: translate(1px, -1px); }
}

/* Sistema de Cuadrantes Reactivos */
.grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.quad {
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: filter 0.5s ease;
}

/* Capa de Control Lumínico de Carga Rápida */
.quad::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    transition: background 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.quad:hover::before {
    background: rgba(0, 0, 0, 0.65);
}

.quad.active::before {
    background: rgba(0, 0, 0, 0.45);
}

/* Contenido de los Cuadrantes */
.content {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    padding: 0 30px;
}

.content h2 {
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.8rem);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.quad.active .content h2 {
    transform: translateY(-25px);
}

/* Menús Desplegables de Enlaces Líquidos */
.menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.quad.active .menu {
    opacity: 1;
    visibility: visible;
    max-height: 450px;
    transform: translateY(0);
    margin-top: 15px;
}

/* Enlaces Convertidos en Botones Redondeados Modernos */
.menu-link {
    display: block;
    background: #ffffff;
    color: #050505;
    border: none;
    border-radius: 40px;
    padding: 14px 28px;
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.menu-link:hover {
    transform: scale(1.025);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* Enlace de Retorno (Volver) */
.back-link {
    display: inline-block;
    align-self: center;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 15px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    user-select: none;
}

.back-link:hover {
    color: var(--fg);
    transform: translateX(-4px);
}

/* Footer Minimalista */
footer {
    flex: 0 0 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4vw;
    font-size: 0.68rem;
    background: var(--bg);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    z-index: 100;
}

footer nav {
    display: flex;
    gap: 24px;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: var(--fg);
}

/* Optimización Quirúrgica para Dispositivos Móviles */
@media (max-width: 768px) {
    body {
        height: 100dvh; /* Evita saltos por barra de navegación móvil */
    }
    
    .grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
    }
    
    .quad::before {
        background: rgba(0, 0, 0, 0.72);
    }
    
    .content h2 {
        font-size: 2rem;
    }
    
    .quad.active .content h2 {
        transform: translateY(-15px);
    }
    
    .menu {
        gap: 8px;
    }
    
    .menu-link {
        padding: 11px 22px;
    }
    
    footer {
        flex: 0 0 auto;
        flex-direction: column-reverse;
        justify-content: center;
        gap: 12px;
        padding: 20px;
        text-align: center;
    }
    
    footer nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
}