/* File: index-shell.css - Coque index (tabs, panels visu/scie, footer, loader)
   Desc: Styles propres à index.html : barre d’onglets, conteneurs #visu-panel / #scie-panel, credits-footer, app-loader.
   Version 1.0.7
   Copyright 2025 DNAvatar.org - Arnaud Maignan
   Licensed under Apache License 2.0 with Commons Clause. See LICENSE_HEADER.txt for full terms.
   Date: 2025-03-08
   Logs:
   - Extracted from index.html inline <style>.
   - v1.0.1: #milankovitch-panel aligné sur #scie-panel (max-height:none, min-height viewport, iframe min-height) — iframe n’était pas dimensionnée (≈150px), body/graph bloqués en haut
   - v1.0.2: retrait onglet Hysteresis (#hysteresis-panel, body.hysteresis-panel-active)
   - v1.0.3: .tabs-bar button text-transform:uppercase (lisibilité police pixel 04B_03)
   - v1.0.4: #bench-panel / body.bench-panel-active aligné sur #milankovitch-panel (iframe simple standalone)
   - v1.0.5: .app-loader-list li.loaded background → color-mix(--base-color 35%, transparent) (au lieu de vert fluo hardcodé)
   - v1.0.7: .credits-footer-utf8 — lien utf8 coin bas-droit du footer (index.html)
   - v1.0.6: réintroduction #hysteresis-panel / body.hysteresis-panel-active (iframe standalone hysteresis_compute.html) aligné sur #bench-panel / #milankovitch-panel
   ============================================================ */

/* --- Onglets (tabs-bar) : Visuel / Scientifique --- */
.tabs-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    gap: 2px;
    padding: 0 0 0 10px;
    align-items: flex-start;
    min-height: 20px;
    margin: 0;
}
.tabs-bar button {
    padding: 4px 14px 6px;
    height: 18px;
    line-height: 1;
    font-size: 12px;
    font-family: '04B_03', monospace;
    text-transform: uppercase;
    background: #222;
    border: none;
    border-radius: 0 0 10px 10px;
    color: var(--retro-off, #999);
    cursor: pointer;
    box-sizing: border-box;
    transition: color 0.3s ease, box-shadow 0.3s ease;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgb(0, 0, 0);
    border-right: 1px solid rgb(0, 0, 0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
.tabs-bar button:not(.active) {
    color: var(--retro-off, #999);
}
.tabs-bar button:not(.active):hover {
    color: var(--retro-base, #0F0);
}
.tabs-bar button.active {
    color: var(--retro-clicable, #F00);
    background: #333;
    border-left: 1px solid rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.4), inset -1px -1px 0 rgba(255, 255, 255, 0.08);
}

/* --- Layout index : une seule barre de scroll (body), quelle que soit la taille d'écran --- */
body {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Panel scie / bench / hyst / milankovitch actif : la page prend la taille du contenu (body peut grandir, scroll = body) */
body.scie-panel-active,
body.bench-panel-active,
body.hysteresis-panel-active,
body.milankovitch-panel-active {
    height: auto;
    min-height: 100vh;
}
.tab-panel {
    flex: 0 1 var(--visu-panel-max-h, 670px);
    min-height: 0;
    max-height: var(--visu-panel-max-h, 670px);
}
.tab-panel:not(.active) {
    display: none !important;
}
.tab-panel.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
/* Une seule barre (body) : visu-panel ne crée jamais de scroll interne */
#visu-panel.active {
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
    margin: 5px 0 0 0;
}
#visu-panel.active > * {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    overflow-y: hidden;
}

/* Position verticale / télé : une seule barre de scroll (body), pas de scroll interne au visu-panel */
@media (max-width: 999px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .tab-panel.active {
        flex: 0 0 auto;
        max-height: none;
        height: auto;
    }
    #visu-panel.active {
        overflow: hidden;
        overflow-x: hidden;
        overflow-y: hidden;
    }
    #visu-panel.active > * {
        flex: 0 0 auto;
        min-height: min-content;
        overflow: hidden;
        overflow-y: hidden;
    }
    /* Scie : même méthode qu’en horizontal (iframe hauteur contenu, scroll = body) */
    #scie-panel.active {
        overflow: visible;
        min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
        max-height: none;
        display: flex;
        flex-direction: column;
    }
    #scie-panel iframe {
        flex: 0 0 auto;
        min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
        width: 100%;
        border: none;
    }
    #milankovitch-panel.active,
    #bench-panel.active,
    #hysteresis-panel.active {
        overflow: visible;
        min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
        max-height: none;
        display: flex;
        flex-direction: column;
    }
    #milankovitch-panel iframe,
    #bench-panel iframe,
    #hysteresis-panel iframe {
        flex: 0 0 auto;
        min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
        width: 100%;
        border: none;
    }
}

