/*
Theme Name: Second Coming
Author: tlloancy
Author URI: https://deter-mi.net
Description: Matrix-style FSE child theme. Cyberpunk, animated rain, mobile-first.
Version: 1.2.9
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: second-coming
Tags: blog, custom-menu, custom-logo, custom-background, translation-ready
*/

/**
 * Copyright (C) 2025 tlloancy
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */


/* ==========================================================================
   1. FONT & RESET
   ========================================================================== */
@font-face {
    font-family: "Inria Sans";
    src: url("assets/fonts/InriaSans-Regular.woff2") format("woff2");
    font-weight: normal;
    font-display: swap;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html, body {
    color: #0f0;
    font-family: "Inria Sans", monospace;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ==========================================================================
   2. LIENS & FOCUS
   ========================================================================== */
a {
    color: #0f0 !important;
    text-decoration: none !important;
}
a:hover,
a:focus {
    color: #fff !important;
    text-shadow: 0 0 12px #0f0 !important;
}
:focus-visible {
    outline: 2px solid #0f0 !important;
    outline-offset: 3px !important;
}
.skip-link {
    position: absolute !important;
    inset-block-start: -9999px !important;
    background: #0f0 !important;
    color: #000 !important;
    padding: 0.8em 1.2em !important;
    z-index: 999999 !important;
    font-weight: bold !important;
}
.skip-link:focus {
    inset-block-start: 0.5em !important;
    inset-inline-start: 0.5em !important;
}

/* ==========================================================================
   3. HEADER & NAVIGATION
   ========================================================================== */
.site-header {
    background: rgba(0,0,0,0.92) !important;
    border-bottom: 1px solid #0f0 !important;
    box-shadow: 0 4px 25px rgba(0,255,0,0.2) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    min-height: 90px;
}

.topbar {
    background: #0a0a0a !important;
    color: #0f0 !important;
    font-size: 0.95rem !important;
    padding: 0.6rem 1rem !important;
    text-align: center !important;
    text-shadow: 0 0 8px #0f0 !important;
}

.nav-container {
    padding: 1rem !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    min-height: 70px;
}

/* POPOVER MOBILE */
.main-menu[popover] {
    border: none;
    background: rgba(0, 0, 0, 0.98);
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 2rem;
    color: #0f0;
    list-style: none;
    display: none;
}
.main-menu:popover-open {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    position: fixed;
    inset: 0;
    z-index: 10000;
}
.main-menu::backdrop {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
}

/* BOUTONS TOGGLE */
.menu-toggle {
    background: transparent;
    border: 2px solid #0f0;
    width: 54px;
    height: 44px;
    position: relative;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.main-menu .close-menu {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: block !important;
}

.nav-container .open-menu {
    display: block;
}

/* Animation hamburger */
.menu-toggle span {
    background: #0f0;
    height: 4px;
    width: 70%;
    position: absolute;
    left: 15%;
    border-radius: 2px;
    transition: all 0.35s ease;
    box-shadow: 0 0 8px rgba(0,255,0,0.6);
}
.menu-toggle span:nth-child(1) { top: 10px; }
.menu-toggle span:nth-child(2) { top: 19px; }
.menu-toggle span:nth-child(3) { top: 28px; }

.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(8px, 8px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(7px, -7px); }

/* Message no menu */
.no-menu-message {
    color: #f00 !important;
    text-shadow: 0 0 10px #f00 !important;
    background: rgba(255, 0, 0, 0.15) !important;
    border: 2px dashed #f00 !important;
    border-radius: 8px !important;
    padding: 1.5rem !important;
    margin: 1rem 0 !important;
    font-family: "Inria Sans", monospace !important;
    font-weight: bold !important;
    text-align: center !important;
}

/* Cacher la flèche des submenus */
.main-menu .menu-item-has-children > a::after {
    display: none !important;
}

/* ==========================================================================
   SUBMENUS - Desktop + Mobile beaux et fonctionnels
   ========================================================================== */
.main-menu,
.main-menu ul,
.main-menu .sub-menu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* --- DESKTOP NAVIGATION (MIN 993PX) --- */
@media (min-width: 993px) {
    .nav-container .open-menu,
    .main-menu .close-menu {
        display: none !important;
    }

    .main-menu[popover] {
        display: flex !important;
        position: static !important;
        height: auto;
        background: transparent;
        flex-direction: row;
        gap: 2rem;
        align-items: center;
        /* CRITIQUE : On doit voir ce qui dépasse du menu principal */
        overflow: visible !important; 
    }

    /* LA LIGNE MAGIQUE : 
       On définit le LI comme référentiel pour le sous-menu.
    */
    .main-menu li {
        position: relative !important; 
        list-style: none !important;
    }

    .main-menu a {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
        font-weight: 600;
        display: block;
    }

    .main-menu .sub-menu {
        position: absolute !important;
        top: 100% !important; /* Juste sous le lien parent */
        left: 0 !important;   /* Aligné sur le bord gauche du LI parent */
        background: rgba(0,0,0,0.96) !important;
        border: 1px solid #0f0 !important;
        border-radius: 6px !important;
        box-shadow: 0 10px 30px rgba(0,255,0,0.4) !important;
        min-width: 240px !important;
        padding: 0.6rem 0 !important;
        
        /* Animation & État caché */
        opacity: 0;
        visibility: hidden;
        transform: translateY(12px);
        transition: all 0.28s ease;
        z-index: 1000;
    }

    /* Affichage au survol du LI */
    .main-menu li:hover > .sub-menu,
    .main-menu li:focus-within > .sub-menu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
    }

    /* Pour les sous-sous-menus (3ème niveau) */
    .main-menu .sub-menu .sub-menu {
        top: 0 !important;
        left: 100% !important; /* S'ouvre à droite du sous-menu précédent */
        transform: translateX(10px);
    }
    
    .main-menu .sub-menu li:hover > .sub-menu {
        transform: translateX(0);
    }

    .main-menu .sub-menu a {
        display: block;
        padding: 0.8rem 1.5rem;
        color: #0f0;
        transition: all 0.2s ease;
    }

    .main-menu .sub-menu a:hover,
    .main-menu .sub-menu a:focus {
        background: rgba(0, 255, 0, 0.18) !important;
        color: #fff !important;
        text-shadow: 0 0 12px #0f0;
        padding-left: 2rem;
    }
}

/* MOBILE SUBMENUS - Beau comme desktop + Enter fonctionne */
@media (max-width: 992px) {
    .main-menu .sub-menu {
        display: none !important;
        width: 100% !important;
        background: rgba(0,0,0,0.96) !important;
        border: 1px solid #0f0 !important;
        border-radius: 6px !important;
        box-shadow: 0 10px 30px rgba(0,255,0,0.4) !important;
        margin: 0.5rem 0 !important;
        padding: 0.6rem 0 !important;
    }

    .main-menu .sub-menu.submenu-open {
        display: block !important;
    }

    .main-menu .sub-menu a {
        display: block;
        padding: 0.85rem 1.5rem;
        color: #0f0;
        font-size: 1.05rem;
        text-align: center;
        transition: all 0.2s ease;
    }

    .main-menu .sub-menu a:hover,
    .main-menu .sub-menu a:focus {
        background: rgba(0, 255, 0, 0.18) !important;
        color: #fff !important;
        text-shadow: 0 0 12px #0f0;
    }
}

/* ==========================================================================
   4. CONTENU + PILLS + UTILS
   ========================================================================== */
.matrix-page-wrapper {
    max-width: 1400px !important;
    margin: 2rem auto !important;
    padding: 0 1rem !important;
}
.matrix-content-grid {
    display: grid !important;
    grid-template-columns: 3fr 1fr !important;
    gap: 3rem !important;
}
.matrix-main-content {
    background: rgba(0,0,0,0.88) !important;
    border: 1px solid #0f0 !important;
    padding: 2.5rem !important;
    border-radius: 6px !important;
    box-shadow: inset 0 0 30px rgba(0,255,0,0.12) !important;
}
.matrix-sidebar {
    background: rgba(0,0,0,0.9) !important;
    border: 1px dashed #0f0 !important;
    padding: 1.8rem !important;
    border-radius: 6px !important;
}
.matrix-title {
    color: #0f0 !important;
    font-size: 3rem !important;
    margin-bottom: 1.8rem !important;
    text-shadow: 0 0 15px #0f0 !important;
    text-align: center !important;
}
.matrix-entry-content {
    font-size: 1.2rem !important;
    line-height: 1.9 !important;
}
@media (max-width: 992px) {
    .matrix-content-grid { grid-template-columns: 1fr !important; }
}

#comments.comments-area {
    max-width: 1100px !important;
    margin: 5rem auto 3rem !important;
    padding: 2.5rem !important;
    border: 1px solid #0f0 !important;
    background: rgba(0,0,0,0.9) !important;
}

.matrix-pill {
    padding: 16px 40px !important;
    font-family: inherit;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    border: 2px solid #0f0 !important;
    border-radius: 50px !important;
    background: rgba(0, 255, 0, 0.08) !important;
    color: #0f0 !important;
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.35) !important;
    transition: all 0.35s ease !important;
}
.matrix-pill:hover {
    background: rgba(0, 255, 0, 0.25) !important;
    transform: scale(1.05) !important;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
}
.screen-reader-text:focus {
    background-color: #000;
    clip: auto !important;
    clip-path: none;
    color: #0f0;
    display: block;
    height: auto;
    padding: 15px;
    text-decoration: none;
    width: auto;
    z-index: 100000;
    border: 2px solid #0f0;
}

/* Canvas Matrix Rain */
canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

.sticky { border: 1px solid #0f0; background: rgba(0, 255, 0, 0.05); }
.bypostauthor { background: rgba(0, 255, 0, 0.1); }
.alignleft { float: left; margin: 0.5em 1.5em 1.5em 0; }
.alignright { float: right; margin: 0.5em 0 1.5em 1.5em; }
.aligncenter { display: block; margin: 0 auto 1.5em; clear: both; }
.wp-caption { max-width: 100%; border: 1px solid #0f0; text-align: center; padding: 5px; }
.wp-caption-text, .gallery-caption { font-size: 0.85rem; font-style: italic; color: #0a0; }
