:root {
    /* Paleta */
    --bg-paper: #F2F0E9;
    --ink: #1A1A1A;
    --color-icaro: #D64933;
    --color-silfio: #C2A878;
    
    /* Layout */
    --header-h: 60px;
    --footer-h: 80px;
    --grid-border: 4px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body, html {
    height: 100%;
    height: 100dvh; /* Dynamic Viewport Height para Mobile */
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Mantém o conceito de página única fixa */
    background-color: var(--bg-paper);
    color: var(--ink);
    font-family: 'Space Grotesk', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Foco Acessível */
:focus-visible {
    outline: 3px solid var(--color-icaro);
    outline-offset: -3px;
    z-index: 50;
}

/* Tipografia */
.font-mega {
    font-family: 'Anton', sans-serif;
    line-height: 0.85;
    /* Melhoria de contraste e legibilidade */
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1); 
}

/* GRID SYSTEM (Desktop) */
.bauhaus-grid {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 350px; 
    grid-template-rows: var(--header-h) 1fr 100px; 
    height: 100dvh;
    width: 100vw;
    border: var(--grid-border) solid var(--ink);
}

/* Células da Grelha */
.cell {
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ESTILO DA BARRA LATERAL */
#sidebar-identity {
    grid-row: span 3; /* Ocupa toda a altura em Desktop */
    background-color: var(--ink);
    color: var(--bg-paper);
}

/* Utilitários de Borda */
.cell:last-child { border-right: none; }
.border-none-right { border-right: none !important; }
.border-none-bottom { border-bottom: none !important; }

/* Texto Vertical (Lado Esquerdo) */
.vertical-text-wrapper {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    white-space: nowrap;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Imagens de Fundo */
.bg-artwork {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 0;
    filter: grayscale(20%) contrast(110%);
}
.bg-artwork.active {
    opacity: 1;
}

/* Overlay para legibilidade */
.bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(242, 240, 233, 0.2), rgba(242, 240, 233, 0.1));
    z-index: 1;
    pointer-events: none;
}



/* Formas Geométricas */
.shape-sun {
    width: 40vh;
    height: 40vh;
    background-color: var(--color-icaro);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    mix-blend-mode: multiply;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    pointer-events: none;
}

/* Estados do Modo (Body classes) */
body.mode-silfio .shape-sun { transform: translate(-50%, -50%) scale(0); opacity: 0; }

body.mode-silfio .btn-nav[aria-selected="true"] { background-color: var(--color-silfio); color: white; }
body.mode-icaro .btn-nav[aria-selected="true"] { background-color: var(--color-icaro); color: white; }

/* Conteúdo Dinâmico (Animações) */
.dynamic-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    position: absolute;
    width: 100%;
    pointer-events: none;
    z-index: 10;
}

/* O conteúdo ativo no painel de informação precisa de fluxo normal para scroll se necessário */
#info-panel .dynamic-content {
    position: absolute;
    inset: 0;
    display: none; /* Hide completely when not active for a11y */
}

.dynamic-content.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative; /* Volta ao fluxo normal */
}

#info-panel .dynamic-content.active {
    display: flex; /* Flex layout para o painel de info */
    position: relative;
    height: 100%;
}

/* Botões de Navegação */
.btn-nav {
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 0 20px;
    border: none;
    border-right: 2px solid var(--ink);
    background: transparent;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.8rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.btn-nav:last-of-type { border-right: none; }
.btn-nav:hover:not([aria-selected="true"]) {
    background-color: rgba(26, 26, 26, 0.1);
}

/* Marquee */
.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

@media (prefers-reduced-motion: no-preference) {
    .marquee-content {
        display: inline-block;
        padding-left: 100%;
        animation: marquee 20s linear infinite;
    }
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* Text Stroke Effect */
.text-stroke {
    -webkit-text-stroke: 1px currentColor;
    color: transparent;
}

/* Noise Texture */
.noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: 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");
}

/* --- RESPONSIVIDADE & MOBILE (DEFINITIVA v2) --- */
@media (max-width: 768px) {
    body {
        border: none;
        overflow: hidden; 
    }

    .bauhaus-grid {
        display: grid;
        grid-template-columns: 1fr;
        /* ROWS */
        grid-template-rows: 45px 35px 25vh 1fr 100px;
        height: 100dvh;
        width: 100vw;
        border: none;
    }

    /* 1. Header */
    #sidebar-identity {
        grid-row: 1 !important;
        grid-column: 1;
        border-bottom: 2px solid var(--ink);
        z-index: 50;
    }
    #sidebar-identity .vertical-text-wrapper {
        writing-mode: horizontal-tb;
        transform: none;
    }
    #sidebar-identity h1 {
        font-size: 0.75rem;
        letter-spacing: 0.2em;
        text-align: center;
        white-space: nowrap;
        font-weight: 700;
    }

    /* 2. Marquee */
    #header-marquee {
        grid-row: 2;
        border-bottom: 2px solid var(--ink);
        z-index: 25;
    }
    .marquee-content { font-size: 1rem !important; padding-top: 2px; }

    /* 3. Visual */
    #main-visual { 
        grid-row: 3;
        border-bottom: 2px solid var(--ink);
    }
    .shape-sun { width: 20vh; height: 20vh; }
    .font-mega { font-size: 14vw !important; }

    /* 4. Info Panel (Scroll) */
    #info-panel { 
        grid-row: 4; 
        grid-column: 1; 
        border-right: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0; 
        border-bottom: 2px solid var(--ink); /* Separa do footer */
    }
    #info-panel .dynamic-content.active {
        display: block;
        padding: 20px;
    }

    /* 5. FOOTER CONTROL AREA - REDESIGNED */
    #controls { 
        grid-row: 5;
        grid-column: 1;
        border-top: none; /* Já tem border bottom no painel acima */
        background-color: var(--bg-paper);
        z-index: 40;
        /* Mudar para GRID para garantir posições fixas */
        display: grid !important;
        grid-template-columns: 1fr 1fr; /* 2 Colunas para os botões */
        grid-template-rows: 60px 40px; /* Linha botões (60px) + Linha social (40px) */
        height: 100%;
    }

    /* Botões de Navegação (Linha 1) */
    .btn-nav {
        grid-row: 1;
        height: 100%; /* Ocupa os 60px */
        width: 100%;
        border-bottom: 2px solid var(--ink); /* Linha a separar da barra preta */
        font-size: 0.75rem;
        padding: 0 5px;
    }
    #btn-icaro {
        grid-column: 1;
        border-right: 2px solid var(--ink);
    }
    #btn-silfio {
        grid-column: 2;
        border-right: none;
    }

    /* Barra Social (Linha 2 - Fixa em baixo) */
    .mobile-socials {
        grid-row: 2;
        grid-column: 1 / -1; /* Ocupa toda a largura */
        display: flex !important;
        background-color: var(--ink) !important;
        color: var(--bg-paper) !important;
        align-items: center;
        justify-content: center;
        height: 100%; /* Ocupa os 40px */
        border: none !important;
    }
    
    .mobile-socials a {
        color: var(--bg-paper);
        font-size: 0.7rem;
        opacity: 0.9;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        margin: 0 10px;
    }
}