/* =====================================================================
   Styles de la page de démonstration.
   Le chatbot a ses propres styles, isolés dans widget.js.
   Polices du système uniquement : aucune requête vers un service tiers.
   ===================================================================== */

/* ----- Couleurs et réglages communs (« design tokens ») ----- */
:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --accent: #4f46e5;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-alt: #eef2ff;
    --text: #0f172a;
    --text-light: #475569;
    --border: #e2e8f0;
    --code-background: #0f172a;
    --code-text: #e2e8f0;
    --online: #22c55e;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-strong: 0 24px 60px rgba(29, 78, 216, 0.18);
}

/* Thème sombre si le système de l'utilisateur est en mode sombre. */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #3b82f6;
        --primary-hover: #60a5fa;
        --accent: #818cf8;
        --background: #0b1120;
        --surface: #111a2e;
        --surface-alt: #0f1730;
        --text: #e2e8f0;
        --text-light: #94a3b8;
        --border: #1e293b;
        --code-background: #020617;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
        --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.5);
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background: var(--background);
    color: var(--text);
}

a {
    color: var(--primary);
}

h1,
h2,
h3 {
    line-height: 1.2;
}

code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.9em;
}

/* Colonne centrale de largeur limitée. */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ----- Boutons ----- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.3);
}

.button-primary:hover {
    box-shadow: 0 12px 28px rgba(29, 78, 216, 0.4);
}

.button-ghost {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

.button-ghost:hover {
    border-color: var(--primary);
}

.button-small {
    padding: 6px 14px;
    font-size: 0.9rem;
}

/* ----- Barre de navigation, collée en haut au défilement ----- */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--background) 85%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.brand img {
    object-fit: contain;
}

.brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand small {
    color: var(--text-light);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a:not(.button) {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
}

.nav-links a:not(.button):hover {
    color: var(--text);
}

/* ----- En-tête de la page (« hero ») ----- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 40px 0 44px;
    /* Halos colorés très légers en arrière-plan. */
    background:
        radial-gradient(circle at 15% 20%, rgba(79, 70, 229, 0.12), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(29, 78, 216, 0.12), transparent 45%);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 40px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* Point vert qui pulse, signe que l'assistant est disponible. */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--online);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: dot-pulse 2s infinite;
}

