/* =============================================================================
   Nuyo — site.css
   Feuille de style commune à toutes les pages : landing, légales, email-validation,
   nuyo-email-change, nuyo-confirmed-mail.
   Contient : tokens (variables), base, texture papier, brand/logo, nav, footer,
   marquee, animations partagées et utilitaires.
   Le CSS spécifique à chaque page reste dans son propre <style> inline.
   ============================================================================= */

/* ─── Tokens couleurs / palette Nuyo ─────────────────────────────────────────
   Charte alignée sur le logo : fond clair (light) / navy (dark), accents
   bleu bracket + vert dot. Les autres tokens (--accent-*) gardent leurs noms
   pour ne pas casser les références mais leurs valeurs sont réharmonisées
   autour de la marque.
   ─────────────────────────────────────────────────────────────────────────── */
:root {
    color-scheme: light;

    /* Logo Nuyo — chevron `>` et point `•` */
    --brand-bracket: #1E50C8;
    --brand-dot:     #2EB872;

    /* Surfaces (fond du logo light = blanc) */
    --paper:        #FFFFFF;        /* fond principal landing */
    --paper-soft:   #F4F6FA;        /* fond adouci pages utilitaires */
    --paper-2:      #E9EEF6;        /* bandes alternantes */
    --paper-3:      #D9E1ED;        /* contrastes plus marqués */
    --card:         #FFFFFF;

    /* Texte */
    --ink:          #0F2438;        /* navy logo dark = texte fort en light */
    --ink-dim:      #3D4D60;
    --ink-soft:     #6E7C8E;
    --muted:        #6E7C8E;

    /* Bordures */
    --border:        rgba(15, 36, 56, 0.10);
    --border-strong: rgba(15, 36, 56, 0.22);

    /* Accents — réharmonisés autour du bleu bracket + vert dot */
    --accent:       #2EB872;        /* vert dot logo (était vert végétal) */
    --accent-2:     #1E50C8;        /* bleu bracket logo (était terre cuite) */
    --accent-3:     #5BC9E8;        /* bleu clair complémentaire (était beige doré) */
    --accent-4:     #0F2438;        /* navy profond (était bleu denim) */
    --accent-eco:   #D5F2E1;        /* vert clair pour fond success */

    /* Grades A→E (Nutri-Score) — conservés tels quels */
    --grade-a: #038141;
    --grade-b: #85bb2f;
    --grade-c: #fecb02;
    --grade-d: #ee8100;
    --grade-e: #e63e11;

    /* Code / terminal — toujours sombres dans les 2 thèmes
       (les boîtes `.bp-core`, `.ai-terminal` doivent rester en "mode code"
       quel que soit le thème de la page) */
    --code-bg:       #0A1A2A;
    --code-bg-2:     #0F2438;
    --code-fg:       #E8EFF7;
    --code-fg-soft:  rgba(232, 239, 247, 0.6);
    --code-fg-faint: rgba(232, 239, 247, 0.18);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --brand-bracket: #5BC9E8;
        --brand-dot:     #65B69C;

        --paper:        #0F2438;        /* navy du logo dark */
        --paper-soft:   #16304A;
        --paper-2:      #1B3852;
        --paper-3:      #20425E;
        --card:         #16304A;

        --ink:          #F0F4F8;
        --ink-dim:      #B5C2D2;
        --ink-soft:     #8090A2;
        --muted:        #8090A2;

        --border:        rgba(240, 244, 248, 0.10);
        --border-strong: rgba(240, 244, 248, 0.22);

        --accent:       #65B69C;
        --accent-2:     #5BC9E8;
        --accent-3:     #8FD9F1;
        --accent-4:     #B8C7DA;
        --accent-eco:   rgba(101, 182, 156, 0.18);
    }
}

/* ─── Reset / base ─── */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

html, body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* ─── Texture papier (fixée, non-cliquable) ─── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    mix-blend-mode: multiply;
}

/* En dark theme, la texture multiply n'apporte rien sur un fond navy
   (elle fonce déjà très peu un fond clair) — on la coupe pour clarté. */
