/*
 * NELFE STATION — feuille de style unique.
 *
 * Organisation : tokens, base, mise en page, composants, utilitaires.
 * Aucune ressource externe n'est chargée : ni police, ni icône, ni script tiers.
 */

/* ------------------------------------------------------------ tokens */

:root {
    color-scheme: dark;

    /* Palette de la charte (CDC §8.2). */
    --nelfe-red: #ff3344;
    --tech-cyan: #18c8ff;
    --play-violet: #865dff;
    --verified-gold: #f5b940;

    --graphite: #0b0e14;
    --surface-1: #111722;
    --surface-2: #18202c;
    --text-main: #f4f7fa;
    --text-muted: #a9b2be;

    /* Variantes calculées pour le texte : le rouge et le cyan de la charte sont
       des couleurs de signal. Sur graphite ils passent en gros titre et en
       aplat, mais pas en petit texte — d'où ces versions éclaircies, qui
       atteignent le contraste 4.5:1 exigé en AA. */
    --red-text: #ff7a85;
    --cyan-text: #6fdcff;

    --line: rgba(169, 178, 190, 0.18);
    --line-strong: rgba(169, 178, 190, 0.34);

    /* Espacement au pas de 4 px, unités dominantes 8/16/24/32/48/64/96. */
    --s1: 8px;
    --s2: 16px;
    --s3: 24px;
    --s4: 32px;
    --s5: 48px;
    --s6: 64px;
    --s7: 96px;

    --radius: 14px;
    --radius-lg: 22px;
    --container: 1280px;
    --measure: 68ch;

    /* Angle coupé, repris du cadre du sous-logo Station. Utilisé avec
       parcimonie : c'est une signature, pas une texture. */
    --cut: 18px;

    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--graphite);
    color: var(--text-main);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* Les scores et les chiffres ne doivent pas sauter en largeur d'un rendu à
   l'autre (CDC §8.3). */
.num,
th,
td {
    font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 var(--s2);
    line-height: 1.12;
    letter-spacing: -0.02em;
    font-weight: 700;
}

h1 {
    font-size: clamp(2.1rem, 5.2vw, 3.6rem);
}

h2 {
    font-size: clamp(1.6rem, 3.4vw, 2.4rem);
}

h3 {
    font-size: clamp(1.15rem, 2vw, 1.4rem);
}

p {
    margin: 0 0 var(--s2);
    max-width: var(--measure);
}

a {
    color: var(--cyan-text);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--text-main);
}

img,
svg {
    display: block;
    max-width: 100%;
}

ul,
ol {
    margin: 0 0 var(--s2);
    padding-left: 1.2em;
}

li {
    margin-bottom: var(--s1);
    max-width: var(--measure);
}

/* Le focus doit rester visible indépendamment de la couleur (CDC §9.5) : on
   double le trait d'un liseré sombre pour qu'il tienne sur tous les fonds. */
:focus-visible {
    outline: 3px solid var(--text-main);
    outline-offset: 2px;
    border-radius: 4px;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: var(--s2) var(--s3);
    background: var(--text-main);
    color: var(--graphite);
    font-weight: 700;
}

.skip:focus {
    left: 0;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ------------------------------------------------------------ mise en page */

.wrap {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--s3);
}

.section {
    padding: var(--s7) 0;
    border-top: 1px solid var(--line);
}

.section--flush {
    border-top: 0;
}

.section__intro {
    max-width: var(--measure);
    margin-bottom: var(--s5);
}

.lead {
    font-size: 1.15rem;
    color: var(--text-muted);
}

.grid {
    display: grid;
    gap: var(--s3);
}

/* Un élément de grille vaut `min-width: auto` par défaut : il refuse de
   descendre sous la largeur minimale de son contenu. Un enfant qui défile
   horizontalement élargirait alors la grille, donc la page entière, au lieu de
   défiler dans son cadre. */
.grid > * {
    min-width: 0;
}

