/* ═══════════════════════════════════
   PROSTABLES GLOBAL DESIGN SYSTEM
   Variables, Reset, Typo, Buttons, Performance
═══════════════════════════════════ */

:root {
    --color-primary: #0E0338;
    --color-secondary: #9a7d5c;
    --color-bg: #F9F7F2;
    --color-white: #FFFFFF;
    --color-text-1: #0E0338;
    --color-text-2: rgba(14, 3, 56, 0.75);
    --color-border: rgba(14, 3, 56, 0.12);
    --color-glow: rgba(154, 125, 92, 0.5);

    --color-navy: #0E0338;
    --color-gold: #9a7d5c;
    --color-lime: #D4F467;

    /* ProTrot Colors */
    --color-protrot-primary: #19826c;
    --color-protrot-secondary: #24bb9b;

    /* Accent system */
    --color-accent: var(--color-secondary);
    --color-accent-glow: var(--color-glow);

    --font-display: 'Poppins', sans-serif;
    --font-body: 'Poppins', sans-serif;

    --transition-vibrant: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    --btn-shadow: 0 10px 20px rgba(14, 3, 56, 0.1);
    --btn-shadow-hover: 0 15px 30px rgba(14, 3, 56, 0.2);
}

/* ═══ GLOBAL MODES ═══ */
.mode-protrot {
    --color-accent: var(--color-protrot-secondary);
    --color-accent-glow: rgba(36, 187, 155, 0.4);
}

.mode-protrot .btn-download,
.mode-protrot .btn-demo-hero,
.mode-protrot .btn-pill,
.mode-protrot .btn-nl-submit {
    background: var(--color-protrot-primary) !important;
    border-color: var(--color-protrot-primary) !important;
    color: white !important;
}

.mode-protrot .btn-download:hover,
.mode-protrot .btn-demo-hero:hover,
.mode-protrot .btn-pill:hover {
    background: var(--color-protrot-secondary) !important;
    border-color: var(--color-protrot-secondary) !important;
}

/* ═══ RESET & TYPO ═══ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* scroll-behavior: smooth removed — handled by JS lerp engine for premium feel */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-1);
    background-color: var(--color-bg);
    /* `clip` empêche le débordement horizontal SANS créer de conteneur de défilement.
       Avec `hidden`, Safari transforme le body en conteneur scrollable et casse le
       `position: sticky` du hero (les cartes d'avantages ne s'affichaient alors pas).
       `hidden` reste en repli pour les navigateurs sans support de `clip`. */
    overflow-x: hidden;
    overflow-x: clip;
    line-height: 1.6;
    margin: 0;
}

h1,
h2,
h3,
h4,
.font-display {
    font-family: var(--font-display);
    font-weight: 700;
}

/* ═══ PERFORMANCE BLOCKS ═══ */
section,
.hero-scrolly-block,
.pwa-section,
.trust-section,
.pricing-section,
.testimonials-section,
.premium-footer {
    content-visibility: auto;
    /* `auto` mémorise la taille réelle après le 1er rendu : évite les re-décalages (CLS)
       lorsqu'on fait défiler puis revient sur une section. */
    contain-intrinsic-size: auto 100vh;
}

/* CLS : le hero est au-dessus de la ligne de flottaison, il est donc toujours rendu.
   Lui appliquer content-visibility:auto ne fait qu'introduire une estimation de hauteur
   (100vh) fausse — surtout sur mobile où le hero est un long empilement vertical — ce qui
   décale tout le contenu en dessous au premier rendu. On le rend donc normalement. */
.hero-scrolly-block {
    content-visibility: visible;
    contain-intrinsic-size: auto;
}

/* Promote sticky viewports to their own GPU compositing layer for jank-free rendering */
.sticky-viewport {
    will-change: contents;
    contain: layout style;
    transform: translateZ(0);
}

.v-reveal,
.tableau-screen,
.iphone-frame,
.vibrant-blob,
.switch-pill,
.footer-contact-card,
.adv-card,
.pwa-list-card {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* ═══ CUSTOM CURSOR ═══ */
.cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 44px;
    height: 44px;
    border: none !important;
    pointer-events: none;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Pas de transition sur `transform` : le déplacement doit coller à la souris au pixel près
       (une transition ici fait « traîner » le curseur et le rend moins précis). On garde les
       transitions décoratives (fond, arrondi) et l'effet de scale sur `.cursor svg`. */
    transition: background 0.3s, border-radius 0.3s;
    will-change: transform;
    opacity: 1;
    color: var(--color-accent);
}

.cursor svg {
    width: 36px;
    height: 36px;
    fill: currentColor;
    transition: transform 0.2s ease;
    transform: scaleX(-1);
}

.cursor::after {
    display: none !important;
}

.cursor.active {
    background: var(--color-accent-glow);
    border-radius: 50%;
}

.cursor.active svg {
    transform: scaleX(-1) scale(1.3);
}

/* Masquer le curseur cheval sur tablette/mobile (breakpoint du site : 1023px) ET sur tout
   appareil tactile, puis rétablir le curseur natif. `html body.prostables-active` a une
   spécificité suffisante pour surcharger le `cursor: none !important` injecté dans le <head>. */
@media (max-width: 1023px), (hover: none) {
    .cursor {
        display: none !important;
    }

    html body.prostables-active,
    * {
        cursor: auto !important;
    }
}

