/* ============================================================ */
/* SACRIFICE THE FALLEN // ARCHIVE REPLICA                      */
/* EXACT 7-COLUMN MOVIE-VAULT GRID & 100% FROZEN VIEWPORT BG    */
/* ============================================================ */

/* --- RESET & TIPOGRAFIA OFICIAL --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    background-color: #111111;
}

body {
    background-color: transparent; /* Permite que o fundo fixo transpareça perfeitamente */
    color: #ffffff;
    font-family: 'Open Sans Condensed', sans-serif;
    font-weight: 300;
    line-height: 1.4;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ============================================================ */
/* CAMADA DE FUNDO FIXA (BLINDAGEM CONTRA O BUG DE SCROLL)      */
/* ============================================================ */
#pageBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: -10; /* Fica fisicamente atrás de tudo */
    pointer-events: none; /* Não interfere nos cliques */
    transition: background-image 0.6s ease-in-out;
}

h1, h2, h3, .button, .sidebar, .gridItemLabel, .sidebarDate, #navMinorItems {
    font-family: 'Open Sans Condensed', sans-serif;
    text-transform: uppercase;
}

h1 {
    font-weight: 300;
    font-size: 2.4rem;
    letter-spacing: 4px;
    margin: 1rem 0 0.6rem 0;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

a {
    color: #ffffff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.7;
}

ul {
    list-style: none;
}

.hidden {
    display: none !important;
}

/* ============================================================ */
/* 1. SIDEBAR FIXA ESQUERDA (#navigation - EXATOS 30%)          */
/* ============================================================ */
#navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 30%; /* Proporção Matemática Clássica */
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 50;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* No Ato 1 (ao abrir um post), a sidebar sai pela esquerda */
body.details #navigation {
    transform: translate3d(-120%, 0, 0);
}

#navContent {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 8%;
    width: 100%;
    height: 100%;
}

.profileImage {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3.5px solid rgba(255, 255, 255, 0.85);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    margin-bottom: 0.5rem;
}

.button.minimalBar {
    width: 85px;
    height: 8px;
    background-color: #ffffff;
    border: none;
    margin: 1.2rem 0 2.5rem 0;
    padding: 0;
    display: block;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.button.minimalBar:hover {
    transform: scaleX(1.15);
    opacity: 0.85;
}

#navMinorItems {
    display: flex;
    gap: 12px;
    font-size: 0.95rem;
    letter-spacing: 2px;
    color: #cccccc;
}

#navMinorItems a::after {
    content: " /";
    color: #777777;
}

#navMinorItems a:last-child::after {
    content: "";
}

/* ============================================================ */
/* 2. O GRID DIREITO (7 COLUNAS DENSAS ESTILO MOVIE-VAULT)      */
/* ============================================================ */
#homePage {
    width: 100%;
    min-height: 100vh;
}

#grid {
    float: right;
    width: 64%; /* Exatos 64% da tela */
    margin: 3%; /* Margem de 3% ao redor */
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 COLUNAS DENSAS E COMPACTAS */
    gap: 4px; /* Vão micro-fino */
    transition: opacity 0.4s ease;
}

#grid.gridNotLoaded {
    opacity: 0;
}

/* O CARD DO PÔSTER - MOVIMENTO COREOGRAFADO */
.gridItem {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3; /* Proporção de cinema pura */
    background-color: #050505;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.8);
    transform: translate3d(0, 0, 0);
    opacity: 1;
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

/* No Ato 1 (ao abrir o modal), a grade inteira é ejetada para a direita */
body.details #grid .gridItem {
    transform: translate3d(2500px, 0, 0);
    opacity: 0;
    pointer-events: none;
}

.gridImageWrapper {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.35s ease;
}

.gridItem:hover .gridImageWrapper {
    transform: scale(1.03);
}

/* Barrinha Escura Fina e Discreta de Hover */
.gridOverlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.75);
    padding: 4px 8px;
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
    z-index: 5;
    display: flex;
    align-items: center;
}

.gridItem:hover .gridOverlay {
    transform: translateY(0);
}

.gridTime {
    font-size: 0.75rem;
    color: #ffffff;
    letter-spacing: 0.5px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 5px;
}

.gridTime i {
    font-size: 0.7rem;
    color: #cccccc;
}

/* ============================================================ */
/* 3. MODAL EM TELA CHEIA (.detailsWrapper)                     */
/* ============================================================ */
.detailsWrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.detailsWrapper.active {
    pointer-events: auto;
}

/* Fundo Desfocado Dinâmico */
.blurredBackground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.8s linear;
    z-index: 1;
}

.blurredBackground.cssBlur {
    filter: blur(35px) brightness(40%) saturate(110%);
    transform: scale(1.2);
}

.detailsWrapper.active .blurredBackground {
    opacity: 1;
}

/* Saída suave no fechamento */
.detailsWrapper.stuck .blurredBackground {
    opacity: 0;
    transition: opacity 0.55s ease-in;
}