@media (prefers-color-scheme: dark) {
    body::before { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAV + brand (logo `> nuyo•`)
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-wrap {
    position: relative;
    z-index: 10;
    padding: 22px 0;
    border-bottom: 1px solid var(--border);
}

.brand {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 4px 0;
}

.brand::before {
    content: '>';
    display: inline-block;
    margin-right: 6px;
    color: var(--brand-bracket);
    font-weight: 500;
    opacity: 0.9;
}

.brand .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--brand-dot);
    border-radius: 50%;
    margin-left: 2px;
    align-self: center;
    animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

.nav-links a {
    color: var(--ink-dim);
    text-decoration: none;
    margin-left: 2rem;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0; right: 100%;
    bottom: -4px;
    height: 1px;
    background: var(--ink);
    transition: right 0.3s ease;
}

.nav-links a:hover::after { right: 0; }

.nav-links a.active {
    color: var(--ink);
}

.nav-cta {
    padding: 9px 20px;
    background: var(--ink);
    color: var(--paper) !important;
    border-radius: 999px;
    margin-left: 2rem !important;
    font-weight: 600;
}

.nav-cta::after { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   LANGUAGE SWITCHER (FR | EN) — partagé entre toutes les pages
   ═══════════════════════════════════════════════════════════════════════════ */

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--ink-soft);
    margin-left: 1.6rem;
    letter-spacing: 0.04em;
}
.lang-switch a {
    color: var(--ink-soft);
    text-decoration: none;
    padding: 2px 4px;
    transition: color 0.2s;
}
.lang-switch a:hover { color: var(--ink); }
/* La langue active se marque automatiquement via [lang] sur <html> */
html[lang="fr"] .lang-switch .lang-fr,
html:not([lang="fr"]) .lang-switch .lang-en {
    color: var(--ink);
    font-weight: 700;
}
.lang-switch .sep { opacity: 0.4; }

@media (max-width: 767px) {
    .lang-switch { margin-left: 0; font-size: 0.72rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER global
   ═══════════════════════════════════════════════════════════════════════════ */

footer {
    position: relative;
    z-index: 5;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    color: var(--ink-dim);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.02em;
}

footer a {
    color: var(--ink-dim);
    text-decoration: none;
    margin-left: 22px;
    transition: color 0.2s;
}

footer a:hover { color: var(--ink); }

footer a.active { color: var(--ink); }

/* ═══════════════════════════════════════════════════════════════════════════
   Animations partagées
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reveal au scroll (utilisé par la landing) */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade in initial (utilisé par les pages utilitaires) */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    animation: fade-in-up 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.fade-in.delay-1 { animation-delay: 0.1s; }
.fade-in.delay-2 { animation-delay: 0.2s; }
.fade-in.delay-3 { animation-delay: 0.3s; }

@keyframes fade-in-up {
    to { opacity: 1; transform: translateY(0); }
}

/* Spin (badges rotatifs, orbe IA) */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* Rotate (alias de spin pour les spinners) */
@keyframes rotate { to { transform: rotate(360deg); } }

/* Halo spin lent autour d'une icône de succès */
@keyframes halo-spin { to { transform: rotate(360deg); } }

/* Pop (apparition élastique d'une icône) */
@keyframes pop {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Ripple (pulse autour d'un dot) */
@keyframes ripple {
    0%   { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Composants utilitaires (pages d'état : email-validation, email-change…)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Icône d'état circulaire — base commune.
   Les variantes (success/loading/error/expired) sont définies par chaque page
   selon le contexte, mais la géométrie et l'animation sont partagées. */
.status-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    position: relative;
}

.status-icon svg {
    width: 44px;
    height: 44px;
    animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Halo discret autour de la variante success (cercle pointillé qui tourne) */
.status-icon.success-halo::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 1px dashed var(--accent);
    opacity: 0.3;
    animation: halo-spin 18s linear infinite;
}

/* Spinner circulaire utilisé dans les états "loading" */
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--paper-3);
    border-top-color: var(--accent-2);
    border-radius: 50%;
    animation: rotate 0.9s linear infinite;
}

/* Encart "Retournez sur votre téléphone" — partagé entre les 2 pages */
.return-notice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: var(--paper-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: left;
    max-width: 420px;
    margin: 0 auto;
}

.return-notice .return-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid var(--border-strong);
    display: grid;
    place-items: center;
    color: var(--accent-2);
}

.return-notice .return-icon svg {
    width: 22px;
    height: 22px;
}

.return-notice .return-title {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 2px;
}

.return-notice .return-desc {
    font-size: 0.84rem;
    color: var(--ink-dim);
    line-height: 1.5;
}

.return-notice .return-desc em {
    font-style: italic;
    font-family: 'Instrument Serif', serif;
    font-size: 0.95rem;
    color: var(--ink);
}

/* État affichable / masquable (utilisé par les 2 pages d'auth) */
.state {
    display: none;
}

.state.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive global
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .nav-links a:not(.nav-cta) { display: none; }
    .nav-cta { margin-left: 0 !important; }
}