/* ═══ SHARED BUTTONS ═══ */
.btn-pill,
.btn-download,
.btn-demo,
.btn-action,
.btn-nl-submit,
.btn-primary,
.btn-secondary,
.btn-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 40px;
    border-radius: 100px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.btn-primary,
.btn-pill,
.btn-download,
.btn-nl-submit {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
    box-shadow: var(--btn-shadow);
}

.btn-primary:hover,
.btn-pill:hover,
.btn-download:hover,
.btn-nl-submit:hover {
    transform: translateY(-5px) scale(1.02);
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-primary);
    box-shadow: 0 20px 40px var(--color-glow);
}

.btn-secondary,
.btn-demo {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn-secondary:hover,
.btn-demo:hover {
    background: var(--color-primary);
    color: var(--color-white);
    transform: translateY(-5px);
    box-shadow: var(--btn-shadow-hover);
}

.btn-social {
    width: 44px;
    height: 44px;
    padding: 0 !important;
    font-size: 20px !important;
    background: var(--color-white);
    color: var(--color-primary);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.btn-social:hover {
    transform: translateY(-3px);
    background: var(--color-secondary);
    color: var(--color-primary);
}

/* ═══ SHARED FIELDS (Natural Language) ═══ */
.nl-input,
.nl-select,
.nl-editable {
    appearance: none !important;
    -webkit-appearance: none !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--color-secondary) !important;
    font-family: var(--font-display) !important;
    font-size: 16px !important;
    padding: 0 4px !important;
    font-style: italic !important;
    transition: all 0.3s !important;
    outline: none !important;
    margin: 0 !important;
    font-weight: 500 !important;
    border-radius: 0 !important;
    white-space: nowrap;
}

.nl-input::placeholder {
    color: rgba(0, 0, 0, 0.2) !important;
    font-weight: 300 !important;
}

.nl-editable:empty:before {
    content: attr(data-placeholder);
    color: rgba(0, 0, 0, 0.2);
    font-style: normal;
    font-weight: 300;
    pointer-events: none;
}

.nl-input:focus,
.nl-editable:focus {
    border-bottom-color: var(--color-accent) !important;
    background: rgba(0, 0, 0, 0.02) !important;
}

.nl-editable:focus:before {
    content: '' !important;
}

/* ═══ UTILS ═══ */
.v-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: var(--transition-vibrant);
}

.v-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.acc-neutral {
    color: var(--color-gold) !important;
}

/* Grain Effect */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
}

.liquid-filter-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ═══ SKELETON LOADING ═══ */
.skeleton {
    position: relative;
    overflow: hidden;
    background-color: rgba(14, 3, 56, 0.08) !important;
    color: transparent !important;
    border-color: transparent !important;
    user-select: none;
    pointer-events: none;
    transition: background-color 0.4s ease, color 0.4s ease;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.5),
            transparent);
    /* Animation en `transform`, JAMAIS en `left`.
       `left` est une propriété de mise en page : l'animer déplaçait réellement
       le pseudo-élément à chaque frame, et Lighthouse comptait chacun de ces
       déplacements comme un décalage de mise en page. Résultat mesuré :
       0,184 des 0,202 de CLS imputés à ces seuls `::after`, dont 0,115 pour
       celui de .tableau-screen (le plus grand).
       `transform` ne touche pas la mise en page, ne compte pas dans le CLS et
       est composité par le GPU — ce qui règle du même coup les audits
       « Forced reflow » et « Avoid non-composited animations ».

       La géométrie est conservée à l'identique : les pourcentages de `left`
       se réfèrent à la largeur du parent, ceux de `translateX` à la largeur de
       l'élément (50 % du parent). L'ancien `left: -100% → 200%` équivaut donc
       exactement à `translateX(-200% → 400%)`. Le rendu visuel est le même. */
    transform: translateX(-200%);
    animation: skeleton-shimmer 1.5s infinite;
    will-change: transform;
    z-index: 10;
}

@keyframes skeleton-shimmer {
    from {
        transform: translateX(-200%);
    }

    to {
        transform: translateX(400%);
    }
}

.skeleton * {
    visibility: hidden !important;
}

.skeleton-text {
    border-radius: 8px;
    min-height: 1em;
    /* NE PAS remettre `display: inline-block` ici.
       .skeleton-text s'applique à des <h1>, <p> et <h3> (hero.php:142,148 ;
       testimonials.php:112,116). Les passer en inline-block les faisait se
       rétrécir à leur contenu au lieu de remplir le conteneur ; quand
       navbar.js retire la classe 200 ms plus tard, ils repassaient en
       display: block, le texte se re-répartissait sur d'autres lignes et la
       hauteur changeait — c'était la source du Cumulative Layout Shift
       (mesuré entre 0,067 et 0,303 selon que Poppins était arrivée ou non
       avant les 200 ms, d'où l'instabilité d'un test à l'autre). */
}

/* Seuls les éléments naturellement inline ont besoin d'être promus pour
   recevoir un fond et une hauteur minimale (cf. testimonials.php:122). */
span.skeleton-text {
    display: inline-block;
}

/* ═══ MIN-HEIGHT FOR PAGES (Avoid footer jumping on empty/short pages) ═══ */
main,
#main,
#content,
.site-main,
.main-content,
#primary,
.entry-content {
    min-height: 73vh;
}