@media (min-width: 720px) {
    .grid--2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid--3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1000px) {
    .grid--4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ------------------------------------------------------------ en-tête */

.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 14, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header__bar {
    display: flex;
    align-items: center;
    gap: var(--s3);
    min-height: 72px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: 0.06em;
    font-size: 0.95rem;
}

.brand img {
    width: 34px;
    height: 34px;
}

.nav {
    margin-left: auto;
}

.nav__list {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav__list li {
    margin: 0;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.94rem;
    white-space: nowrap;
}

.nav a:hover,
.nav a[aria-current="page"] {
    color: var(--text-main);
}

.nav a[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--nelfe-red);
}

.nav__toggle {
    display: none;
    margin-left: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--s2);
    background: var(--surface-1);
    color: var(--text-main);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

@media (max-width: 1000px) {
    .nav__toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--s1);
    }

    .nav {
        display: none;
        width: 100%;
        margin: 0;
        padding-bottom: var(--s3);
    }

    .nav.is-open {
        display: block;
    }

    .header__bar {
        flex-wrap: wrap;
    }

    .nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .nav a {
        display: block;
        padding: 14px 0;
        border-bottom: 1px solid var(--line);
        font-size: 1rem;
    }

    /* Le CTA reste un bouton : sans cette exception, la règle ci-dessus le
       repasse en display:block et son libellé se colle à gauche. */
    .nav a.btn {
        display: flex;
        margin-top: var(--s2);
        padding: 12px var(--s3);
        border-bottom: 0;
    }
}

/* ------------------------------------------------------------ boutons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s1);
    min-height: 48px;
    padding: 12px var(--s3);
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--nelfe-red);
    color: #1a0206;
}

.btn--primary:hover {
    background: #ff5566;
    color: #1a0206;
}

.btn--secondary {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text-main);
}

.btn--secondary:hover {
    border-color: var(--tech-cyan);
    color: var(--text-main);
}

.btn--ghost {
    padding-left: 0;
    padding-right: 0;
    color: var(--cyan-text);
    background: none;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    margin-top: var(--s3);
}

/* ------------------------------------------------------------ hero */

.hero {
    position: relative;
    padding: var(--s7) 0 var(--s6);
    overflow: hidden;
}

/* Deux halos très discrets, rouge et cyan : ils signalent le territoire de la
   marque sans transformer le fond en néon. */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 51, 68, 0.14), transparent 32rem),
        radial-gradient(circle at 88% 18%, rgba(24, 200, 255, 0.1), transparent 30rem);
    pointer-events: none;
}

