/* ============================================================
   TERRE DE RÉSILIENCE — Style global v2
   Refonte complète : variables CSS, responsive, sticky footer
   ============================================================ */

/* ── Tokens de design ──────────────────────────────────────── */
:root {
    --bg:          #060d1e;
    --surface:     rgba(8,18,44,.94);
    --surface-2:   rgba(12,26,56,.86);
    --surface-hi:  rgba(18,36,76,.80);
    --border:      rgba(255,255,255,.08);
    --border-hi:   rgba(56,182,255,.35);
    --text:        #e6efff;
    --text-muted:  rgba(180,205,245,.56);
    --text-dim:    rgba(130,160,210,.38);
    --accent:      #38b6ff;
    --accent-glow: rgba(56,182,255,.22);
    --accent-g:    #28e878;
    --accent-a:    #ffb020;
    --accent-p:    #be68ff;
    --radius:      16px;
    --radius-sm:   10px;
    --radius-xs:   5px;
    --shadow:      0 8px 48px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.05) inset;
    --shadow-sm:   0 3px 20px rgba(0,0,0,.45);
    --shadow-glow: 0 0 40px rgba(56,182,255,.10);
    --nav-h:       58px;
    --max-w:       1120px;
    --pad:         clamp(16px, 3.5vw, 32px);
    --t:           .24s cubic-bezier(.25,.1,.25,1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Base ─────────────────────────────────────────────────── */
html { height: 100%; scroll-behavior: smooth; }

body {
    margin: 0; padding: 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 17px; line-height: 1.72;
    color: var(--text);
    background-color: var(--bg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    transition: background-image .8s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02','cv03','cv04','cv11';
}

/* ── Scrollbar personnalisée ───────────────────────────────── */
::-webkit-scrollbar              { width: 7px; height: 7px; }
::-webkit-scrollbar-track        { background: rgba(0,8,25,.70); }
::-webkit-scrollbar-thumb        { background: rgba(56,182,255,.22); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: rgba(56,182,255,.42); }

/* ── Animation d'apparition ────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
    0%, 100% { opacity: .6; }
    50%       { opacity: 1; }
}

h1, h2, h3, h4 { margin-top: 0; line-height: 1.22; letter-spacing: -.2px; }
p { line-height: 1.75; margin: 0 0 1em; }
li { line-height: 1.72; }
ul, ol { padding-left: 1.4em; }

/* ── Sticky footer ─────────────────────────────────────────── */
/* Footer en position fixed → le contenu doit avoir padding-bottom suffisant */
.page-main { flex: 1 0 auto; padding-bottom: 66px; }

/* ── Tooltip abbr (en-têtes de tableaux) ────────────────────────── */
table th abbr[title] {
    text-decoration: none;
    cursor: help;
    border-bottom: 1px dotted rgba(56,182,255,.50);
}

/* ── Sélection texte ───────────────────────────────────────── */
::selection { background: rgba(56,182,255,.32); color: #fff; }

/* ── LAYOUT SIMULATEUR ─────────────────────────────────────── */
.container {
    display: flex;
    margin-top: 0;
    padding: 20px;
    gap: 20px;
    flex-wrap: wrap;
}

/* ── PANNEAU GAUCHE (simulateur) ───────────────────────────── */
.left-panel {
    width: 320px;
    flex-shrink: 0;
    background: linear-gradient(160deg, rgba(6,16,40,.92), rgba(4,10,28,.95));
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 6px 36px rgba(0,0,0,.50);
}

.left-panel label {
    display: block;
    margin-bottom: 15px;
    font-size: 15px;
}

.left-panel input[type="number"],
.left-panel input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

#btn-run {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #0090e8 0%, #0060c0 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 700;
    font-size: .93rem;
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 4px 18px rgba(0,130,220,.35);
    transition: filter .20s, transform .12s, box-shadow .20s;
}

#btn-run:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(0,130,220,.50);
}

/* ── Panneau droit (simulateur) ────────────────────────────── */
#prodChart {
    background: rgba(255,255,255,.15) !important;
    border: 1px solid white;
}
canvas#prodChart { color: white !important; }
.right-panel canvas { display: block; margin-bottom: 20px; }

