:root {
    --pico-font-family: 'Courier New', monospace;
}

body {
    margin: 0;
}

html.modal-open,
body.modal-open {
    overflow: hidden !important;
    height: 100vh !important;
}


/* ===== Layout ===== */

.container-fluid {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    max-width: 100%;
}

/* ===== Sidebar ===== */

nav {
    display: block;
    padding: 2rem;
    border-right: 1px solid rgba(255,255,255,0.15);
    position: sticky;
    top: 0;
    height: 100vh;
}

nav .logo {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

nav ul {
    display: block; 
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li {
    margin-bottom: 1rem;
}

nav a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    padding: 0.2rem 0;
}

nav a::before {
    content: "> ";
    opacity: 0.5;
    margin-right: 0.5rem;
}

nav a:hover {
    padding-left: 8px;
}

.menu-toggle {
    display: none;
}

/* ===== Main ===== */

main {
    padding: 3rem;
    max-width: 100%;
}

.main-grid {
    display: grid;
    grid-template-columns: minmax(min(100%, 500px), 600px) 1fr;
    gap: 3rem;
    align-items: start;
    max-width: 100%;
    margin: 0;
}

.detail-panel {
    position: sticky;
    top: 2rem;
    display: none;
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
}


.detail-panel article {
    animation: slideIn 0.3s ease-out;
}

.detail-panel button {
    background: none;
    border: none;
    color: var(--pico-color);
    cursor: pointer;
    padding: 0;
    font-size: 3rem;
    opacity: 0.8;
}

.detail-panel button:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (min-width: 1501px) {
    .detail-panel {
        display: none; 
        position: sticky;
        top: 2rem;
        overflow-y: auto;
        max-height: calc(100vh - 4rem);
    }

    .iframe-kokaz
    {
        display: block;
    }
}

@media (max-width: 1500px) and (min-width: 993px) {
    .container-fluid {
        grid-template-columns: 260px 1fr; 
    }

    
    .main-grid {
        grid-template-columns: 1fr !important; 
        width: 100% !important;
    }

    .detail-panel.modal-active {
        display: block !important; 
        position: fixed !important;
        top: 0 !important; 
        left: 0 !important; 
        right: 0 !important; 
        bottom: 0 !important;
        width: 100vw !important; 
        height: 100vh !important;
        min-height: 100vh !important;
        background-color: var(--pico-background-color) !important;
        z-index: 999999 !important;
        padding: 3rem 1.5rem;
        overflow-y: auto;
        margin: 0 !important;
    }

    .detail-panel.modal-active article {
        max-width: 800px;
        margin: 0 auto;
    }
}

@media (max-width: 992px) {
    .container-fluid { 
        grid-template-columns: 1fr !important; 
    }
    
    .main-grid { 
        grid-template-columns: 1fr !important; 
        gap: 1.5rem; 
        width: 100% !important; 
    }

    main { 
        padding: 1.5rem !important; 
    }

    .detail-panel.modal-active {
        display: block !important; 
        position: fixed !important;
        top: 0 !important; 
        left: 0 !important; 
        right: 0 !important; 
        bottom: 0 !important;
        width: 100vw !important; 
        height: 100vh !important;
        min-height: 100vh !important;
        background-color: var(--pico-background-color) !important;
        z-index: 999999 !important;
        padding: 3rem 1.5rem;
        overflow-y: auto;
        margin: 0 !important;
    }

    
    .menu-toggle {
        display: block; 
        background: none; 
        border: 1px solid rgba(255,255,255,0.3);
        color: inherit; 
        padding: 0.5rem 1rem; 
        cursor: pointer;
        margin-bottom: 1rem; 
        width: 100%; 
        text-align: left;
    }
    
    .menu-toggle::before { content: "▼ "; display: inline-block; transition: transform 0.3s; }
    .menu-toggle.active::before { transform: rotate(-90deg); }

    nav { height: auto; position: relative; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.15); padding: 1.5rem; }
    nav ul { display: none; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
    nav ul.show { display: flex; }

    pre { font-size: 0.85rem; white-space: pre-wrap !important; word-break: break-all !important; }
    h1, h2, h3 { word-wrap: break-word; }
}


@media (max-width: 768px) {
    .photo-gallery { 
        grid-template-columns: repeat(2, 1fr) !important; 
    }
}



pre {
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow-x: auto;
    max-width: 100%;
}

pre code {
    background: none;
    padding: 0;
}

/* ===== More button ===== */

.more-button {
    text-align: right;
}

/* ===== Responsive ===== */

@media (max-width: 992px) {
    .container-fluid {
        grid-template-columns: 1fr !important ;
    }

    .menu-toggle {
        display: block;
        background: none;
        border: 1px solid rgba(255,255,255,0.3);
        color: inherit;
        padding: 0.5rem 1rem;
        cursor: pointer;
        margin-bottom: 1rem;
        width: 100%;
        text-align: left;
    }

    .menu-toggle::before {
        content: "▼ ";
        display: inline-block;
        transition: transform 0.3s;
    }

    .menu-toggle.active::before {
        transform: rotate(-90deg);
    }

    nav {
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.15);
        padding: 1.5rem;
    }

    nav .logo {
        margin-bottom: 1rem;
    }

    nav ul {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }

    nav ul.show {
        display: flex;
    }

    nav li {
        margin-bottom: 0;
    }

    main {
        padding: 1.5rem;
        max-width: 100%;
    }

    article {
        margin-bottom: 2rem;
    }

    article > div[style*="display: flex"] {
        flex-direction: column !important;
    }

    pre {
        font-size: 0.85rem;
    }

    h1, h2, h3 {
        word-wrap: break-word;
    }
}

