/* Empreintes : couleurs et typographies de la maquette mobile (artifact « Empreintes — maquette mobile »). */

:root {
    --nuit: #16132A;
    --noir: #0E0D14;
    --creme: #F4EEE6;
    --rose: #F2A7C3;
    --rose-clair: #FFD3E4;
    --lilas: #C9BEDA;
    --gris: #A99FBD;
    --voile: rgba(22, 19, 42, 0.72);
    --voile-noir: rgba(14, 13, 20, 0.82);
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'DM Sans', system-ui, sans-serif;
    --haut: env(safe-area-inset-top, 0px);
    --bas: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--noir);
    color: var(--creme);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body { overscroll-behavior: none; }

button { font: inherit; }

[hidden] { display: none !important; }

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

/* un écran de téléphone ; sur grand écran, le même écran posé au centre comme un téléphone (voir la fin du fichier) */
.ecran {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
    background: var(--nuit);
}

.plein { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.ressort { flex-grow: 1; }

/* ---------- textes et boutons communs */

.colonne {
    position: relative;
    height: 100%;
    padding: calc(var(--haut) + 76px) 32px calc(var(--bas) + 36px);
    display: flex;
    flex-direction: column;
}

.surtitre { margin: 0; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--lilas); }

.titre { margin: 18px 0 0; font-family: var(--serif); font-weight: 400; font-size: 68px; line-height: 1; letter-spacing: -0.01em; }

.question { margin: 14px 0 0; font-family: var(--serif); font-style: italic; font-size: 28px; line-height: 1.15; color: var(--rose); }

.texte { margin: 0; font-size: 19px; line-height: 1.5; }

.mention { margin: 20px 0 0; font-size: 14px; line-height: 1.55; color: var(--lilas); }

.pied { margin: 16px 0 0; font-size: 12px; text-align: center; color: var(--gris); }

.bouton-principal {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 28px;
    background: var(--rose);
    color: var(--nuit);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}

.bouton-principal:hover { background: var(--rose-clair); }