/* ── Tables de résultats du simulateur ─────────────────────── */
.right-panel table td { font-size: 13px; }
.right-panel table th { font-size: 12px; }
.right-panel table    { font-size: 13px; }

/* ── 3D container ──────────────────────────────────────────── */
#three-container {
    background: #222;
    width: 100%;
    height: clamp(300px, 50vw, 400px);
}

/* ── Page block ────────────────────────────────────────────── */
.page-block {
    background: linear-gradient(160deg, rgba(10,22,52,.96) 0%, rgba(6,14,34,.97) 100%);
    padding: var(--pad);
    margin: 16px auto 24px;
    border-radius: var(--radius);
    max-width: var(--max-w);
    border: 1px solid rgba(255,255,255,.08);
    border-top-color: rgba(255,255,255,.12);
    box-shadow: 0 10px 60px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.06) inset;
    width: calc(100% - 24px);
    animation: fadeUp .38s cubic-bezier(.25,.1,.25,1) both;
}

.page-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 1px 10px rgba(0,0,0,.9), 0 0 30px rgba(0,0,0,.6);
}

.page-subtitle {
    font-size: clamp(.95rem, 2.5vw, 1.2rem);
    opacity: .88;
    margin-bottom: 28px;
    text-shadow: 0 1px 8px rgba(0,0,0,.9), 0 0 20px rgba(0,0,0,.6);
}

/* Bloc en-tête réutilisable */
.page-head {
    background: linear-gradient(135deg, rgba(0,12,30,.88) 0%, rgba(0,8,22,.92) 100%);
    border-radius: var(--radius-sm);
    padding: 18px 24px;
    border: 1px solid var(--border);
    border-top-color: rgba(56,182,255,.18);
    margin-bottom: 24px;
    text-align: center;
}

/* ── Hero d'en-tête ────────────────────────────────────────── */
.page-hero {
    margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 28px;
    padding: clamp(28px, 5.5vw, 46px) var(--pad) clamp(22px, 4.5vw, 36px);
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}
/* halo lumineux derrière l'icône */
.page-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 70%; height: 100%;
    background: radial-gradient(ellipse at top, rgba(255,255,255,.07) 0%, transparent 65%);
    pointer-events: none;
}
.ph-icon  {
    font-size: clamp(2rem, 5.5vw, 2.8rem);
    display: block; margin-bottom: 12px; line-height: 1;
    filter: drop-shadow(0 2px 12px rgba(255,255,255,.25));
    position: relative;
}
.ph-title {
    font-size: clamp(1.4rem, 4.5vw, 2.1rem);
    font-weight: 800; color: #fff; margin: 0 0 10px;
    line-height: 1.2; letter-spacing: -.3px;
    text-shadow: 0 2px 20px rgba(0,0,0,.60), 0 0 60px rgba(255,255,255,.08);
    position: relative;
}
.ph-sub   {
    font-size: clamp(.90rem, 2.2vw, 1.02rem);
    color: rgba(255,255,255,.78); max-width: 640px;
    margin: 0 auto; line-height: 1.70;
    position: relative;
}
.ph-green  { background: linear-gradient(135deg, rgba(0,70,24,.92) 0%, rgba(0,38,12,.97) 100%);  border-bottom: 2px solid rgba(0,210,90,.22); }
.ph-blue   { background: linear-gradient(135deg, rgba(0,48,100,.92) 0%, rgba(0,24,66,.97) 100%);  border-bottom: 2px solid rgba(56,170,255,.22); }
.ph-amber  { background: linear-gradient(135deg, rgba(80,42,0,.92) 0%, rgba(48,18,0,.97) 100%);  border-bottom: 2px solid rgba(255,170,40,.22); }
.ph-purple { background: linear-gradient(135deg, rgba(58,0,100,.92) 0%, rgba(28,0,64,.97) 100%);  border-bottom: 2px solid rgba(190,90,255,.22); }

/* ── Emplacement image (placeholder photos à fournir) ──────── */
.img-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 20px;
    border: 2px dashed rgba(255,255,255,.16);
    border-radius: var(--radius-sm);
    background: rgba(0,10,30,.45);
    color: var(--text-muted);
    font-size: .84rem;
    text-align: center;
    min-height: 160px;
    margin: 16px 0;
    cursor: default;
}
.img-slot-icon { font-size: 2rem; opacity: .45; }
.img-slot-desc { font-style: italic; max-width: 300px; line-height: 1.5; }

