/* =========================================================
   Montage PC — EMF
   Feuille de style unique. Volontairement minimale :
   1. Tokens   2. Base   3. En-tête / pied   4. Lecteur   5. Responsive
   ========================================================= */

/* 1. Tokens ----------------------------------------------- */
:root {
    color-scheme: light;

    --bg:      #ffffff;
    --text:    #111114;
    --muted:   #6b7280;          /* 4.8:1 sur blanc — lisible */
    --line:    #e6e6e8;
    --line-2:  #d0d0d4;
    --video:   #000000;

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --wrap: 1040px;
    --pad: clamp(20px, 5vw, 40px);
    --header-h: 60px;

    --dur: 180ms;
    --ease: cubic-bezier(.2, .7, .3, 1);
}

/* 2. Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.main { flex: 1; outline: none; }

h1, h2 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
p, ol { margin: 0; }

a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
    border-radius: 2px;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--pad);
}

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--pad);
    z-index: 10;
    padding: 10px 14px;
    background: var(--text);
    color: var(--bg);
    font-weight: 500;
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

.link { text-underline-offset: 3px; }

/* 3. En-tête et pied de page ------------------------------ */
.header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.header__inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header__title {
    font-weight: 600;
    letter-spacing: -.01em;
    text-decoration: none;
    white-space: nowrap;
}

/* Les onglets sont la navigation : un seul endroit pour changer de vidéo. */
.tabs { display: flex; gap: 4px; }

.tabs__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: var(--muted);
    font-size: .9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--dur) var(--ease);
}
.tabs__link:hover { color: var(--text); }
.tabs__link[aria-current="page"] { color: var(--text); }
.tabs__link[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    background: var(--text);
}

.footer {
    margin-top: 64px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .875rem;
}
.footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 24px;
    padding-block: 24px;
}

/* 4. Lecteur ---------------------------------------------- */
/* --w et --h (format de la vidéo) sont posés sur .player par le template.
   Le cadre part d'une hauteur cible et en déduit sa largeur. */
.player {
    --frame-h: min(68vh, 620px);
    --frame-w: calc(var(--frame-h) * var(--w, 9) / var(--h, 16));

    display: grid;
    gap: 40px;
    padding-block: clamp(24px, 5vw, 56px);
    align-items: start;
}
@supports (height: 1dvh) {
    .player { --frame-h: min(68dvh, 620px); }
}

.player__video {
    width: min(100%, var(--frame-w));
    aspect-ratio: var(--w, 9) / var(--h, 16);
    margin-inline: auto;
    background: var(--video);
    border-radius: 4px;
    overflow: hidden;
}
.player__video video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;         /* empêche la taille native du fichier d'élargir la colonne */
    background: var(--video);
    object-fit: contain;
}

.player__text { min-width: 0; }

.title { font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem); }

.meta {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
}

.lead {
    max-width: 62ch;
    margin-top: 20px;
    color: var(--muted);
}

.subtitle {
    margin-top: 40px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.steps {
    list-style: none;
    padding: 0;
    max-width: 62ch;
    counter-reset: step;
}
.steps li {
    counter-increment: step;
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.steps li::before {
    content: counter(step, decimal-leading-zero);
    flex: none;
    color: var(--muted);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.75;
}

/* Fondu court au changement de vidéo (piloté par le JS). */
.fade { transition: opacity var(--dur) var(--ease); }
.player.is-switching .fade { opacity: 0; }

/* Page d'erreur */
.error { padding-block: clamp(56px, 12vw, 120px); max-width: 60ch; }
.error .lead { margin-bottom: 24px; }

/* 5. Responsive ------------------------------------------- */
@media (max-width: 359px) {
    .header__title { font-size: .9375rem; }
    .tabs__link { padding: 0 8px; font-size: .875rem; }
}

@media (min-width: 860px) {
    .player {
        --frame-h: min(74vh, 680px);
        /* Colonne de largeur explicite : sinon la piste se dimensionne sur la taille
           native du fichier vidéo et écrase la colonne de texte. */
        grid-template-columns: var(--frame-w) minmax(0, 1fr);
        gap: 56px;
        padding-block: 48px;
    }
    @supports (height: 1dvh) {
        .player { --frame-h: min(74dvh, 680px); }
    }
    .player__video {
        margin-inline: 0;
        position: sticky;
        top: calc(var(--header-h) + 32px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; }
}