.bouton-contour {
    height: 48px;
    border-radius: 24px;
    border: 1.5px solid rgba(244, 238, 230, 0.45);
    background: transparent;
    color: var(--creme);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.bouton-contour.large { margin-top: 12px; width: 100%; flex-shrink: 0; }

.bouton-icone {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 24px;
    background: transparent;
    color: var(--creme);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bouton-icone.fond { background: rgba(244, 238, 230, 0.14); }

button:disabled { opacity: 0.45; cursor: default; }

/* ---------- 1 · accueil */

.decor { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

@media (max-height: 700px) {
    .colonne { padding-top: calc(var(--haut) + 40px); }
    .titre { font-size: 56px; }
    .texte { font-size: 17px; }
}

/* ---------- 2 · photo */

.ecran-photo { background: var(--noir); }

/* l'aperçu : la vidéo telle quelle, recadrée au centre (la photo prise reprend exactement ce cadre) */
.apercu { object-fit: cover; object-position: center; background: var(--noir); }

.apercu.miroir { transform: scaleX(-1); }

.bandeau-haut {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: calc(var(--haut) + 14px) 24px 22px 8px;
    background: var(--voile-noir);
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.bandeau-haut .retour { flex-shrink: 0; }

.bandeau-haut > div { padding-top: 10px; }

.bandeau-haut p { margin: 0; font-size: 17px; line-height: 1.5; }

.bandeau-haut .bandeau-aide { margin-top: 6px; font-size: 14px; color: var(--lilas); }

/* gabarit du plan américain, posé sur l'aperçu : tête en haut, épaules, buste jusqu'à la taille */
.gabarit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--creme);
    stroke-width: 2;
    stroke-dasharray: 7 7;
    stroke-linecap: round;
    opacity: 0.5;
    pointer-events: none;
}

.pastille-centre {
    position: absolute;
    left: 50%;
    top: 51%;
    transform: translateX(-50%);
    margin: 0;
    padding: 7px 14px;
    border-radius: 16px;
    background: rgba(14, 13, 20, 0.78);
    font-size: 13px;
    white-space: nowrap;
}

.camera-erreur {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    padding: 24px;
    border-radius: 16px;
    background: var(--voile-noir);
    text-align: center;
}

.camera-erreur p { margin: 0; font-size: 17px; line-height: 1.5; }

.camera-erreur .bouton-principal { margin-top: 20px; }

.camera-erreur .bouton-principal:focus-within { outline: 2px solid var(--rose); outline-offset: 3px; }

.champ-fichier { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

.galerie { position: relative; }

.galerie:focus-within { outline: 2px solid var(--rose); outline-offset: 3px; }

.galerie:has(input:disabled) { opacity: 0.45; cursor: default; }

.barre-bas {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bas) + 150px);
    padding: 0 36px calc(var(--bas) + 20px);
    background: var(--voile-noir);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.declencheur {
    width: 80px;
    height: 80px;
    padding: 0;
    border: 4px solid var(--creme);
    border-radius: 40px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.declencheur span { display: block; width: 60px; height: 60px; border-radius: 30px; background: var(--rose); transition: transform 0.15s; }

.declencheur:active span { transform: scale(0.9); }

/* ---------- 3 · première transformation */

.transformation {
    height: 100%;
    padding: calc(var(--haut) + 96px) 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.transformation img {
    width: min(310px, 100%);
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 14px;
    filter: grayscale(1) contrast(0.9);
    animation: respire 2.4s ease-in-out infinite alternate;
}

.sous-titre { margin: 40px 0 0; font-family: var(--serif); font-size: 30px; line-height: 1.2; text-align: center; }

.jauge { margin-top: 22px; width: 180px; height: 2px; border-radius: 1px; background: rgba(244, 238, 230, 0.18); overflow: hidden; }

/* la barre avance sur la durée prévue et ralentit avant la fin : elle n'annonce jamais un faux « fini » */
.jauge div { width: 0; height: 100%; background: var(--rose); animation: avance var(--duree, 10s) cubic-bezier(0.2, 0.6, 0.3, 1) forwards; }

.legende { margin: 14px 0 0; font-size: 13px; color: var(--gris); }

@keyframes avance { to { width: 92%; } }

@keyframes respire { from { opacity: 0.8; } to { opacity: 1; } }

@keyframes apparait { from { opacity: 0; } }

/* ---------- 4 · je façonne */

.toile { object-fit: cover; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }

.pastille-haut {
    position: absolute;
    left: 50%;
    top: calc(var(--haut) + 48px);
    transform: translateX(-50%);
    max-width: calc(100% - 48px);
    margin: 0;
    padding: 8px 18px;
    border-radius: 18px;
    background: var(--voile);
    color: var(--creme);
    font-family: var(--serif);
    font-size: 24px;
    line-height: 1.25;
    text-align: center;
    pointer-events: none;
}

.pastille-haut.petite { font-size: clamp(17px, 5.3vw, 22px); width: max-content; }

.progression {
    position: absolute;
    left: 32px;
    right: 32px;
    bottom: calc(var(--bas) + 34px);
    height: 3px;
    border-radius: 2px;
    background: rgba(22, 19, 42, 0.45);
    pointer-events: none;
}

.progression div { width: 0; height: 100%; border-radius: 2px; background: var(--creme); }

.anneau {
    position: absolute;
    left: -24px;
    top: -24px;
    width: 48px;
    height: 48px;
    border: 2.5px solid var(--creme);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ---------- 5 · ça m'échappe */

.revelation { padding: 0; border: none; background: var(--nuit); color: var(--creme); cursor: pointer; overflow: hidden; }

.revelation:disabled { opacity: 1; cursor: progress; }

.revelation img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.revelation .attente { animation: respire 1.8s ease-in-out infinite alternate; }

.revelation .finale { animation: apparait 1.8s ease both; }

.signature-bas {
    position: absolute;
    left: 24px;
    bottom: calc(var(--bas) + 30px);
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--voile);
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
}

.indice {
    position: absolute;
    right: 24px;
    bottom: calc(var(--bas) + 86px);
    padding: 6px 12px;
    border-radius: 14px;
    background: var(--voile);
    font-size: 13px;
    color: var(--lilas);
    animation: apparait 0.8s ease 2s both;
}

/* ---------- 6 · sortie et partage */

.sortie {
    height: 100%;
    overflow-y: auto;
    padding: calc(var(--haut) + 28px) 24px calc(var(--bas) + 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.carte { position: relative; margin: 0; height: min(380px, 46dvh); flex-shrink: 0; border-radius: 16px; overflow: hidden; }

.carte img { display: block; width: 100%; height: 100%; object-fit: cover; }

.carte figcaption {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--voile);
    font-family: var(--serif);
    font-style: italic;
    font-size: 16px;
}

.sortie .bouton-principal { margin-top: 0; }

.note { margin: -6px 0 0; font-size: 13px; text-align: center; color: var(--lilas); }

.deux-boutons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex-shrink: 0; }

.consentement { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }

.consentement input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--rose); flex-shrink: 0; }

.consentement span { font-size: 13px; line-height: 1.45; color: var(--lilas); }

.citation { margin: 0; font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.3; }

.mentions { margin: 0; font-size: 12px; color: var(--gris); }

/* ---------- grand écran (ordinateur, tablette en paysage) : l'expérience reste au format téléphone,
   posée au centre d'un fond aux couleurs de l'artiste, au lieu d'une bande sombre au milieu du noir */

@media (min-width: 720px) and (min-height: 560px) {
    html {
        background:
            radial-gradient(ellipse 55% 60% at 12% 18%, rgba(194, 71, 154, 0.28), transparent 70%),
            radial-gradient(ellipse 50% 55% at 88% 82%, rgba(92, 75, 192, 0.32), transparent 70%),
            radial-gradient(ellipse 40% 40% at 80% 10%, rgba(242, 167, 195, 0.12), transparent 70%),
            var(--noir);
        background-attachment: fixed;
    }

    body {
        background: transparent;
        height: auto;
        min-height: 100dvh;
        padding: 24px;
        display: grid;
        place-items: center;
    }

    .ecran {
        --hauteur: min(calc(100dvh - 48px), 940px);
        width: calc(var(--hauteur) * 9 / 18);
        max-width: 100%;
        height: var(--hauteur);
        margin: 0;
        border-radius: 32px;
        box-shadow: 0 0 0 1px rgba(244, 238, 230, 0.08), 0 30px 90px rgba(0, 0, 0, 0.55);
    }
}
