/* Assistant IA : section animée (page Fonctionnalités) et page dédiée. */
.ai-scope {
    --ai-ink: #081438;
    --ai-muted: #34415f;
    --ai-line: #e5e0f1;
    --ai-violet: #362bf0;
    --ai-violet-soft: #eee9fc;
    --ai-mint: #e3f6ee;
    --ai-mint-ink: #126046;
}

.ai-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-block-end: 18px;
    color: #3f298d;
    font-size: 15px;
    font-weight: 650;
}
.ai-eyebrow-mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: linear-gradient(135deg, #5b45e6, #8a7cf2);
}
.ai-eyebrow-mark svg { width: 15px; height: 15px; color: #fff; }
.ai-badge {
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ai-mint);
    color: var(--ai-mint-ink);
    font-size: 13px;
    font-weight: 650;
}

/* ---------- Section défilante ---------- */
.ai-story { padding-block: clamp(56px, 6vw, 96px) 0; }
.ai-story-head { max-width: 760px; margin-block-end: clamp(28px, 3vw, 44px); }
.ai-story-head h2 {
    font-size: clamp(32px, 3.3vw, 48px);
    font-weight: 765;
    letter-spacing: -.055em;
    line-height: 1.04;
    text-wrap: balance;
}
.ai-story-head p {
    max-width: 58ch;
    margin-block-start: 16px;
    color: var(--ai-muted);
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.55;
}
.ai-story-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: clamp(28px, 5vw, 80px);
    align-items: start;
}
.ai-stage {
    position: sticky;
    top: 24px;
    display: grid;
    min-height: min(600px, calc(100vh - 48px));
    padding: clamp(18px, 3vw, 44px);
    overflow: hidden;
    border-radius: 28px;
    background:
        radial-gradient(120% 70% at 15% 0%, #d9d2ff 0%, transparent 60%),
        radial-gradient(90% 60% at 100% 100%, #c9f0e1 0%, transparent 65%),
        linear-gradient(160deg, #ebe6fd 0%, #f4f1fe 45%, #e7f5f2 100%);
    isolation: isolate;
}
.ai-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: repeating-linear-gradient(90deg, rgb(91 69 230 / .10) 0 2px, transparent 2px 14px);
    mask-image: linear-gradient(180deg, transparent 30%, #000 50%, transparent 70%);
}
.ai-chat {
    grid-area: 1 / 1;
    align-self: center;
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
    padding: 18px;
    border: 1px solid rgb(255 255 255 / .9);
    border-radius: 22px;
    background: rgb(255 255 255 / .82);
    box-shadow: 0 24px 60px rgb(65 32 149 / .16), 0 3px 8px rgb(59 36 123 / .06);
    backdrop-filter: blur(10px);
    font-size: 15px;
    line-height: 1.45;
}
.ai-chat-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-block-end: 12px;
    margin-block-end: 14px;
    border-bottom: 1px solid var(--ai-line);
    color: var(--ai-muted);
    font-size: 13px;
    font-weight: 600;
}
.ai-chat-top .ai-eyebrow-mark { width: 22px; height: 22px; border-radius: 7px; }
.ai-chat-top .ai-eyebrow-mark svg { width: 13px; height: 13px; }
.ai-chat-top span:last-child { margin-inline-start: auto; color: #6a7390; font-weight: 500; }
.ai-msg { display: flex; margin-block-end: 12px; }
.ai-msg:last-child { margin-block-end: 0; }
.ai-msg p { margin: 0; }
.ai-msg-user { justify-content: flex-end; }
.ai-msg-user p {
    max-width: 85%;
    padding: 11px 15px;
    border-radius: 16px 16px 4px 16px;
    background: linear-gradient(105deg, #4a37e8, #6350d2);
    color: #fff;
    font-weight: 520;
}
.ai-msg-bot p {
    max-width: 92%;
    padding: 11px 15px;
    border-radius: 16px 16px 16px 4px;
    background: #f4f2fa;
    color: var(--ai-ink);
}
.ai-tool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-block-end: 12px;
    padding: 6px 11px 6px 7px;
    border: 1px solid var(--ai-line);
    border-radius: 999px;
    background: #fff;
    color: var(--ai-muted);
    font-size: 13px;
    font-weight: 600;
}
.ai-tool img { width: 18px; height: 18px; }
.ai-tool b { color: var(--ai-mint-ink); font-weight: 650; }
.ai-result {
    display: grid;
    gap: 6px;
    margin-block: 4px 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 3px 12px rgb(41 28 85 / .07);
    font-size: 14px;
}
.ai-result-row { display: flex; justify-content: space-between; gap: 12px; }
.ai-result-row span:first-child { color: var(--ai-muted); }
.ai-result-row strong { font-weight: 650; text-align: end; }
.ai-result-pill {
    justify-self: start;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--ai-mint);
    color: var(--ai-mint-ink);
    font-size: 12px;
    font-weight: 650;
}

.ai-steps { display: grid; }
.ai-step {
    display: grid;
    align-content: center;
    min-height: 46vh;
    padding-block: 24px;
    border-top: 1px solid var(--ai-line);
}
.ai-step:first-child { border-top: 0; }
.ai-step h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: clamp(21px, 1.7vw, 26px);
    font-weight: 700;
    letter-spacing: -.035em;
}
.ai-step-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--ai-violet-soft);
}
.ai-step p { margin: 12px 0 0; color: var(--ai-muted); font-size: 17px; line-height: 1.6; }
.ai-step-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-block-start: 18px;
    color: var(--ai-violet);
    font-weight: 650;
}
.ai-step-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Animation pilotée par le défilement (activée par assistant-ia.js) */
.ai-animated .ai-step { opacity: .38; transition: opacity .35s ease; }
.ai-animated .ai-step.ai-active { opacity: 1; }
.ai-animated .ai-chat { opacity: 0; transform: translateY(18px) scale(.98); transition: opacity .45s ease, transform .45s ease; pointer-events: none; }
.ai-animated .ai-chat.ai-active { opacity: 1; transform: none; pointer-events: auto; }
.ai-animated .ai-chat > *:not(.ai-chat-top) { opacity: 0; transform: translateY(8px); transition: opacity .35s ease, transform .35s ease; }
.ai-animated .ai-chat.ai-active > *:not(.ai-chat-top) { opacity: 1; transform: none; }
.ai-animated .ai-chat.ai-active > :nth-child(3) { transition-delay: .45s; }
.ai-animated .ai-chat.ai-active > :nth-child(4) { transition-delay: .9s; }
.ai-animated .ai-chat.ai-active > :nth-child(5) { transition-delay: 1.3s; }
.ai-animated .ai-chat.ai-active > :nth-child(6) { transition-delay: 1.7s; }

