/* =====================================================================
   base.css — reset + typo + utilitaires globaux
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--brand-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-primary-d); }

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--c-text);
    background: var(--c-bg);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
}

/* ---- Typography ---- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-title);
    color: var(--brand-dark);
    line-height: 1.2;
    letter-spacing: -.015em;
    font-weight: 700;
}
h1 { font-size: clamp(2rem, 5vw, var(--fs-6xl)); letter-spacing: -.02em; }
h2 { font-size: clamp(1.75rem, 3.5vw, var(--fs-4xl)); letter-spacing: -.02em; }
h3 { font-size: clamp(1.35rem, 2.5vw, var(--fs-2xl)); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }

p { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

.lead { font-size: var(--fs-lg); color: var(--c-text-mute); line-height: 1.65; }
.eyebrow {
    display: inline-flex; align-items: center; gap: .5rem;
    text-transform: uppercase; letter-spacing: .12em;
    font-size: var(--fs-xs); font-weight: 700;
    color: var(--brand-primary-d);
    background: rgba(14, 165, 233, .1);
    padding: .4rem .85rem;
    border-radius: var(--radius-full);
}
.eyebrow::before {
    content: "";
    width: 6px; height: 6px;
    background: var(--brand-primary);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .2);
}

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

/* ---- Accessibility ---- */

.skip-link {
    position: absolute; top: -100px; left: 1rem;
    background: var(--brand-primary); color: #fff;
    padding: .75rem 1.25rem; border-radius: var(--radius); z-index: 10000;
    transition: top var(--t);
}
.skip-link:focus { top: 1rem; color: #fff; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- Container ---- */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}
@media (min-width: 768px) { .container { padding-inline: 2rem; } }

/* ---- Sections ---- */

section { position: relative; }
.section { padding-block: clamp(3.5rem, 8vw, var(--sp-24)); }
.section--tight { padding-block: clamp(2.5rem, 5vw, var(--sp-16)); }
.section--alt { background: var(--c-bg-soft); }
.section--editorial {
    background:
        radial-gradient(circle at 90% 0%, rgba(200, 163, 90, .06), transparent 60%),
        var(--brand-ivory);
}
.section--dark {
    background: linear-gradient(180deg, var(--brand-dark), var(--brand-darker));
    color: #fff;
}
.section--institutional {
    background:
        radial-gradient(ellipse at top, rgba(56, 189, 248, .12), transparent 60%),
        linear-gradient(180deg, var(--brand-institutional), var(--brand-institutional-d));
    color: #fff;
    position: relative;
    overflow: hidden;
}
.section--institutional::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
}
.section--institutional > * { position: relative; z-index: 1; }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4,
.section--institutional h1, .section--institutional h2, .section--institutional h3, .section--institutional h4 {
    color: #fff;
}
.section--dark .lead, .section--dark p,
.section--institutional .lead, .section--institutional p { color: rgba(255, 255, 255, .82); }

.section-head { text-align: center; max-width: 760px; margin: 0 auto var(--sp-12); }
.section-head h2 { margin-bottom: var(--sp-4); }
.section-head--left { text-align: left; margin-left: 0; }

/* ---- Diviseurs éditoriaux ---- */
.divider-rule {
    display: block;
    width: 64px; height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    border: 0;
    margin: 0 auto var(--sp-6);
    border-radius: 2px;
}
.divider-rule--left { margin-left: 0; margin-right: 0; }
.divider-rule--gold { background: linear-gradient(90deg, var(--brand-gold), var(--brand-gold-d)); }

/* ---- Eyebrow institutionnel (sans pill) ---- */
.kicker {
    display: inline-flex; align-items: center; gap: .75rem;
    text-transform: uppercase; letter-spacing: .18em;
    font-size: var(--fs-xs); font-weight: 700;
    color: var(--brand-primary-d);
    margin-bottom: var(--sp-4);
}
.kicker::before {
    content: "";
    width: 28px; height: 2px;
    background: currentColor;
}
.kicker--gold { color: var(--brand-gold-d); }
.kicker--light { color: rgba(255, 255, 255, .75); }

/* ---- Display typo (manchettes éditoriales) ---- */
.display, .h-display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.05;
}