/* Panel Scientifique : même méthode en horizontal et vertical (hauteur = contenu, scroll = body, footer en bas du flux) */
#scie-panel.active {
    overflow: visible;
    flex: 0 0 auto;
    height: auto;
    min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
    max-height: none;
    display: flex;
    flex-direction: column;
}
#scie-panel iframe {
    flex: 0 0 auto;
    min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
    width: 100%;
    border: none;
}

/* En horizontal : scie ne suit pas la méthode visu (max 670px), même comportement que scie en vertical */
@media (min-width: 1000px) {
    body.scie-panel-active #scie-panel.active {
        flex: 0 0 auto;
        height: auto;
        max-height: none;
    }
}

/* Panel scie actif : footer toujours déplié (hauteur max) */
body.scie-panel-active .credits-footer {
    height: var(--visu-footer-max-h);
}
/* Même logique que #scie-panel : sans min-height explicite l’iframe reste ~150px → contenu Milankovitch/Bench/Hyst coincé en haut */
#milankovitch-panel.active,
#bench-panel.active,
#hysteresis-panel.active {
    overflow: visible;
    flex: 0 0 auto;
    height: auto;
    min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
    max-height: none;
    display: flex;
    flex-direction: column;
}
#milankovitch-panel iframe,
#bench-panel iframe,
#hysteresis-panel iframe {
    flex: 1 1 auto;
    min-height: calc(100vh - 20px - var(--visu-footer-min-h, 50px));
    width: 100%;
    border: none;
}

/* --- Footer index (credits + lien Milankovitch) --- */
/* Mouvement du footer : 100 % CSS, aucun calcul JS.
 * - Écran horizontal (≥1000px) : --visu-footer-min-h = 50px, footer min 50px, peut grandir jusqu'à 110px.
 * - Écran vertical (≤999px) : footer min 50px, hauteur auto pour contenu ; visible en bas du scroll. */
.credits-footer {
    /* Hauteur dynamique : footer se réduit (110→50px) avant que le panel visu rétrécisse */
    height: var(--visu-footer-h);
    min-height: var(--visu-footer-min-h);
    max-height: var(--visu-footer-max-h);
    overflow: hidden;
    position: relative;
    container-type: size;
    container-name: credits-footer;
}

/* Lien utf8 : hors du flux centré des crédits, ancré au pied du footer */
.credits-footer > .credits-footer-utf8 {
    position: absolute;
    bottom: 3px;
    right: 10px;
    font-size: 10px;
    line-height: 14px;
    z-index: 3;
    text-decoration: none;
    color: color-mix(in srgb, var(--base-color, #0a0) 65%, #888 35%);
    pointer-events: auto;
}
.credits-footer > .credits-footer-utf8:hover {
    text-decoration: underline;
}
@media (max-width: 999px) {
    .credits-footer {
        height: auto;
        min-height: var(--visu-footer-min-h);
        max-height: none;
    }
}
/* Lien Milankovitch : même rendu que les lignes credits (CO2, etc.), sans faire baisser la signature */
.credits-milankovitch {
    margin-left: 10px;
    position: absolute;
    top: 0;
    left: 0;
    font-size: 10px;
    line-height: 15px;
}
.credits-milankovitch a {
    text-decoration: none;
}
/* --- Loader graphique (listing modules, vert = chargé) --- */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483647;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
}
.app-loader.hidden {
    display: none;
}
.app-loader-title {
    color: var(--base-color, #0a0);
    font-size: 14px;
    margin-bottom: 12px;
}
.app-loader-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 640px;
    width: 100%;
    font-family: monospace;
    font-size: 11px;
    color: #888;
    column-count: 2;
    column-gap: 24px;
}
.app-loader-list li {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    break-inside: avoid;
}
.app-loader-list li.loaded {
    /* Fond = couleur de base alpha (cohérent avec --base-color, au lieu du vert fluo hardcodé). */
    background: color-mix(in srgb, var(--base-color) 35%, transparent);
    color: var(--base-color, #0a0);
}