/* Sans JavaScript : la première conversation reste visible. */
.ai-stage:not(.ai-ready) .ai-chat:not(:first-child) { display: none; }

@media (max-width: 900px) {
    .ai-story-layout { grid-template-columns: 1fr; gap: 0; }
    .ai-stage { top: 8px; z-index: 1; min-height: 0; padding: 12px; border-radius: 22px; }
    .ai-chat { align-self: start; padding: 12px 14px; font-size: 13.5px; }
    .ai-story .ai-chat-top, .ai-story .ai-result { display: none; }
    .ai-story .ai-msg, .ai-story .ai-tool { margin-block-end: 8px; }
    .ai-result { font-size: 13px; }
    .ai-step { min-height: 40vh; }
    .ai-step:first-child { padding-top: 40px; }
}

/* ---------- Page Assistant IA ---------- */
.ai-page { overflow-x: clip; }
.ai-wrap { width: min(1320px, calc(100% - 8.4vw)); margin-inline: auto; }
.ai-hero {
    background:
        radial-gradient(70% 90% at 100% 0%, #d8d0ff 0%, transparent 60%),
        radial-gradient(60% 80% at 0% 100%, #dff3ec 0%, transparent 60%),
        #f2edfc;
}
.ai-hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(28px, 4vw, 72px);
    align-items: center;
    padding-block: clamp(48px, 5vw, 84px) clamp(64px, 6vw, 104px);
}
.ai-hero h1 {
    font-size: clamp(40px, 4.2vw, 66px);
    font-weight: 765;
    letter-spacing: -.055em;
    line-height: 1.03;
    text-wrap: balance;
}
.ai-hero-copy > p {
    max-width: 48ch;
    margin-block: 22px 28px;
    color: var(--ai-muted);
    font-size: clamp(17px, 1.42vw, 21px);
    line-height: 1.52;
}
.ai-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ai-actions .button { min-height: 54px; border-radius: 12px; }
.ai-works-with { margin-block-start: 22px; color: var(--ai-muted); font-size: 15px; }
.ai-works-with strong { color: var(--ai-ink); }
.ai-hero-visual { position: relative; }
.ai-hero-visual .ai-chat { max-width: 560px; }

.ai-prompts { padding-block: 28px; border-bottom: 1px solid var(--ai-line); overflow: hidden; }
.ai-prompts-label { margin-block-end: 14px; color: var(--ai-muted); font-size: 15px; font-weight: 600; text-align: center; }
.ai-prompts-row { display: flex; gap: 12px; width: max-content; padding-inline: 12px; }
.ai-prompts-row + .ai-prompts-row { margin-block-start: 12px; }
.ai-prompts-row span {
    padding: 10px 16px;
    border: 1px solid var(--ai-line);
    border-radius: 999px;
    background: #fff;
    font-size: 15px;
    white-space: nowrap;
}
.ai-prompts-row span::before { content: "« "; color: #8a7cf2; }
.ai-prompts-row span::after { content: " »"; color: #8a7cf2; }
:lang(en) .ai-prompts-row span::before { content: "“"; }
:lang(en) .ai-prompts-row span::after { content: "”"; }
@media (prefers-reduced-motion: no-preference) {
    .ai-prompts-row { animation: ai-marquee 60s linear infinite; }
    .ai-prompts-row:nth-child(3) { animation-direction: reverse; }
    .ai-prompts:hover .ai-prompts-row { animation-play-state: paused; }
}
@keyframes ai-marquee { to { transform: translateX(-50%); } }

.ai-section { padding-block: clamp(64px, 7vw, 112px) 0; }
.ai-section > .ai-wrap > h2, .ai-section-title {
    max-width: 820px;
    font-size: clamp(32px, 3.3vw, 48px);
    font-weight: 765;
    letter-spacing: -.055em;
    line-height: 1.04;
    text-wrap: balance;
}
.ai-section-intro { max-width: 62ch; margin-block-start: 16px; color: var(--ai-muted); font-size: 18px; line-height: 1.55; }

.ai-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-block-start: 36px; }
.ai-card {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 10px;
    padding: 22px;
    border: 1px solid var(--ai-line);
    border-radius: 20px;
    background: #fff;
}
.ai-card h3 { margin: 6px 0 0; font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
.ai-card p { margin: 0; color: var(--ai-muted); line-height: 1.55; }
:lang(fr) .ai-card q { quotes: "« " " »"; }
.ai-card q {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f6f4fc;
    color: #3f298d;
    font-size: 14px;
    font-weight: 560;
    line-height: 1.45;
}

.ai-connect { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 36px 0 0; padding: 0; list-style: none; counter-reset: ai-step; }
.ai-connect li {
    position: relative;
    padding: 26px 24px 24px;
    border-radius: 20px;
    background: linear-gradient(160deg, #efeafd, #f6f4fe);
    counter-increment: ai-step;
}
.ai-connect li::before {
    content: counter(ai-step);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-block-end: 16px;
    border-radius: 50%;
    background: var(--ai-violet);
    color: #fff;
    font-weight: 700;
}
.ai-connect h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.03em; }
.ai-connect p { margin: 0; color: var(--ai-muted); line-height: 1.55; }
.ai-connect a { color: var(--ai-violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ai-url {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-block-start: 14px;
    padding: 6px 6px 6px 14px;
    border: 1px solid #d9d2f3;
    border-radius: 12px;
    background: #fff;
}
.ai-url code { flex: 1; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ai-url button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 9px;
    background: var(--ai-violet);
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}
.ai-url button img { filter: brightness(0) invert(1); }

.ai-trust { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-block-start: 36px; }
.ai-trust article { display: flex; gap: 16px; padding: 22px; border: 1px solid var(--ai-line); border-radius: 20px; background: #fff; }
.ai-trust h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.03em; }
.ai-trust p { margin: 0; color: var(--ai-muted); line-height: 1.55; }
.ai-trust a { color: var(--ai-violet); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.ai-faq { max-width: 900px; margin-block-start: 28px; }
.ai-faq details { border-bottom: 1px solid var(--ai-line); }
.ai-faq summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-block: 20px;
    font-size: 18px;
    font-weight: 650;
    cursor: pointer;
    list-style: none;
}
.ai-faq summary::-webkit-details-marker { display: none; }
.ai-faq summary::after { content: "+"; color: var(--ai-violet); font-size: 24px; line-height: 1; }
.ai-faq details[open] summary::after { content: "–"; }
.ai-faq details p { margin: 0 0 20px; color: var(--ai-muted); line-height: 1.6; }

.ai-closing {
    margin-block: clamp(64px, 7vw, 112px);
    padding: clamp(40px, 5vw, 72px) clamp(24px, 4vw, 64px);
    border-radius: 28px;
    background: radial-gradient(80% 120% at 100% 0%, #6d5cf0 0%, transparent 60%), linear-gradient(135deg, #1c1478, #362bf0);
    color: #fff;
    text-align: center;
}
.ai-closing h2 { font-size: clamp(30px, 3.2vw, 46px); font-weight: 765; letter-spacing: -.055em; line-height: 1.05; }
.ai-closing p { max-width: 60ch; margin: 16px auto 28px; color: #e3e0ff; font-size: 18px; line-height: 1.55; }
.ai-closing .ai-actions { justify-content: center; }
.ai-closing .ai-closing-primary { background: #fff; color: var(--ai-violet); }
.ai-closing .ai-closing-secondary { border: 1px solid rgb(255 255 255 / .6); color: #fff; }

@media (max-width: 1100px) {
    .ai-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .ai-hero-layout { grid-template-columns: 1fr; }
    .ai-connect, .ai-trust { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .ai-grid { grid-template-columns: 1fr; }
    .ai-actions .button { flex: 1 1 100%; justify-content: center; }
}

.ai-stage-hero { position: relative; top: auto; min-height: 500px; }
@media (max-width: 900px) {
    .ai-stage-hero { height: auto; min-height: 400px; }
    .ai-stage-hero .ai-chat { align-self: center; }
}
