/*
 * Variables globales — auto-mesurées par base.html au load et resize.
 * Utiliser via calc(100svh - var(--navbar-h)) ou la classe .section-fullheight.
 */
:root {
    --navbar-h: 72px; /* fallback ; auto-mesuré en JS dans base.html */
}


/*
 * Fraunces (.font-display) — plafonnement de l'optical size (opsz).
 *
 * Fraunces est une variable font à axe opsz (9..144). Par défaut le navigateur
 * applique font-optical-sizing:auto : à grande taille (nos titres display, ~100px)
 * l'opsz grimpe vers ~100, le contraste devient extrême et la barre horizontale
 * du 'e' se réduit à un cheveu <1px. FreeType (Linux) le rend tel quel → la barre
 * saute, le 'e' ressemble à un 'c'. Windows/ClearType l'épaississait, d'où le
 * "OK hier sur Windows". Le poids n'y change rien (vérifié : casse à 300 ET 400
 * à grande taille) — c'est bien l'optique, pas la graisse.
 *
 * On fige opsz à 56 : assez bas pour que la barre du 'e' tienne jusqu'à 108px,
 * assez haut pour garder le contraste éditorial du display. font-variation-settings
 * ne liste QUE l'axe opsz → le font-weight de chaque titre (300/400/500/700)
 * reste piloté normalement (vérifié au rendu). Pour plus de contraste : monter
 * vers 64-72 ; pour plus de sécurité : descendre vers 40.
 */
.font-display {
    font-variation-settings: "opsz" 56;
}


/*
 * .section-fullheight — utility pour qu'une section prenne TOUT le viewport
 * disponible SOUS la navbar sticky (pas de débordement).
 *
 * Utilisation : <section class="section-fullheight"> ou .hero-class { @apply via min-height inline }
 *
 * Pour les heros qui s'affichent juste après une navbar sticky 72px, on
 * doit toujours soustraire la hauteur de la navbar pour ne pas déborder.
 */
.section-fullheight {
    min-height: calc(100svh - var(--navbar-h));
}


/*
 * global.css — composants CSS récurrents (toutes pages)
 *
 * Chargé dans base.html, après Tailwind. Définit seulement les composants
 * qui apparaissent sur plusieurs pages :
 *   - boutons signature (.btn-primary, .btn-outline, .btn-ghost)
 *   - eyebrow / section-tag (labels mono uppercase éditoriaux)
 *   - inputs / form-field (style éditorial des formulaires)
 *   - ::selection custom (toujours)
 *   - .bg-paper-grid (fond crème dot-grid, peut servir partout)
 *
 * Tout le reste passe par Tailwind utility (cf. tailwind.config.js).
 *
 * Tokens utilisés (référencés depuis tailwind.config.js) :
 *   primary-700  #5a1224 (bordeaux)
 *   secondary-900 #13234f (marine)
 *   accent-500   #6b8169 (sauge)
 *   cream-100    #f5efe0 (paper)
 *   cream-200    #ece5d6 (bg crème)
 *   ink-950      #0c0f1a (texte sombre)
 *   muted-600    #6b6557 (gris chaud)
 */


/* ============================================================
 * SELECTION — texte surligné en bordeaux / cream
 * ============================================================ */
::selection {
    background: #5a1224;
    color: #f5efe0;
}


/* ============================================================
 * SCROLLBAR — barre de défilement signature (bordeaux sur crème)
 * Base globale, valable sur tout le site. Surchargée par page métier
 * via metier-theme.css (règles html.mt-active::-webkit-scrollbar-*).
 * Firefox : scrollbar-color / scrollbar-width. WebKit : pseudo-éléments.
 * ============================================================ */
html {
    scrollbar-width: thin;
    scrollbar-color: #5a1224 #ece5d6;
}
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: #ece5d6;
}
::-webkit-scrollbar-thumb {
    background: #5a1224;
    border-radius: 999px;
    border: 3px solid #ece5d6;  /* marge interne → thumb "pilule" détaché de la piste */
}
::-webkit-scrollbar-thumb:hover {
    background: #13234f;  /* marine au survol */
}


/* ============================================================
 * BG-PAPER-GRID — fond crème + grille de points papier d'imprimerie
 * Réutilisable sur n'importe quelle page (home, services, contact, etc.)
 * ============================================================ */
.bg-paper-grid {
    background-color: #ece5d6;
    background-image: radial-gradient(circle at 1px 1px, rgba(12, 15, 26, 0.06) 1px, transparent 0);
    background-size: 18px 18px;
}

.bg-paper-grid-ink {
    background-color: #0c0f1a;
    background-image: radial-gradient(circle at 1px 1px, rgba(245, 239, 224, 0.06) 1px, transparent 0);
    background-size: 18px 18px;
}


/* ============================================================
 * EYEBROW — petit label mono uppercase au-dessus d'un titre
 * Pattern récurrent : "§ Services — Chapitre 01"
 * ============================================================ */
