/* =====================================================================
   /ai — Deck de slides « L'IA pour les développeurs »
   Réutilise les tokens & le header/footer de ../styles.css.
   Ce fichier ne gère que la présentation (slides, nav, composants).
   ===================================================================== */

:root {
    --deck-header-h: 67px;
    --deck-footer-h: 72px;
    --deck-radius: 16px;
    --deck-radius-sm: 10px;
    --deck-accent: var(--primary-color);
    --deck-maxw: 920px;
    --deck-ease: cubic-bezier(0.16, 1, 0.3, 1);
    /* Code block — sombre dans les deux thèmes pour la lisibilité */
    --code-bg: #0f172a;
    --code-fg: #e2e8f0;
    --code-comment: #7dd3a8;
    --code-key: #7cc4ff;
    --code-string: #f5b971;
}

/* ------------------------------------------------------------------ */
/* Barre de progression (fixée tout en haut, au-dessus du header)     */
/* ------------------------------------------------------------------ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1200;
    pointer-events: none;
}

.progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--hero-gradient-start), var(--hero-gradient-end));
    border-radius: 0 3px 3px 0;
    transition: width 0.45s var(--deck-ease);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* ------------------------------------------------------------------ */
/* Scène & slides                                                     */
/* ------------------------------------------------------------------ */
.deck {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(102, 126, 234, 0.10), transparent 60%),
        radial-gradient(1000px 500px at 0% 110%, rgba(118, 75, 162, 0.10), transparent 55%);
}

.slide {
    display: none;
    min-height: calc(100vh - var(--deck-header-h) - var(--deck-footer-h));
    min-height: calc(100dvh - var(--deck-header-h) - var(--deck-footer-h));
    padding: 3.5rem clamp(1.25rem, 5vw, 5rem);
    box-sizing: border-box;
}

.slide.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.slide-inner {
    width: 100%;
    max-width: var(--deck-maxw);
    margin: 0 auto;
}

/* Animation d'apparition du contenu */
.slide.active .slide-inner {
    animation: slideIn 0.55s var(--deck-ease) both;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* Typographie des slides                                             */
/* ------------------------------------------------------------------ */
.slide h2 {
    font-size: clamp(1.7rem, 3.4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    color: var(--text-color);
    position: relative;
    padding-bottom: 0.85rem;
}

.slide h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 64px;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--hero-gradient-start), var(--hero-gradient-end));
}

.slide h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--deck-accent);
}

.slide p {
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.7;
}

.slide .lead {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    color: var(--text-color);
    margin-bottom: 1.6rem;
    line-height: 1.6;
}

.slide ul,
.slide ol {
    margin: 0 0 1.4rem;
    padding-left: 0;
    list-style: none;
}

.slide ul li,
.slide ol li {
    position: relative;
    padding: 0.45rem 0 0.45rem 1.8rem;
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1.6;
}

.slide ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.05rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--deck-accent);
}

.slide ol {
    counter-reset: agenda;
}

.slide ol li {
    counter-increment: agenda;
}

.slide ol li::before {
    content: counter(agenda);
    position: absolute;
    left: 0;
    top: 0.4rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: var(--deck-accent);
    border-radius: 50%;
}

.slide ul.tight li,
.slide ol.tight li {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 1rem;
}

.slide strong { color: var(--text-color); font-weight: 600; }
.slide code:not(.code-block) {
    font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    padding: 0.1em 0.4em;
    border-radius: 6px;
    color: var(--deck-accent);
}

/* ------------------------------------------------------------------ */
/* Slides titre & section                                             */
/* ------------------------------------------------------------------ */
.slide--title,
.slide--section {
    text-align: center;
}

.slide--title .slide-inner,
.slide--section .slide-inner {
    max-width: 760px;
}

.slide--title h1 {
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 1.2rem;
    background: linear-gradient(120deg, var(--hero-gradient-start), var(--hero-gradient-end));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.slide--section h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-color);
    line-height: 1.1;
}

.kicker,
.section-num {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--deck-accent);
    margin-bottom: 1rem;
}

.slide--title .subtitle {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    color: var(--text-light);
    max-width: 620px;
    margin: 0 auto 1.8rem;
}

.slide--title .author {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.05rem;
}

.section-num {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-alt);
}

.end-links {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* Boutons de fin : on hérite de .btn du site mais on force un fond accent */
.slide .end-links .btn {
    background: linear-gradient(120deg, var(--hero-gradient-start), var(--hero-gradient-end));
    color: #fff;
    border: none;
}

.slide .end-links .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ------------------------------------------------------------------ */
/* Colonnes & cartes                                                  */
/* ------------------------------------------------------------------ */
.two-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem;
    margin-bottom: 1.4rem;
}

