/* Styles critiques head — anciennement inline dans layout/main.php.
   Externalisés pour passer la CSP serveur (style-src 'self' sans
   'unsafe-inline' sur les <style> blocks). Les style="..." attributs
   restent autorisés via styleSrcAttr 'unsafe-inline'.

   Contient : critical CSS above-the-fold + store badges + smart banner +
   nav drawer mobile + skip-to-content a11y. Chargé en synchrone dans
   <head> AVANT site.css pour éviter le FOUC. */


/* ----------------------------------------------------------------
   Polices critiques (Inter 400/600/700/800).
   Les MÊMES fichiers sont préchargés dans layout/main.php
   (<link rel="preload" … as="font" crossorigin>) : déclarer les
   @font-face ici, dans la feuille synchrone, permet de les appliquer
   dès leur arrivée au lieu d'attendre site.css (chargé en différé).
   Inter 500 et JetBrains Mono (non critiques) restent dans site.css.

   « Inter Fallback » : Arial local recalé sur les métriques d'Inter
   (size-adjust / ascent / descent) pour que le passage fallback → Inter
   (font-display: swap) ne décale presque pas la mise en page (CLS).
   ---------------------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/inter-800.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter Fallback';
    src: local('Arial'), local('ArialMT'), local('Helvetica'), local('Liberation Sans');
    size-adjust: 107.06%;
    ascent-override: 90.49%;
    descent-override: 22.56%;
    line-gap-override: 0%;
}

:root {
    --navy: #0A1628;
    --text: #E6EDF6;
    --text-muted: #8B98AB;
    --accent: #4FC3F7;
    --border: #1D2F4D;
    --surface: #0F1F38;
}

html, body {
    background: var(--navy);
    color: var(--text);
    font-family: 'Inter', 'Inter Fallback', system-ui, -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    line-height: 1.5;
    /* Filet de sécurité contre scroll horizontal parasite sur écrans étroits
       (pliants 280-340px) si un élément déborde.
       `clip` et non `hidden` : `hidden` sur html ET body fait de body un
       conteneur de défilement, et casse tous les `position: sticky` du site
       (téléphone de l'accueil, sommaires de la méthodologie et du changelog).
       `hidden` reste en repli pour les navigateurs qui ignorent `clip`. */
    overflow-x: hidden;
    overflow-x: clip;
}

/* box-sizing global — padding et border inclus dans la width. */
*, *::before, *::after { box-sizing: border-box; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 22, 40, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.hero { padding: 80px 0 60px; }
.hero h1 {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 16px;
    letter-spacing: -0.02em;
}
.lead { font-size: 18px; color: var(--text-muted); max-width: 640px; }

@media (max-width: 540px) {
    .hero h1 { font-size: 32px; }
    .site-header .row { height: 64px; }
}

/* ──────────────────────────────────────────────────────────────
   Store badges (App Store / Play Store)
   ────────────────────────────────────────────────────────────── */
.store-badges { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.store-badges--inline { gap: 10px; }
.store-badge {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 10px 18px;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    text-decoration: none;
    font-family: 'Inter', 'Inter Fallback', system-ui, sans-serif;
    line-height: 1.1;
    transition: transform 120ms ease, border-color 120ms ease;
}
.store-badge:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.35); }
.store-badges--inline .store-badge { padding: 8px 14px; }
.store-badge__icon { flex-shrink: 0; }
.store-badge__text { display: flex; flex-direction: column; }
.store-badge__caption { font-size: 10px; opacity: 0.75; letter-spacing: 0.04em; }
.store-badges--inline .store-badge__caption { font-size: 9px; }
.store-badge__name { font-size: 16px; font-weight: 600; letter-spacing: 0.01em; }
.store-badges--inline .store-badge__name { font-size: 13px; }

/* Sur mobile, ne montrer que le badge de l'OS détecté. Sur desktop ou OS
   inconnu : les deux. Sélecteurs sur html[data-os=...] (posé par script
   synchrone du head) pour éviter le FOUC 1-frame qui causait un CLS de 0.010. */
[data-os="ios"] .store-badge--android { display: none; }
[data-os="android"] .store-badge--ios { display: none; }

/* ──────────────────────────────────────────────────────────────
   Smart banner mobile (sticky bottom, dismissable session)
   ────────────────────────────────────────────────────────────── */