.img-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-auto-rows: 250px; /* height fixe de ligne */
    gap: 1rem;
}

.img-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: 1s ease;
}

.img-gallery img:hover {
    transform: scale(0.9);
    box-shadow: 0 32px 75px rgba(68,77,136,0.2);
}

.img-wrapper {
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.9);
    position: fixed;
    top: 0;
    left: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 20000;
}

.img-wrapper img {
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    object-fit: contain;
    position: relative;
    z-index: 20001;
}

.img-wrapper > span {
    position: absolute;
    top: 5%;
    right: 5%;
    font-size: 30px;
    color: white;
    cursor: pointer;
    font-family: sans-serif;
    z-index: 20003;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 60px;
    color: white;
    cursor: pointer;
    user-select: none;
    padding: 0 20px;
    transition: opacity 0.3s;
    z-index: 20002;
}

.nav-arrow:hover {
    opacity: 0.7;
}

.nav-prev {
    left: calc((100% - min(90vw, 1200px)) / 2 - 80px);
}

.nav-next {
    right: calc((100% - min(90vw, 1200px)) / 2 - 80px);
}


/* ======= Carroussel ======= */

.carousel {
    position: relative;
    max-width: 600px;
    margin: 2rem auto;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%;
    height: calc(100% - 2rem);
    object-fit: contain;
    object-position: center;
}

.carousel-label {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 10px solid rgba(255, 255, 255, 0.3);
    color: inherit;
    font-size: 10rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    z-index: 10;
    transition: opacity 0.3s;
}

.carousel-btn:hover {
    opacity: 0.7;
}

.carousel-btn.prev {
    left: -60px;
}

.carousel-btn.next {
    right: -60px;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.carousel-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.3s;
}

.carousel-dots span.active {
    background: var(--pico-color);
}

@media (max-width: 768px) {
    .carousel {
        max-width: 100%;
    }
    
    .carousel-track {
        height: 300px;
    }
    
    .carousel-btn.prev {
        left: 10px;
    }
    
    .carousel-btn.next {
        right: 10px;
    }
    
    .carousel-btn {
        font-size: 1.5rem;
        padding: 0.3rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .carousel-track {
        height: 250px;
    }
    
    .carousel-label {
        font-size: 0.8rem;
    }
}


#loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background-color: var(--pico-background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--pico-font-family);
    transition: opacity 0.5s ease, visibility 0.5s;
    padding: 2rem;
}

.terminal-box {
    width: 100%;
    max-width: 600px;
    font-size: 1.2rem;
    color: #fff;
    text-align: left;
}

#terminal-output {
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.prompt {
    margin-right: 10px;
}

.cursor {
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

#loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.loading {
    overflow: hidden;
}

/* Animation optionnelle sur le contenu du site */
main {
    animation: fadeInUp 0.8s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.gallery-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: var(--pico-border-radius);
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--pico-typography-spacing, 1rem);
    margin-top: 2rem;
}

.gallery-item {
    display: flex;
    flex-direction: column; 
    align-items: center;   
    text-align: center;   
}

.gallery-item img {
    width: 100%;
    height: 220px; 
    object-fit: cover;
    border-radius: var(--pico-border-radius, 0.25rem);
}

.gallery-item p {
    margin-top: 0.5rem;
    margin-bottom: 0; /* Évite que la marge par défaut de Pico ne décale le bas de la grille */
    font-size: 0.9rem; 
}

/* Adaptation Mobile */
@media (max-width: 768px) {
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}