/* Moldura Central com o Deslizamento de 2500px */
.permalinkContent {
    position: relative;
    max-width: 480px;
    width: 80%;
    max-height: 90vh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate3d(2500px, 0, 0);
    transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.85s ease;
    opacity: 0;
}

.detailsWrapper.active .permalinkContent {
    transform: translate3d(0, 0, 0);
    opacity: 1;
}

.detailsWrapper.stuck .permalinkContent {
    transform: translate3d(2500px, 0, 0) !important;
    opacity: 0 !important;
    transition: transform 0.55s cubic-bezier(0.7, 0, 0.84, 0), opacity 0.45s ease-in !important;
}

/* Moldura Branca do Pôster */
.mediaContainer {
    width: 100%;
    max-height: 85vh;
    background: #000000;
    border: 6px solid #ffffff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
}

.mediaContainer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================ */
/* 4. BLOQUINHO BRANCO FLUTUANTE (CALIBRAÇÃO 1:1)               */
/* ============================================================ */
.sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translate3d(500px, -50%, 0);
    background: #ffffff;
    color: #333333;
    padding: 16px 20px 14px 20px;
    border-radius: 6px 0 0 6px;
    z-index: 25;
    box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.5s 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: 155px;
    text-align: right;
}

.detailsWrapper.active .sidebar {
    transform: translate3d(0, -50%, 0);
}

.detailsWrapper.stuck .sidebar {
    transform: translate3d(500px, -50%, 0) !important;
    transition: transform 0.4s ease-in !important;
}

.sidebar ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebarDate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    color: #333333;
    font-weight: 300;
    font-family: 'Open Sans Condensed', sans-serif;
    line-height: 1.1;
}

.sidebarDate::before {
    content: "POSTED";
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0px;
    color: #888888;
    font-style: italic;
    font-weight: 400;
    font-family: sans-serif;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.sidebarShare ul {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.sidebarShare a {
    color: #cccccc;
    font-size: 1.65rem;
    line-height: 1;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebarShare a:hover {
    color: #222222;
}

/* ============================================================ */
/* 5. OS BOTÕES DO TOPO COM DELAY COREOGRAFADO                  */
/* ============================================================ */
#xButton {
    position: fixed;
    top: 20px;
    right: 30px;
    font-size: 3.5rem;
    font-weight: 100;
    color: #ffffff;
    line-height: 0.6;
    cursor: pointer;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(150px, 0, 0);
    transition: transform 0.45s ease, opacity 0.45s ease;
    user-select: none;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

#xButton:hover {
    transform: scale(1.1);
    color: #cccccc;
}

#miniAvatar {
    position: fixed;
    top: 25px;
    left: 25px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.85);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(-150px, 0, 0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    transition: transform 0.45s ease, opacity 0.45s ease, border-color 0.2s ease;
}

#miniAvatar:hover {
    transform: scale(1.08);
    border-color: #ffffff;
}

body.details #xButton {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    transition-delay: 0.45s;
}

body.details #miniAvatar {
    opacity: 1;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
    transition-delay: 0.45s;
}

body.closing #xButton {
    opacity: 0 !important;
    transform: translate3d(150px, 0, 0) !important;
    transition-delay: 0s !important;
}

body.closing #miniAvatar {
    opacity: 0 !important;
    transform: translate3d(-150px, 0, 0) !important;
    transition-delay: 0s !important;
}

/* ============================================================ */
/* 6. A MECÂNICA DA FOTO 02 (.navigationOn)                     */
/* ============================================================ */
body.details.navigationOn #navigation {
    transform: translate3d(0, 0, 0) !important;
    background: rgba(10, 10, 10, 0.88) !important;
    z-index: 110;
}

body.details.navigationOn .detailsWrapper.active .permalinkContent {
    transform: translate3d(350px, 0, 0) !important;
}

/* ============================================================ */
/* 7. RESPONSIVIDADE EM CASCATA                                 */
/* ============================================================ */
@media screen and (max-width: 1600px) {
    #grid {
        grid-template-columns: repeat(6, 1fr); /* 6 colunas em telas menores que full HD */
    }
}

@media screen and (max-width: 1366px) {
    #grid {
        grid-template-columns: repeat(5, 1fr); /* 5 colunas em notebooks */
    }
}

@media screen and (max-width: 1024px) {
    #navigation {
        width: 35%;
    }
    #grid {
        width: 59%;
        grid-template-columns: repeat(3, 1fr); /* 3 colunas em tablets */
    }
}

@media screen and (max-width: 768px) {
    #navigation {
        position: relative;
        width: 100%;
        height: auto;
        border-right: none;
    }
    #navContent {
        position: relative;
        padding: 50px 5%;
    }
    #grid {
        float: none;
        width: 94%;
        margin: 3% auto;
        grid-template-columns: repeat(2, 1fr); /* 2 colunas no celular */
    }
    .sidebar {
        display: none;
    }
    body.details.navigationOn .detailsWrapper.active .permalinkContent {
        transform: translate3d(0, 0, 0) !important;
    }
}