.col-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--deck-radius);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.25s var(--deck-ease), box-shadow 0.25s var(--deck-ease), border-color 0.25s ease;
}

[data-theme="dark"] .col-card {
    background: var(--bg-alt);
}

.col-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--deck-accent);
}

.col-card p { font-size: 1rem; }
.col-card ul { margin-bottom: 0; }

/* ------------------------------------------------------------------ */
/* Encadrés (info / warning / analogy)                                */
/* ------------------------------------------------------------------ */
.info-box,
.warning-box,
.analogy-box {
    border-radius: var(--deck-radius-sm);
    padding: 1rem 1.2rem;
    font-size: 1rem;
    line-height: 1.55;
    border-left: 4px solid;
    margin-top: 0.5rem;
}

.info-box {
    background: rgba(33, 150, 243, 0.10);
    border-color: #2196f3;
    color: var(--text-color);
}

.warning-box {
    background: rgba(255, 152, 0, 0.12);
    border-color: #ff9800;
    color: var(--text-color);
}

.analogy-box {
    background: rgba(156, 39, 176, 0.12);
    border-color: #9c27b0;
    color: var(--text-color);
}

/* ------------------------------------------------------------------ */
/* Blocs de code                                                      */
/* ------------------------------------------------------------------ */
.code-block {
    background: var(--code-bg);
    color: var(--code-fg);
    border-radius: var(--deck-radius-sm);
    padding: 1.25rem 1.4rem;
    margin: 0 0 1.3rem;
    font-family: 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: clamp(0.78rem, 1.4vw, 0.95rem);
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    -webkit-overflow-scrolling: touch;
}

.code-block .comment { color: var(--code-comment); font-style: italic; }
.code-block .key { color: var(--code-key); font-weight: 600; }
.code-block .string { color: var(--code-string); }

/* ------------------------------------------------------------------ */
/* Tableau comparatif des fichiers .md                                */
/* ------------------------------------------------------------------ */
.md-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.3rem;
    font-size: 0.98rem;
    background: var(--bg-color);
    border-radius: var(--deck-radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
}

[data-theme="dark"] .md-table { background: var(--bg-alt); }

.md-table th,
.md-table td {
    text-align: left;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-light);
}

.md-table thead th {
    background: var(--bg-alt);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .md-table thead th { background: rgba(255, 255, 255, 0.04); }

.md-table tbody tr:last-child td { border-bottom: none; }
.md-table tbody tr { transition: background 0.2s ease; }
.md-table tbody tr:hover { background: rgba(102, 126, 234, 0.07); }
.md-table td code { white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Compteur de slides                                                 */
/* ------------------------------------------------------------------ */
.slide-counter {
    position: fixed;
    bottom: 1.6rem;
    left: 1.6rem;
    z-index: 1100;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    box-shadow: var(--shadow);
    font-variant-numeric: tabular-nums;
}

.slide-counter .current { color: var(--deck-accent); }

/* ------------------------------------------------------------------ */
/* Navigation (boutons précédent / suivant)                           */
/* ------------------------------------------------------------------ */
.deck-nav {
    position: fixed;
    bottom: 1.5rem;
    right: 1.6rem;
    z-index: 1100;
    display: flex;
    gap: 0.6rem;
}

.nav-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s var(--deck-ease), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(120deg, var(--hero-gradient-start), var(--hero-gradient-end));
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.nav-btn:active:not(:disabled) { transform: translateY(0) scale(0.96); }

.nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .slide {
        padding: 2.5rem 1.25rem 5.5rem;
        align-items: flex-start;
    }

    .slide.active { align-items: flex-start; }

    .two-col {
        grid-template-columns: 1fr;
    }

    .slide-counter {
        bottom: 1rem;
        left: 1rem;
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }

    .deck-nav {
        bottom: 1rem;
        right: 1rem;
    }

    .nav-btn {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .slide { padding: 2rem 1rem 5.5rem; }
    .slide h2 { font-size: 1.5rem; }
    .slide .lead { font-size: 1.05rem; }
    .code-block { font-size: 0.74rem; padding: 1rem; }
    .md-table { font-size: 0.85rem; }
    .md-table th, .md-table td { padding: 0.55rem 0.6rem; }
    .end-links { flex-direction: column; align-items: center; }
    .end-links .btn { width: 100%; max-width: 300px; justify-content: center; }
}

/* Accessibilité : respect du « réduire les animations » */
@media (prefers-reduced-motion: reduce) {
    .slide.active .slide-inner { animation: none; }
    .progress-fill,
    .nav-btn,
    .col-card { transition: none; }
}