/* ---- Buttons ---- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-family: var(--font-body); font-weight: 600;
    padding: .85rem 1.5rem; border-radius: var(--radius-full);
    transition: all var(--t); cursor: pointer; white-space: nowrap;
    border: 2px solid transparent;
    font-size: var(--fs-base); line-height: 1;
    text-decoration: none;
}
.btn--sm { padding: .55rem 1.1rem; font-size: var(--fs-sm); }
.btn--lg { padding: 1.05rem 2rem; font-size: var(--fs-lg); }
.btn--block { display: flex; width: 100%; }

.btn--primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    box-shadow: var(--shadow-brand);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(14, 165, 233, .45);
    color: #fff;
}

.btn--secondary {
    background: #fff;
    color: var(--brand-dark);
    border-color: var(--c-border-d);
}
.btn--secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary-d);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn--ghost {
    background: transparent;
    color: var(--brand-primary-d);
    border-color: rgba(14, 165, 233, .25);
}
.btn--ghost:hover {
    background: rgba(14, 165, 233, .08);
    color: var(--brand-primary-d);
}

.btn--dark {
    background: var(--brand-dark);
    color: #fff;
}
.btn--dark:hover { background: var(--brand-darker); color: #fff; transform: translateY(-2px); }

.btn--institutional {
    background: var(--brand-institutional);
    color: #fff;
    border-color: var(--brand-institutional);
}
.btn--institutional:hover {
    background: var(--brand-institutional-d);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-institutional);
}
.btn--outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, .35);
}
.btn--outline-light:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
    border-color: rgba(255, 255, 255, .6);
}
.btn--gold {
    background: linear-gradient(135deg, var(--brand-gold), var(--brand-gold-d));
    color: #fff;
    box-shadow: 0 8px 24px rgba(200, 163, 90, .35);
}
.btn--gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(200, 163, 90, .45);
    color: #fff;
}

.btn svg { width: 16px; height: 16px; }
.btn .btn-arrow {
    transition: transform var(--t);
}
.btn:hover .btn-arrow { transform: translateX(4px); }

/* ---- Cards ---- */

.card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    transition: all var(--t);
}
.card:hover {
    border-color: var(--brand-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

/* ---- Form base ---- */

label { font-weight: 500; color: var(--brand-dark); font-size: var(--fs-sm); }

/* font-size 16px = empêche le zoom auto Safari iOS au focus input */
input, textarea, select {
    width: 100%;
    border: 1.5px solid var(--c-border);
    background: #fff;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    color: var(--c-text);
    font-size: 16px;
    line-height: 1.4;
    min-height: 48px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    -webkit-appearance: none;
    appearance: none;
}
select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, .12);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 1px;
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"],
input.is-invalid, select.is-invalid, textarea.is-invalid {
    border-color: var(--c-danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .12);
}
textarea { min-height: 120px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (min-width: 640px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: .35rem; }
.field-help { font-size: var(--fs-xs); color: var(--c-text-mute); }
.field-error {
    font-size: var(--fs-xs);
    color: var(--c-danger);
    display: flex; align-items: center; gap: .35rem;
    margin-top: .25rem;
}
.field-error::before {
    content: "!";
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--c-danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
}
.form-message, .form-success, .form-error {
    border-radius: var(--radius);
    padding: .85rem 1.25rem;
    font-size: var(--fs-sm);
    margin-bottom: var(--sp-4);
    border-left: 4px solid;
}
.form-success { border-color: var(--c-success); background: rgba(16, 185, 129, .08); color: #065F46; }
.form-error   { border-color: var(--c-danger);  background: rgba(239, 68, 68, .08); color: #991B1B; }

.checkbox { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; font-size: var(--fs-sm); line-height: 1.45; }
.checkbox input {
    width: 22px; height: 22px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: var(--brand-primary);
    min-height: auto;
}

/* ---- Focus visible global (a11y) ---- */
:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
a:focus-visible, button:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 3px;
}

/* ---- Tap targets mobile (a11y) ---- */
@media (pointer: coarse) {
    a, button, [role="button"], input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
    }
    .btn--sm { min-height: 38px; }
    .faq__btn { min-height: 54px; }
}

/* ---- Container variants ---- */
.container--narrow { max-width: 880px; }
.container--wide   { max-width: 1440px; }

/* ---- Utilities ---- */

.text-center { text-align: center; }
.text-mute   { color: var(--c-text-mute); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

/* ---- Reveal anim ---- */

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.reveal-scale {
    opacity: 0; transform: scale(.97);
    transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.reveal-scale.is-visible { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .reveal, .reveal-scale { opacity: 1; transform: none; transition: none; }
}

/* ---- Back-to-top button ---- */
.back-to-top {
    position: fixed;
    right: 1.25rem; bottom: 90px;
    width: 44px; height: 44px;
    background: var(--brand-dark);
    color: #fff;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0; pointer-events: none;
    transform: translateY(12px);
    transition: opacity var(--t), transform var(--t), background var(--t);
    z-index: var(--z-sticky);
}
.back-to-top:hover { background: var(--brand-primary); color: #fff; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top svg { width: 18px; height: 18px; }
@media (min-width: 768px) { .back-to-top { right: 2rem; bottom: 2rem; } }