.eyebrow {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b6557;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.eyebrow::before {
    content: "§";
    color: #5a1224;
    font-family: "Instrument Serif", serif;
    font-style: italic;
    font-size: 18px;
    line-height: 1;
}

.eyebrow-ink {
    color: rgba(245, 239, 224, 0.6);
}

.eyebrow-ink::before {
    color: #e2a8a0;
}


/* ============================================================
 * BUTTONS — boutons signature de l'agence
 * Trois variantes : primary (bordeaux solide), outline, ghost
 * Tous ont un "ring" rotatif à droite façon studio digital
 * ============================================================ */
.btn,
.btn-primary,
.btn-outline,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px 12px 20px;
    border-radius: 999px;
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.005em;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: #13234f;  /* secondary-900 — bleu marine */
    color: #f5efe0;
    border-color: #13234f;
}
.btn-primary:hover {
    background: #5a1224;  /* primary-700 — bordeaux au hover */
    border-color: #5a1224;
}

.btn-outline {
    background: transparent;
    color: #13234f;  /* secondary-900 — bleu marine */
    border-color: rgba(19, 35, 79, 0.32);
}
.btn-outline:hover {
    background: #13234f;  /* secondary-900 au hover */
    color: #f5efe0;
    border-color: #13234f;
}

.btn-ghost {
    background: transparent;
    color: #13234f;
    border-color: transparent;
    padding-left: 8px;
    padding-right: 8px;
}
.btn-ghost:hover {
    color: #5a1224;
}

/* Ring décoratif à droite du bouton — petit cercle cream avec flèche bordeaux.
   La flèche SVG utilise stroke="currentColor", donc on contrôle sa couleur
   via la propriété CSS `color` du ring (pas via stroke).

   Schéma de couleur :
   - Repos    : fond cream  + flèche bordeaux (ressort sur fond marine du bouton)
   - Hover    : fond marine + flèche cream    (ressort sur fond bordeaux du bouton hover)
*/
.btn-ring {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f5efe0;  /* cream-100 par défaut */
    color: #5a1224;       /* flèche bordeaux par défaut (via currentColor) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.25s ease,
                color 0.25s ease;
    flex: none;
}
.btn-primary:hover .btn-ring {
    background: #13234f;  /* secondary-900 — marine au hover */
    color: #f5efe0;       /* flèche cream */
}
.btn-outline:hover .btn-ring {
    background: #13234f;
    color: #f5efe0;
}
.btn:hover .btn-ring,
.btn-primary:hover .btn-ring,
.btn-outline:hover .btn-ring,
.btn-ghost:hover .btn-ring {
    transform: rotate(-45deg);
}
.btn-ring svg {
    /* La couleur du svg suit la color du parent .btn-ring via currentColor */
}

/* Tailles */
.btn-sm {
    padding: 8px 14px 8px 16px;
    font-size: 13px;
}
.btn-sm .btn-ring {
    width: 18px;
    height: 18px;
}
.btn-lg {
    padding: 16px 24px 16px 28px;
    font-size: 16px;
}
.btn-lg .btn-ring {
    width: 28px;
    height: 28px;
}


/* ============================================================
 * FORM FIELDS — migrés vers forms.css (2026-05-22)
 * Les classes .input-editorial / .textarea-editorial / .select-editorial /
 * .label-editorial vivent maintenant dans forms.css avec tout l'écosystème
 * form (form-row, form-grid-2, form-banner, form-aside, etc.)
 * ============================================================ */


/* ============================================================
 * LINK-UNDERLINE — lien avec underline animé au hover
 * ============================================================ */
.link-underline {
    position: relative;
    color: inherit;
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0 1px;
    transition: background-size 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: 2px;
}

.link-underline:hover {
    background-size: 100% 1px;
}


/* ============================================================
 * ACCESSIBILITY — focus visible custom (cohérent design)
 * ============================================================ */
:focus-visible {
    outline: 2px solid #5a1224;
    outline-offset: 3px;
    border-radius: 2px;
}

/* Skip-to-content link (a11y) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 8px;
    background: #5a1224;
    color: #f5efe0;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    z-index: 1000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 8px;
}


/* ============================================================
 * SMOOTH SCROLL — défilement doux uniquement sur clic d'ancre interne.
 *
 * scroll-behavior:smooth N'EST PAS posé sur <html> globalement : ça interfère
 * avec GSAP ScrollTrigger (scrub) qui pilote ses propres animations au scroll.
 * Le smooth scroll est appliqué chirurgicalement via le handler JS de base.html
 * (delegate sur `a[href^="#"]` → element.scrollIntoView({ behavior: 'smooth' })).
 *
 * scroll-margin-top évite que la cible passe sous la navbar fixe
 * (la variable --navbar-h est exposée par le script de base.html).
 * ============================================================ */
[id] {
    scroll-margin-top: calc(var(--navbar-h, 80px) + 16px);
}


/* ============================================================
 * REDUCED MOTION — respecte les préférences utilisateur
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