.eyebrow {
    display: block;
    margin-bottom: var(--s2);
    color: var(--cyan-text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
}

/* ------------------------------------------------------------ cartes */

.card {
    position: relative;
    padding: var(--s3);
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card h3 {
    margin-bottom: var(--s1);
}

.card p:last-child {
    margin-bottom: 0;
}

.card--action {
    display: flex;
    flex-direction: column;
    /* Le lien reste en bas quelle que soit la longueur du texte : les cartes
       d'une même rangée gardent leurs CTA alignés. */
    justify-content: space-between;
    gap: var(--s2);
}

/* L'angle coupé du sous-logo Station, en signature de section. */
.card--cut {
    border-radius: var(--radius) var(--radius) var(--radius) 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}

.card__index {
    display: block;
    margin-bottom: var(--s1);
    color: var(--nelfe-red);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
}

/* ------------------------------------------------------------ statuts */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.badge--study {
    border-color: rgba(24, 200, 255, 0.5);
    color: var(--cyan-text);
}

.badge--proto {
    border-color: rgba(245, 185, 64, 0.5);
    color: var(--verified-gold);
}

/* Mention obligatoire sur tout rendu non contractuel (CDC §8.6). */
.note {
    margin: var(--s3) 0 0;
    padding: var(--s2) var(--s3);
    border-left: 3px solid var(--tech-cyan);
    background: var(--surface-2);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.note--warn {
    border-left-color: var(--verified-gold);
}

/* ------------------------------------------------------------ schéma flux */

.flow {
    margin: 0;
    padding: var(--s3);
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

.flow ol {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: var(--s2);
}

.flow li {
    position: relative;
    margin: 0;
    padding-left: var(--s4);
    max-width: none;
}

.flow li::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 0.65em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--nelfe-red);
}

.flow li + li::after {
    content: "";
    position: absolute;
    left: 12px;
    top: -0.7em;
    height: 1.35em;
    border-left: 2px solid var(--line-strong);
}

.flow strong {
    color: var(--text-main);
}

/* ------------------------------------------------------------ schémas */

.figure {
    margin: 0 0 var(--s3);
    /* Même raison que pour les éléments de grille : sans cela, le cadre
       défilant pousse la largeur de la figure au lieu de défiler. */
    min-width: 0;
}

/* Un schéma large ne doit jamais élargir la page : il défile dans son propre
   conteneur, comme les tableaux (CDC §13, largeurs de référence dès 360 px). */
.figure__frame {
    overflow-x: auto;
    padding: var(--s3);
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.figure__frame img {
    display: block;
    width: 100%;
    height: auto;
}

/* En dessous de cette largeur, le schéma devient illisible s'il est comprimé :
   on lui rend sa taille propre et on laisse le conteneur défiler. */
@media (max-width: 720px) {
    .figure__frame img {
        width: auto;
        min-width: 640px;
    }
}

.figure figcaption {
    margin-top: var(--s2);
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: var(--measure);
}

.figure figcaption b {
    color: var(--text-main);
    font-weight: 650;
}

/* ------------------------------------------------------------ tableaux */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th,
td {
    padding: 14px var(--s2);
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    font-size: 0.94rem;
}

th {
    background: var(--surface-2);
    font-weight: 700;
}

tbody tr:last-child td {
    border-bottom: 0;
}

/* ------------------------------------------------------------ formulaires */

.form {
    max-width: 640px;
}

.field {
    margin-bottom: var(--s3);
}

.field > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 650;
}

.field__hint {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px var(--s2);
    background: var(--surface-1);
    color: var(--text-main);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    font: inherit;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--tech-cyan);
}

.field--error input,
.field--error select,
.field--error textarea {
    border-color: var(--nelfe-red);
}

.field__error {
    display: block;
    margin-top: 6px;
    color: var(--red-text);
    font-size: 0.9rem;
}

.form__errors {
    margin-bottom: var(--s3);
    padding: var(--s2) var(--s3);
    border: 1px solid var(--nelfe-red);
    border-radius: var(--radius);
    background: rgba(255, 51, 68, 0.08);
}

.form__errors ul {
    margin: var(--s1) 0 0;
}

.consent {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: var(--s3);
}

.consent input {
    width: 22px;
    height: 22px;
    min-height: 0;
    margin-top: 3px;
    flex: 0 0 auto;
}

.consent label {
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* ------------------------------------------------------------ routeur projets */

.router {
    display: grid;
    gap: var(--s2);
}

.router a {
    display: block;
    padding: var(--s3);
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-left: 3px solid var(--nelfe-red);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-main);
    transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}

.router a:hover {
    background: var(--surface-2);
    border-left-color: var(--tech-cyan);
}

.router strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.router span {
    color: var(--text-muted);
    font-size: 0.94rem;
}

/* ------------------------------------------------------------ bloc de conversion */

/* Chaque page commerciale se termine par un bloc contextualisé, jamais par un
   « Contactez-nous » générique (CDC §5.4). */
.convert {
    padding: var(--s6) 0;
    border-top: 1px solid var(--line);
    background:
        radial-gradient(circle at 20% 0%, rgba(255, 51, 68, 0.1), transparent 26rem),
        var(--surface-1);
}

.convert h2 {
    max-width: var(--measure);
}

/* ------------------------------------------------------------ pied de page */

.footer {
    padding: var(--s6) 0 var(--s5);
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.92rem;
}

.footer__grid {
    display: grid;
    gap: var(--s4);
    margin-bottom: var(--s5);
}

@media (min-width: 720px) {
    .footer__grid {
        grid-template-columns: 1.4fr 1fr 1fr 1fr;
    }
}

.footer h3 {
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-main);
    margin-bottom: var(--s2);
}

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

.footer a {
    color: var(--text-muted);
    text-decoration: none;
}

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

/* Le passage vers un autre univers NELFE doit être lisible comme tel. */
.footer a[rel~="external"]::after {
    content: " ↗";
    color: var(--cyan-text);
}

.footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2) var(--s3);
    padding-top: var(--s3);
    border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------ CTA mobile */

.sticky-cta {
    display: none;
}

@media (max-width: 720px) {
    .sticky-cta {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: block;
        padding: 10px var(--s3) calc(10px + env(safe-area-inset-bottom));
        background: rgba(11, 14, 20, 0.94);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--line);
    }

    .sticky-cta .btn {
        width: 100%;
    }

    /* Masqué quand un formulaire est ouvert : il recouvrirait les champs. */
    body.has-form .sticky-cta {
        display: none;
    }

    body:not(.has-form) {
        padding-bottom: 84px;
    }
}

/* ------------------------------------------------------------ mouvement */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
