/* ============================================================
   ui.css — composants réutilisables
   Boutons (.btn, .btn-primary avec effet conique animé,
   .btn-ghost, .btn-lg) + animations partagées (shimmer*, belt-rotate).
   ============================================================ */

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--text-soft); }

.btn-primary {
    background: var(--primary-dark);
    color: #fff;
    border-color: var(--primary-dark);
}
.btn-primary:hover {
    background: #1f2828;
    border-color: #1f2828;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    color: var(--text);
}

.btn-lg {
    padding: 14px 26px;
    font-size: 16px;
    border-radius: 14px;
}

/* === EFFET CEINTURES ANIMÉES (style Google) au hover ===
   Anneau conique tournant autour du bouton, fait avec un ::before en mask.
   Appliqué aux .btn-primary (toute la page) et au "Connexion" du header (.nav-cta .btn-ghost). */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
.btn-primary,
.nav-cta .btn-ghost {
    position: relative;
}
.btn-primary::before,
.nav-cta .btn-ghost::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(
        from var(--angle),
        var(--belt-yellow),
        var(--belt-orange),
        var(--belt-red),
        var(--belt-green),
        var(--belt-blue),
        var(--belt-yellow)
    );
    /* Masque : on ne garde que l'anneau de 2 px autour du bouton */
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.btn-primary:hover::before,
.nav-cta .btn-ghost:hover::before {
    opacity: 1;
    animation: belt-rotate 3s linear infinite;
}
@keyframes belt-rotate {
    to { --angle: 360deg; }
}

/* === ANIMATIONS PARTAGÉES === */
/* Utilisé par .hero h1 em (gradient texte) et .price-card .price-tag */
@keyframes shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes shimmerloop {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* === LOADER PLEINE PAGE ===
   Le MÊME loader que l'application (app/src/components/FullScreenSpinner) : cinq billes aux
   couleurs des ceintures sur une orbite qui accélère puis freine, chacune étirée
   tangentiellement au pic de vitesse et suivie de deux fantômes.
   Angles repris du favicon (0° / 74° / 147° / 213° / 286°).
   Créé dynamiquement via JS (getLoader() dans site.js).
   Usage : <div class="bp-loader is-visible">…</div>

   Seul écart avec l'app, et il est volontaire : le voile prend `--bg-soft`, le fond des
   pages du vitrine, là où l'app prend son `--bg`. C'est le même token dans l'intention —
   la couleur de la page qu'on recouvre. */
.bp-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.bp-loader.is-visible {
    opacity: 1;
    pointer-events: all;
}

/* L'orbite accélère puis freine à chaque tour : c'est ce rythme irrégulier —
   plus que la traînée — qui donne la sensation de vitesse. */
.bp-loader-inner {
    --turn: 1.4s;
    --ease: cubic-bezier(0.78, 0.02, 0.28, 0.99);
    --radius: 25px;
    --size: 14px;

    position: relative;
    width: 80px;
    height: 80px;
    animation: bp-loader-orbit var(--turn) var(--ease) infinite;
}

/* Chaque bras positionne une bille à l'angle voulu via --a */
.bp-loader-arm {
    position: absolute;
    inset: 0;
    transform: rotate(var(--a));
}

.bp-loader-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--size);
    height: var(--size);
    margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
    border-radius: 50%;
    background: var(--color);
    animation: bp-loader-stretch var(--turn) var(--ease) infinite;
}

/* Les fantômes n'apparaissent qu'au pic de vitesse, sinon la traînée
   resterait visible à l'arrêt et brouillerait les cinq couleurs. */
.bp-loader-ghost {
    opacity: 0;
    animation-name: bp-loader-ghost;
}

.bp-loader-label {
    font-size: 14px;
    color: var(--text-muted);
}

@keyframes bp-loader-orbit {
    to { transform: rotate(1turn); }
}

/* L'étirement est tangentiel (scaleX dans le repère du bras, où l'axe X est
   la tangente à l'orbite) et culmine au milieu du tour, à la vitesse maximale. */
@keyframes bp-loader-stretch {
    0%, 100% { transform: translateY(calc(var(--radius) * -1)) scale(1, 1); }
    50%      { transform: translateY(calc(var(--radius) * -1)) scale(2.1, 0.52); }
}

@keyframes bp-loader-ghost {
    0%, 100% { transform: translateY(calc(var(--radius) * -1)) scale(1, 1);     opacity: 0; }
    50%      { transform: translateY(calc(var(--radius) * -1)) scale(1.9, 0.5); opacity: var(--o); }
}

/* Repli : les billes se figent rondes, à leur place sur l'orbite. */
@media (prefers-reduced-motion: reduce) {
    .bp-loader-inner { animation: none; }
    .bp-loader-dot   { animation: none; transform: translateY(calc(var(--radius) * -1)); }
    .bp-loader-ghost { display: none; }
}

/* === APERÇU AVANT L'OUVERTURE (SiteStatus.IsPreview, _PreviewBadge) === */
.preview-badge {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--primary-dark);
    color: #fff;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}
.preview-badge a { color: #fff; font-weight: 600; }