.smart-banner {
    position: fixed;
    left: 12px; right: 12px;
    /* Respect safe-area iPhone X+ et nav-bar Android. */
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #0A1628;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
body.show-smart-banner.os-ios .smart-banner,
body.show-smart-banner.os-android .smart-banner { display: flex; }

/* Libère la place sous le contenu pour que le banner ne recouvre pas le footer. */
body.show-smart-banner.os-ios,
body.show-smart-banner.os-android {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

.smart-banner__icon {
    width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
    background: linear-gradient(135deg, #fff 0%, #e6e6e6 100%);
    display: flex; align-items: center; justify-content: center;
}
.smart-banner__icon img { width: 30px; height: 30px; }
.smart-banner__text { flex: 1; min-width: 0; line-height: 1.3; }
.smart-banner__title {
    font-size: 13px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.smart-banner__sub {
    font-size: 11px; color: rgba(255, 255, 255, 0.65);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.smart-banner__cta {
    background: #fff; color: #0A1628;
    padding: 10px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700;
    text-decoration: none; flex-shrink: 0;
    /* Apple HIG 44pt min tappable. */
    min-height: 44px;
    display: inline-flex; align-items: center;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}
.smart-banner__close {
    background: transparent; color: rgba(255, 255, 255, 0.5);
    border: 0; cursor: pointer;
    /* Zone de tap 44×44 sans grossir visuellement le ×. */
    min-width: 44px; min-height: 44px;
    padding: 0;
    font-size: 18px; line-height: 1; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
}
.smart-banner__close:hover { color: #fff; }
[data-os="ios"] .smart-banner-android-cta,
[data-os="android"] .smart-banner-ios-cta { display: none; }

/* Très petits écrans (pliants Z Flip en mode replié, 280-340px) :
   layout compact, icône cachée, sous-titre caché, CTA serré. */
@media (max-width: 380px) {
    .smart-banner { gap: 6px; padding: 8px 10px; }
    .smart-banner__icon { display: none; }
    .smart-banner__sub { display: none; }
    .smart-banner__title { font-size: 12px; }
    .smart-banner__cta {
        padding: 10px 10px;
        font-size: 11px;
        min-height: 40px;
    }
    .smart-banner__close {
        min-width: 36px; min-height: 36px;
        font-size: 16px;
    }
}

/* ──────────────────────────────────────────────────────────────
   Menu mobile (hamburger + drawer overlay)
   ──────────────────────────────────────────────────────────────
   Nav desktop cachée par site.css à <540px. À la place, bouton
   hamburger qui ouvre un drawer plein écran. Pas de onclick inline,
   tout en addEventListener (compatible CSP script-src-attr 'self').
*/
.nav-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: var(--text, #fff);
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    min-width: 44px; min-height: 44px;
    align-items: center; justify-content: center;
    border-radius: 8px;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.06); }
.nav-toggle svg { width: 24px; height: 24px; display: block; }
.nav-toggle .icon-close { display: none; }
body.nav-open .nav-toggle .icon-burger { display: none; }
body.nav-open .nav-toggle .icon-close { display: block; }

/* Drawer mobile — fullscreen overlay quand body.nav-open. */
.nav-drawer-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10, 22, 40, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
}
body.nav-open .nav-drawer-backdrop { display: block; }
.nav-drawer {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(82vw, 320px);
    background: #0A1628;
    border-left: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
    z-index: 999;
    padding: 88px 24px 32px;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 220ms ease;
}
body.nav-open .nav-drawer {
    display: flex;
    transform: translateX(0);
}
.nav-drawer a {
    display: block;
    padding: 14px 12px;
    color: var(--text, #fff);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid transparent;
}
.nav-drawer a:hover,
.nav-drawer a.active {
    background: rgba(79, 195, 247, 0.10);
    border-color: rgba(79, 195, 247, 0.25);
    color: var(--accent, #4FC3F7);
}
.nav-drawer-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 0;
}
.nav-drawer-section {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 12px;
    margin-top: 8px;
}

/* Active uniquement sous 540px (même breakpoint que nav desktop cachée). */
@media (max-width: 540px) {
    .nav-toggle { display: inline-flex; }
    /* Drawer ouvert = body scroll bloqué. */
    body.nav-open { overflow: hidden; }
}

/* Pliants en mode replié (Z Flip 5/6/7 ≈ 280-340px CSS) : drawer plus large
   (92vw au lieu de 82vw, sinon coin vide à gauche), padding réduit. */
@media (max-width: 380px) {
    .nav-drawer {
        width: 92vw;
        padding: 72px 16px 24px;
    }
    .nav-toggle { padding: 6px; min-width: 40px; min-height: 40px; }
    .nav-toggle svg { width: 22px; height: 22px; }
}

/* ──────────────────────────────────────────────────────────────
   Skip-to-content (a11y WCAG 2.4.1 Bypass Blocks)
   ──────────────────────────────────────────────────────────────
   Caché par défaut, visible au focus clavier (TAB) pour permettre aux
   utilisateurs lecteur d'écran/clavier de sauter au contenu principal. */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 12px;
    z-index: 10000;
    padding: 10px 18px;
    background: var(--accent, #4FC3F7);
    color: var(--navy, #0A1628);
    font-family: 'Inter', 'Inter Fallback', system-ui, sans-serif;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    border-radius: 8px;
    transition: top 120ms ease;
}
.skip-to-content:focus {
    top: 12px;
    outline: 2px solid var(--text, #fff);
    outline-offset: 2px;
}