@keyframes dot-pulse {
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2.1rem, 4.5vw, 3.4rem);
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead {
    margin: 0 0 22px;
    font-size: 1.15rem;
    color: var(--text-light);
    max-width: 34em;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Petite coche verte devant chaque argument. */
.trust li::before {
    content: "✓";
    margin-right: 6px;
    font-weight: 700;
    color: var(--online);
}

/* ----- Aperçu de conversation à droite du titre ----- */
.hero-visual {
    position: relative;
}

.glow {
    position: absolute;
    inset: 10% 5%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    filter: blur(70px);
    opacity: 0.25;
    border-radius: 50%;
}

.preview {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    /* L'aperçu flotte légèrement. */
    animation: hover-card 6s ease-in-out infinite;
}

@keyframes hover-card {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.preview-header img {
    padding: 2px;
    background: #ffffff;
    border-radius: 50%;
    object-fit: contain;
}

.preview-header div {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.preview-header small {
    opacity: 0.9;
}

.online {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 4px;
    border-radius: 50%;
    background: var(--online);
}

.preview-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px 22px;
    background: var(--background);
}

.bubble {
    max-width: 85%;
    margin: 0;
    padding: 10px 14px;
    font-size: 0.92rem;
    border-radius: 16px;
}

.bubble-user {
    align-self: flex-end;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-bottom-right-radius: 4px;
}

.bubble-bot {
    align-self: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chips {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.chips span {
    padding: 1px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* Trois points animés : l'assistant « écrit ». */
.typing-preview span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 2px;
    border-radius: 50%;
    background: var(--primary);
    animation: typing 1.2s infinite;
}

.typing-preview span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-preview span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* Le robot posé sur le coin de l'aperçu, qui se balance. */
.floating-bot {
    position: absolute;
    top: -46px;
    right: -22px;
    object-fit: contain;
    filter: drop-shadow(0 12px 18px rgba(15, 23, 42, 0.25));
    animation: bob 4s ease-in-out infinite;
}

@keyframes bob {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-10px) rotate(4deg); }
}

/* ----- Sections ----- */
.section {
    padding: 40px 0;
}

.section-alt {
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-title {
    margin: 0 0 6px;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    letter-spacing: -0.01em;
}

.section-lead {
    margin: 0 0 18px;
    color: var(--text-light);
}

/* ----- Questions d'exemple ----- */
.examples {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.example {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    /* Place à droite pour la flèche. */
    padding: 14px 52px 14px 18px;
    font: inherit;
    font-weight: 500;
    text-align: left;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.example:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

/* Flèche à droite de la carte, plus visible au survol. Elle est placée
   en position absolue : elle ne prend pas de place dans la carte. */
.example::after {
    content: "→";
    position: absolute;
    top: 50%;
    right: 22px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    opacity: 0.35;
    transform: translateY(-50%);
    transition: opacity 0.15s, right 0.15s;
}

.example:hover::after {
    opacity: 1;
    right: 18px;
}

.example-tag {
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--surface-alt);
    border-radius: 999px;
}

/* ----- Points forts ----- */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.feature {
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.feature h3 {
    margin: 12px 0 6px;
    font-size: 1.1rem;
}

.feature p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ----- Étapes du fonctionnement ----- */
.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.steps li {
    position: relative;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.steps h3 {
    margin: 10px 0 4px;
    font-size: 1.05rem;
}

.steps p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-light);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-weight: 700;
    color: var(--primary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
}

.stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
}

.stack li {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* ----- Intégration ----- */
.integration {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    align-items: center;
    gap: 32px;
}

.checklist {
    margin: 0;
    padding: 0;
    list-style: none;
}

.checklist li {
    margin-bottom: 10px;
}

.checklist li::before {
    content: "✓";
    margin-right: 8px;
    font-weight: 700;
    color: var(--online);
}

.code-card {
    background: var(--code-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

/* Trois ronds de couleur, comme une fenêtre d'éditeur de code. */
.code-dots {
    display: flex;
    gap: 6px;
}

.code-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
}

.code-dots i:nth-child(2) {
    background: #f59e0b;
}

.code-dots i:nth-child(3) {
    background: #22c55e;
}

.copy {
    margin-left: auto;
    padding: 4px 12px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    cursor: pointer;
}

.copy:hover {
    background: rgba(148, 163, 184, 0.3);
}

.code-card pre {
    margin: 0;
    padding: 18px;
    overflow-x: auto;
    color: var(--code-text);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ----- Pied de page ----- */
.footer {
    padding: 24px 0 96px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.footer-inner {
    text-align: center;
}

.footer p {
    margin: 4px 0;
}

.footer a {
    color: var(--text-light);
}

/* ----- Adaptation aux écrans plus petits ----- */
@media (max-width: 960px) {
    .hero-grid,
    .integration {
        grid-template-columns: 1fr;
    }

    /* Une seule colonne : l'écart de la grille suffit entre le texte
       et l'aperçu (pas de marge en plus). */
    .hero-grid {
        gap: 48px;
    }

    .hero-visual {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
    }

    .features,
    .steps {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .nav-links a:not(.button) {
        display: none;
    }

    .hero {
        padding: 32px 0 36px;
    }

    .examples,
    .features,
    .steps {
        grid-template-columns: 1fr;
    }

    .floating-bot {
        width: 80px;
        height: 80px;
        top: -36px;
        right: -6px;
    }

    .section {
        padding: 32px 0;
    }
}

/* Si l'utilisateur a demandé à son système de réduire les animations,
   on les désactive (accessibilité). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
