/* ─── Couche « moderne » : typographie, profondeur, micro-animations ─────────────
   Chargée en dernier sur toutes les pages (carte, bâtiment, méthode, simulateur).
   Purement décorative : la retirer rend l'apparence de la charte d'origine.
   Toutes les animations sont coupées si l'utilisateur demande moins de mouvement. */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ombre-1: 0 1px 2px rgba(23, 32, 51, .06), 0 1px 3px rgba(23, 32, 51, .08);
    --ombre-2: 0 2px 4px rgba(23, 32, 51, .05), 0 8px 24px rgba(23, 32, 51, .10);
    --ombre-3: 0 4px 8px rgba(23, 32, 51, .06), 0 16px 40px rgba(23, 32, 51, .16);
}

/* ── Typographie ───────────────────────────────────────────────────────────── */
.page-batiment, .page-methode, .page-carte, body[data-view] {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01";
    letter-spacing: -0.006em;
}
:is(.page-batiment, .page-methode) :is(h1, h2) { letter-spacing: -0.02em; }
.badge-lettre, .fact-value, .stat, .dh-value, .cmp-barre-valeur, .d-val { font-variant-numeric: tabular-nums; }

/* ── Transitions entre pages (onglets Synthèse · Simulation · Données, Méthode) ─ */
@view-transition { navigation: auto; }
.site-head { view-transition-name: site-head; }
.b-head { view-transition-name: b-head; }
::view-transition-old(root) { animation: vt-sortie .18s var(--ease-out) both; }
::view-transition-new(root) { animation: vt-entree .32s var(--ease-out) both; }
@keyframes vt-sortie { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-entree { from { opacity: 0; transform: translateY(10px); } }

/* ── En-tête ───────────────────────────────────────────────────────────────── */
.site-head, .app-head {
    background: linear-gradient(180deg, #1B3768 0%, var(--marine, #17305A) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 6px 20px rgba(15, 35, 64, .18);
    position: relative;
    z-index: 20;
}
.head-nav a { position: relative; border-radius: 10px; }
.head-nav a:hover { background: rgba(255, 255, 255, .10); }
.head-search input { transition: box-shadow .2s var(--ease-out), background-color .2s; }
.head-search input:focus { box-shadow: 0 0 0 4px rgba(245, 194, 67, .35); }

/* ── Onglets : soulignement qui se déploie ─────────────────────────────────── */
.onglets a { position: relative; border-bottom-color: transparent !important; }
.onglets a::after {
    content: "";
    position: absolute;
    left: 18%; right: 18%; bottom: -3px; /* sur la bordure (transparente) de 3 px : touche la ligne grise */
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--marine);
    transform: scaleX(0);
    transition: transform .3s var(--ease-out);
}
.onglets a:hover::after { transform: scaleX(.35); opacity: .4; }
.onglets a[aria-current="page"]::after { transform: scaleX(1); opacity: 1; }

/* ── Cartes : profondeur, survol, apparition en cascade ───────────────────── */
.b-content .card, .cmp-carte, .vignette, .panneau-vignette, .page-methode section {
    border: 1px solid rgba(220, 225, 232, .7);
    box-shadow: var(--ombre-1);
    transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .2s;
}
.b-content .card:hover, .cmp-carte:hover { box-shadow: var(--ombre-2); }
/* Barre des variantes : « card » sans habillage (batiment.css), on n'y remet ni cadre ni ombre */
.b-content .card.sim-variantes, .b-content .card.sim-variantes:hover { border: 0; box-shadow: none; }
.vignette:hover, .panneau-vignette:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--marine); }

/* ── Boutons ───────────────────────────────────────────────────────────────── */
.btn { position: relative; box-shadow: var(--ombre-1); }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--ombre-2); filter: none; }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); box-shadow: var(--ombre-1); }
.btn-marine { background: linear-gradient(180deg, #21407A, var(--marine)); }
.btn-jaune  { background: linear-gradient(180deg, #F8CF5E, var(--jaune)); }
.btn-jaune:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(245, 194, 67, .45); }

/* ── Carte : panneau du bâtiment, résultats de recherche, légende ─────────── */
@keyframes monte  { from { opacity: 0; transform: translateY(40px); } }
@keyframes glisse { from { opacity: 0; transform: translateX(32px); } }
@keyframes deroule { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
#panneau { animation: monte .4s var(--ease-out) both; box-shadow: var(--ombre-3); }
/* Coins : ceux de style.css (mobile : arrondis en haut seulement ; ordinateur : aucun) */
@media (min-width: 1024px) { #panneau { animation-name: glisse; } }
#address-results:not(:empty) { animation: deroule .2s var(--ease-out) both; transform-origin: top; box-shadow: var(--ombre-3); }
#address-results li { transition: background-color .12s, padding-left .2s var(--ease-out); }
#address-results li:hover, #address-results li.active { padding-left: 16px; }

/* ── Tableaux de données : survol de ligne ─────────────────────────────────── */
.d-table tbody tr { transition: background-color .15s; }
.d-table tbody tr:hover { background: #F7F9FC; }

/* ── Barres de progression : rayures animées pendant le calcul ─────────────── */
@keyframes rayures { to { background-position: 40px 0; } }
.sim-bar-fill, .sim-barre-remplie {
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, .18) 25%, transparent 25%, transparent 50%,
                        rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, .18) 75%, transparent 75%),
        linear-gradient(90deg, #3A6FC4, #17305A);
    background-size: 40px 40px, 100% 100%;
    animation: rayures 1s linear infinite;
}

/* ── Simulateur (sim/) : onglets et menus ──────────────────────────────────── */
.app-menu:not([hidden]) { animation: deroule .18s var(--ease-out) both; transform-origin: top right; }
.tab[aria-selected="true"] { box-shadow: 0 -2px 10px rgba(0, 0, 0, .12); }
.view-switch button { transition: background-color .2s var(--ease-out), color .2s, box-shadow .2s; }
.view-switch button[aria-checked="true"] { box-shadow: var(--ombre-1); }

/* ── Mouvement réduit ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
        animation: none !important;
        transition: none !important;
    }
}