/* ── Navigation scénarios ──────────────────────────────────── */
.scenario-nav {
    display: flex; gap: 10px; justify-content: center;
    margin: 32px 0 10px; flex-wrap: wrap;
}
.sn-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 20px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.11);
    color: rgba(255,255,255,.78); text-decoration: none;
    font-size: .87rem; font-weight: 600;
    transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
    white-space: nowrap; backdrop-filter: blur(4px);
}
.sn-btn:hover   {
    background: rgba(255,255,255,.12); color: #fff;
    border-color: rgba(255,255,255,.24);
    box-shadow: 0 4px 18px rgba(0,0,0,.30);
}
.sn-btn.sn-active {
    background: linear-gradient(135deg, rgba(0,180,90,.28), rgba(0,130,65,.18));
    border-color: rgba(0,220,110,.45); color: #44ff96;
    box-shadow: 0 0 24px rgba(0,200,90,.18);
}
.sn-btn.sn-plan   { border-color: rgba(56,170,255,.28); color: #80d8ff; }
.sn-btn.sn-plan:hover { background: rgba(0,80,180,.22); box-shadow: 0 0 20px rgba(56,182,255,.12); }

/* ── Tableaux ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; margin: 16px 0; border-radius: var(--radius-sm); overflow: hidden; }
table th, table td { padding: 11px 15px; border-bottom: 1px solid var(--border); font-size: .91rem; }
table th {
    background: linear-gradient(to bottom, rgba(0,28,66,.95), rgba(0,18,48,.98));
    color: var(--accent); font-weight: 700;
    white-space: nowrap; letter-spacing: .3px; font-size: .78rem; text-transform: uppercase;
}
table td { background: rgba(0,10,32,.82); color: var(--text); line-height: 1.55; }
table tr:hover td { background: rgba(56,182,255,.07); transition: background .15s; }

/* ── Liens dans le contenu ─────────────────────────────────── */
.page-block a:not([class]) {
    color: #60b8ff;
    text-decoration: none;
    border-bottom: 1px solid rgba(96,184,255,.28);
    transition: color var(--t), border-color var(--t);
}
.page-block a:not([class]):hover {
    color: #90d0ff;
    border-bottom-color: rgba(144,208,255,.55);
}

/* ── H2 / H3 dans le contenu ───────────────────────────────── */
.page-block h2 {
    font-size: 1.22rem; font-weight: 700;
    color: transparent;
    background: linear-gradient(90deg, #c0deff 0%, #e8f3ff 100%);
    -webkit-background-clip: text; background-clip: text;
    margin: 32px 0 14px; padding-bottom: 9px;
    border-bottom: 1px solid rgba(56,182,255,.14);
    letter-spacing: -.15px;
}
.page-block h3 {
    font-size: 1.06rem; font-weight: 700; color: #a8ccf0;
    margin: 24px 0 10px; letter-spacing: -.1px;
}
.page-block h4 {
    font-size: .96rem; font-weight: 600; color: #84aad8;
    margin: 18px 0 8px;
}

/* ── Boutons globaux ───────────────────────────────────────── */
a.home-link, button, .btn {
    transition: background var(--t), opacity var(--t), transform .12s;
}
a.home-link:hover { background: #00c8ff; color: #000; }

/* ── Carte Leaflet ─────────────────────────────────────────── */
#map { width: 100%; height: clamp(340px, 55vw, 600px); border-radius: var(--radius-sm); margin-top: 20px; }

/* ── FOOTER ────────────────────────────────────────────────── */
.site-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(0,5,18,.96);
    text-align: center;
    padding: 11px var(--pad);
    border-top: 1px solid rgba(255,255,255,.07);
    box-shadow: 0 -1px 0 rgba(56,182,255,.15), 0 -4px 24px rgba(0,0,0,.40);
    font-size: .82rem;
    color: rgba(255,255,255,.68);
    line-height: 1.5;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.site-footer a {
    color: rgba(150,210,255,.90);
    text-decoration: none;
    transition: color var(--t);
}
.site-footer a:hover { color: #fff; }
.footer-sep { color: rgba(255,255,255,.25); margin: 0 .4em; }
.footer-copy { color: rgba(255,255,255,.55); }
.footer-copy strong { color: #fff; }

/* ── Liens dans le contenu ─────────────── améliorés ──────── */
.page-block a:not([class]) {
    color: #68beff;
    text-decoration: none;
    border-bottom: 1px solid rgba(104,190,255,.24);
    transition: color var(--t), border-color var(--t);
    padding-bottom: 1px;
}
.page-block a:not([class]):hover {
    color: #98d4ff;
    border-bottom-color: rgba(152,212,255,.55);
}

/* ── Google Translate overrides ────────────────────────────── */
.goog-te-banner-frame.skiptranslate { display: none !important; }
body { top: 0 !important; }
.goog-te-gadget { font-family: inherit !important; font-size: .78rem !important; color: rgba(255,255,255,.75) !important; }
.goog-te-gadget-simple {
    background: rgba(0,20,50,.65) !important;
    border: 1px solid rgba(255,255,255,.18) !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    font-size: .75rem !important;
}
.goog-te-menu-value span { color: rgba(255,255,255,.85) !important; }
.goog-te-menu-value .goog-te-menu-value-arrow { color: rgba(255,255,255,.50) !important; }

/* ── TIMELINE ──────────────────────────────────────────────── */
.timeline { position:relative; padding:0; margin:18px 0 24px; list-style:none; }
.timeline::before {
    content:''; position:absolute; left:18px; top:0; bottom:0;
    width:2px; background:linear-gradient(to bottom,rgba(0,200,100,.40),rgba(0,80,60,.10));
}
.tl-item { position:relative; padding:0 0 18px 52px; }
.tl-item:last-child { padding-bottom:0; }
.tl-dot {
    position:absolute; left:10px; top:3px; width:18px; height:18px;
    border-radius:50%; border:2px solid; background:rgba(0,10,25,1);
    display:flex; align-items:center; justify-content:center;
    font-size:.65rem; font-weight:700;
}
.tl-year { font-size:.76rem; font-weight:700; margin-bottom:3px; }
.tl-text { font-size:.88rem; color:rgba(255,255,255,.82); line-height:1.62; }
.tl-text strong { color:#fff; }
/* Couleurs par horizon — scénario 30 ans */
.tl-y1   .tl-dot, .tl-y1   .tl-year { color:#60ffcc; border-color:#60ffcc; }
.tl-y5   .tl-dot, .tl-y5   .tl-year { color:#80ff90; border-color:#80ff90; }
.tl-y10  .tl-dot, .tl-y10  .tl-year { color:#a0ff60; border-color:#a0ff60; }
.tl-y15  .tl-dot, .tl-y15  .tl-year { color:#ffd060; border-color:#ffd060; }
.tl-y20  .tl-dot, .tl-y20  .tl-year { color:#ffb040; border-color:#ffb040; }
.tl-y30  .tl-dot, .tl-y30  .tl-year { color:#ff8040; border-color:#ff8040; }
/* Couleurs — scénario 500 ans */
.tl-y50  .tl-dot, .tl-y50  .tl-year { color:#60ffcc; border-color:#60ffcc; }
.tl-y100 .tl-dot, .tl-y100 .tl-year { color:#40e8a0; border-color:#40e8a0; }
.tl-y200 .tl-dot, .tl-y200 .tl-year { color:#30c880; border-color:#30c880; }
.tl-y300 .tl-dot, .tl-y300 .tl-year { color:#20a860; border-color:#20a860; }
.tl-y500 .tl-dot, .tl-y500 .tl-year { color:#10d850; border-color:#10d850; }
/* Couleurs — scénario 10 000 ans */
.tl-v500  .tl-dot, .tl-v500  .tl-year { color:#60d8ff; border-color:#60d8ff; }
.tl-v1000 .tl-dot, .tl-v1000 .tl-year { color:#80b8ff; border-color:#80b8ff; }
.tl-v2000 .tl-dot, .tl-v2000 .tl-year { color:#a090ff; border-color:#a090ff; }
.tl-v5000 .tl-dot, .tl-v5000 .tl-year { color:#c070ff; border-color:#c070ff; }
.tl-v10k  .tl-dot, .tl-v10k  .tl-year { color:#e050ff; border-color:#e050ff; }

/* ── Classes polices de lecture ──────────────────────────────────── */
html.font-merriweather body { font-family: 'Merriweather', Georgia, serif; font-size: 15.5px; line-height: 1.88; }
html.font-lora         body { font-family: 'Lora', Georgia, serif; font-size: 16px; line-height: 1.82; }

/* ── Widget sélecteur de police ──────────────────────────────────── */
.font-picker {
    position: fixed;
    bottom: 56px; right: 18px;  /* au-dessus du footer fixe */
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    font-family: 'Inter', Arial, sans-serif !important;
}
.font-picker-options { display: none; flex-direction: column; gap: 5px; align-items: flex-end; }
.font-picker-options.fp-open { display: flex; }
.fp-btn {
    background: rgba(6,14,36,.92);
    border: 1px solid rgba(255,255,255,.14);
    color: rgba(210,228,255,.78);
    font-size: .75rem;
    font-family: 'Inter', Arial, sans-serif;
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    transition: border-color .18s, color .18s, background .18s;
    line-height: 1;
}
.fp-btn:hover { border-color: rgba(56,182,255,.45); color: #fff; }
.fp-btn.fp-active { border-color: rgba(56,182,255,.60); color: #80d8ff; background: rgba(0,44,100,.85); font-weight: 700; }
.fp-btn .fp-sample { display: block; font-size: .65rem; color: rgba(150,190,240,.50); margin-top: 1px; font-style: italic; font-family: inherit; }
.font-picker-toggle {
    background: rgba(6,14,36,.88);
    border: 1px solid rgba(56,182,255,.30);
    color: rgba(56,182,255,.90);
    font-size: .80rem;
    font-family: 'Inter', Arial, sans-serif;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    letter-spacing: .3px;
    backdrop-filter: blur(10px);
    transition: border-color .18s, background .18s;
    line-height: 1;
}
.font-picker-toggle:hover { background: rgba(0,30,70,.92); border-color: rgba(56,182,255,.55); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1160px) {
    .page-block { width: calc(100% - 32px); }
}
@media (max-width: 960px) {
    body { font-size: 16px; }
    .page-block { width: calc(100% - 24px); }
}
/* ── Tablette portrait 640px ─────────────────────────────── */
@media (max-width: 640px) {
    body { font-size: 15.5px; }
    .page-block { padding: 20px 16px; margin: 10px auto; }
    .page-block h2 { font-size: 1.12rem; margin: 24px 0 12px; }
    .page-block h3 { font-size: 1.00rem; }
    .container { flex-direction: column; padding: 10px; gap: 12px; }
    .left-panel  { width: 100%; }
    .ph-title    { font-size: clamp(1.2rem, 5.5vw, 1.6rem); }
    .ph-sub      { font-size: .92rem; }
    .tl-item     { padding-left: 42px; }
    .tl-dot      { left: 8px; width: 16px; height: 16px; }
    .timeline::before { left: 16px; }
}
@media (max-width: 768px) {
    .page-block { padding: 18px 14px; margin: 8px auto; }
    .page-title  { font-size: 1.45rem; }
    .page-subtitle { font-size: .97rem; }
    table { font-size: .84rem; }
    table th, table td { padding: 8px 10px; }
    .container { flex-direction: column; margin-top: 0; padding: 10px; }
    .left-panel { width: 100%; }
    .scenario-nav { gap: 7px; }
}
@media (max-width: 480px) {
    body { font-size: 15px; }
    .page-block { padding: 14px 11px; margin: 6px; width: calc(100% - 12px); }
    .page-block h2 { font-size: 1.05rem; }
    .page-block h3 { font-size: .96rem; }
    .sn-btn   { padding: 8px 14px; font-size: .82rem; }
    .ph-title { font-size: 1.2rem; }
    .ph-sub   { font-size: .88rem; }
    table th, table td { padding: 6px 8px; font-size: .82rem; }
    .tl-item  { padding-left: 36px; }
    .tl-dot   { left: 5px; width: 14px; height: 14px; }
    .timeline::before { left: 12px; }
}
