/*
 * Soul's Craft - feuille unique du site.
 * Aucun framework, aucune ressource externe. Les jetons portent les noms du monde du serveur :
 * la nuit d'ardoise, l'os des ruines, la flamme d'âme et la braise.
 */

/* Polices auto-hébergées (SIL Open Font License 1.1, textes dans assets/fonts/) */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('../fonts/cinzel-variable.woff2') format('woff2');
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/alegreya-sans-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Alegreya Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/alegreya-sans-700.woff2') format('woff2');
}

/* Replis à métriques ajustées (largeur moyenne mesurée sur les woff2 livrés, poids français) */
@font-face {
    font-family: 'Cinzel Repli';
    src: local('Georgia Bold'), local('Georgia-Bold');
    font-weight: 400 900;
    size-adjust: 110%;
    ascent-override: 88.8%;
    descent-override: 33.8%;
    line-gap-override: 0%;
}
@font-face {
    font-family: 'Alegreya Sans Repli';
    src: local('Arial'), local('ArialMT');
    font-weight: 100 500;
    size-adjust: 88.8%;
    ascent-override: 90.1%;
    descent-override: 22.5%;
    line-gap-override: 22.5%;
}
@font-face {
    font-family: 'Alegreya Sans Repli';
    src: local('Arial Bold'), local('Arial-BoldMT');
    font-weight: 600 900;
    size-adjust: 84.3%;
    ascent-override: 94.9%;
    descent-override: 23.7%;
    line-gap-override: 23.7%;
}

:root {
    /* Couleurs du monde */
    --nuit: #12161c;          /* fond : ardoise de nuit */
    --ardoise: #1a2029;       /* surfaces posées sur la nuit */
    --ardoise-haute: #232b36; /* surfaces au survol */
    --joint: #364252;         /* joints entre les blocs, filets */
    --os: #ece6d8;            /* texte principal : pierre blanchie */
    --cendre: #b3ac9f;        /* texte secondaire */
    --ame: #6fdbdc;           /* flamme d'âme, accent principal */
    --ame-profonde: #2f9fa6;  /* flamme d'âme, ombre */
    --ame-encre: #0d1a1b;     /* texte posé sur la flamme */
    --braise: #e6a356;        /* braise des foyers, accent secondaire */

    /* Typographie */
    --police-titre: 'Cinzel', 'Cinzel Repli', Georgia, 'Times New Roman', serif;
    --police-texte: 'Alegreya Sans', 'Alegreya Sans Repli', Arial, system-ui, sans-serif;
    --taille-texte: 1.1875rem;
    --mesure: 38rem;

    /* Forme : des blocs, donc aucun arrondi. La découpe en marche reprend l'angle d'un cube. */
    --marche: 6px;
    --decoupe: polygon(
        0 var(--marche), var(--marche) var(--marche), var(--marche) 0,
        calc(100% - var(--marche)) 0, calc(100% - var(--marche)) var(--marche), 100% var(--marche),
        100% calc(100% - var(--marche)), calc(100% - var(--marche)) calc(100% - var(--marche)),
        calc(100% - var(--marche)) 100%, var(--marche) 100%,
        var(--marche) calc(100% - var(--marche)), 0 calc(100% - var(--marche))
    );

    /* Espacements */
    --gouttiere: clamp(1rem, 4vw, 2.5rem);
    --respiration: clamp(4rem, 9vw, 7rem);

    color-scheme: dark;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    background: var(--nuit);
    color: var(--os);
    font-family: var(--police-texte);
    font-size: var(--taille-texte);
    line-height: 1.55;
    overflow-wrap: break-word;
}

::selection {
    background: var(--ame);
    color: var(--ame-encre);
}

html {
    scrollbar-color: var(--joint) var(--nuit);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3 {
    font-family: var(--police-titre);
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 0.6em;
    text-wrap: balance;
}

h2 {
    font-size: clamp(2rem, 4.5vw, 3rem);
}

h3 {
    font-size: 1.3rem;
    letter-spacing: 0.01em;
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--ame);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--os);
}

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

code {
    font-family: var(--police-texte);
    font-weight: 700;
}

strong {
    color: var(--os);
}

.conteneur {
    width: min(100% - 2 * var(--gouttiere), 72rem);
    margin-inline: auto;
}

.introduction {
    max-width: var(--mesure);
    color: var(--cendre);
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
}

.source {
    color: var(--cendre);
    font-size: 1rem;
    margin: 0;
}

/* Lien d'évitement */
.evitement {
    position: absolute;
    left: 1rem;
    top: -10rem;
    z-index: 10;
    background: var(--os);
    color: var(--nuit);
    padding: 0.75rem 1rem;
    font-weight: 700;
}

.evitement:focus {
    top: 1rem;
}

/* Bandeau de navigation */
.bandeau {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
    padding: 0.5rem var(--gouttiere);
    background: rgb(18 22 28 / 0.94);
    border-bottom: 1px solid var(--joint);
}

.marque {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--os);
    text-decoration: none;
    font-family: var(--police-titre);
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}

.marque img {
    image-rendering: pixelated;
}

.bandeau ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bandeau nav a {
    display: inline-block;
    padding: 0.5rem 0;
    color: var(--os);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
}

.bandeau nav a:hover {
    color: var(--ame);
    text-decoration: underline;
}

/* Bouton : un bloc découpé, couleur de la flamme */
.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.875rem;
    padding: 0.6rem 1.25rem;
    border: 0;
    background: var(--ame);
    color: var(--ame-encre);
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
    cursor: pointer;
    clip-path: var(--decoupe);
}

.bouton:focus-visible {
    outline: 3px solid var(--ame-encre);
    outline-offset: -6px;
}

@media (hover: hover) and (pointer: fine) {
    .bouton:hover {
        background: var(--os);
    }
}

.bouton:active {
    background: var(--ame-profonde);
}

.bouton[data-etat="copie"] {
    background: var(--os);
}

/* Bloc d'adresse avec copie */
.adresse {
    display: grid;
    gap: 0.35rem;
}

.adresse__libelle {
    justify-self: start;
    color: var(--cendre);
    font-size: 1rem;
}

.adresse__ligne {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.adresse__valeur {
    display: inline-block;
    padding: 0.55rem 0.9rem;
    background: var(--nuit);
    border: 2px solid var(--ame-profonde);
    color: var(--os);
    font-size: 1.15rem;
    user-select: all;
    overflow-wrap: anywhere;
}

.adresse__etat {
    min-height: 1.5em;
    margin: 0;
    color: var(--ame);
    font-size: 1rem;
}

.adresse__etat:empty {
    min-height: 0;
}

/* Ouverture */
.ouverture {
    position: relative;
    display: grid;
    align-items: end;
    min-height: min(88svh, 52rem);
    isolation: isolate;
    overflow: hidden;
}

.ouverture picture,
.ouverture__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.ouverture__image {
    object-fit: cover;
    object-position: 80% 50%;
}

.ouverture::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to top, var(--nuit) 0%, rgb(18 22 28 / 0.9) 45%, rgb(18 22 28 / 0.55) 75%, rgb(18 22 28 / 0.3) 100%);
}

.ouverture__texte {
    width: min(100% - 2 * var(--gouttiere), 72rem);
    margin: 0 auto;
    padding: 10rem 0 clamp(2.5rem, 6vw, 4.5rem);
}

.ouverture h1 {
    width: fit-content;
    font-size: clamp(2.75rem, 9vw, 5.5rem);
    line-height: 1.05;
    margin-bottom: 0.35em;
    text-shadow: 0 2px 18px rgb(0 0 0 / 0.6);
}

.ouverture__accroche {
    max-width: 34rem;
    font-size: clamp(1.2rem, 2.2vw, 1.4rem);
    margin-bottom: 1.5rem;
}

.ouverture .adresse {
    max-width: 36rem;
}

.ouverture__preuve {
    width: fit-content;
    margin: 1.25rem 0 0;
    color: var(--cendre);
    font-size: 1.05rem;
}

@media (min-width: 60rem) {
    .ouverture {
        align-items: center;
    }

    .ouverture::after {
        background:
            linear-gradient(to right, rgb(18 22 28 / 0.95) 0%, rgb(18 22 28 / 0.88) 44%, rgb(18 22 28 / 0.35) 70%, rgb(18 22 28 / 0.1) 100%),
            linear-gradient(to top, var(--nuit) 0%, rgb(18 22 28 / 0) 22%);
    }

    .ouverture__image {
        object-position: 65% 50%;
    }

    .ouverture__texte {
        padding-block: 6rem;
    }
}

/* Carrousel du haut de page.
 * Sans JavaScript : seule la première diapositive s'affiche. Avec : toutes sont empilées et
 * seule la diapositive active est opaque. */
.carrousel {
    position: absolute;
    inset: 0;
    pointer-events: none; /* le cadre laisse passer les clics vers le texte ; seules les commandes les reçoivent */
}

.carrousel__diapos {
    position: absolute;
    inset: 0;
    z-index: -2;
    margin: 0;
    padding: 0;
    list-style: none;
}

.carrousel__diapo {
    position: absolute;
    inset: 0;
}

.carrousel__diapo:not(:first-child) {
    display: none;
}

.carrousel[data-carrousel-actif] .carrousel__diapo {
    display: block;
    opacity: 0;
    visibility: hidden;
}

.carrousel[data-carrousel-actif] .carrousel__diapo[data-active] {
    opacity: 1;
    visibility: visible;
}

@media (prefers-reduced-motion: no-preference) {
    .carrousel[data-carrousel-actif] .carrousel__diapo {
        transition: opacity 1.2s ease, visibility 0s linear 1.2s;
    }

    .carrousel[data-carrousel-actif] .carrousel__diapo[data-active] {
        transition: opacity 1.2s ease, visibility 0s;
    }
}

.carrousel__commandes {
    position: absolute;
    z-index: 2;
    top: 1rem;
    right: var(--gouttiere);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgb(18 22 28 / 0.82);
    clip-path: var(--decoupe);
    pointer-events: auto;
}

.carrousel__commandes[hidden] {
    display: none;
}

.carrousel__puces {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.carrousel__puce,
.carrousel__lecture {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.carrousel__puce {
    width: 1.75rem;
}

.carrousel__puce::before {
    content: '';
    width: 0.75rem;
    height: 0.75rem;
    background: var(--nuit);
    border: 2px solid var(--os);
}

.carrousel__puce[aria-current="true"]::before {
    background: var(--ame);
    border-color: var(--ame);
}

@media (hover: hover) and (pointer: fine) {
    .carrousel__puce:hover::before {
        border-color: var(--ame);
    }
}

.carrousel__puce:focus-visible,
.carrousel__lecture:focus-visible {
    outline: 3px solid var(--braise);
    outline-offset: -3px;
}

/* Icône pause : deux barres ; lecture : triangle. Dessinées en CSS, couleur de l'os. */
.carrousel__icone {
    display: block;
    width: 0.875rem;
    height: 1rem;
    border-left: 0.3rem solid var(--os);
    border-right: 0.3rem solid var(--os);
}

.carrousel__lecture[data-pause] .carrousel__icone {
    width: 0;
    height: 0;
    border-top: 0.5rem solid transparent;
    border-bottom: 0.5rem solid transparent;
    border-left: 0.85rem solid var(--os);
    border-right: 0;
    margin-left: 0.2rem;
}

@media (min-width: 60rem) {
    .carrousel__commandes {
        top: auto;
        bottom: 1.5rem;
    }
}

/* Bandeau décoratif des pages secondaires (rempli par image-aleatoire.js) */
.vignette-monde {
    display: none;
}

.vignette-monde[data-rempli] {
    display: block;
    position: relative;
    height: clamp(9rem, 22vw, 15rem);
    overflow: hidden;
}

.vignette-monde img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vignette-monde::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--nuit) 0%, rgb(18 22 28 / 0.2) 60%, rgb(18 22 28 / 0) 100%);
}

/* Se connecter */
.connexion {
    padding-block: var(--respiration);
}

.connexion__grille {
    display: grid;
    gap: 2.5rem;
}

@media (min-width: 60rem) {
    .connexion__grille {
        grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
        align-items: start;
        gap: 4rem;
    }
}

.etapes {
    counter-reset: etape;
    display: grid;
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.etapes > li {
    counter-increment: etape;
    position: relative;
    padding-left: 4rem;
    max-width: var(--mesure);
}

.etapes > li::before {
    content: counter(etape);
    position: absolute;
    left: 0;
    top: -0.1rem;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    background: var(--ardoise);
    border: 2px solid var(--joint);
    color: var(--ame);
    font-family: var(--police-titre);
    font-weight: 700;
    font-size: 1.3rem;
    clip-path: var(--decoupe);
}

.etapes h3 {
    margin-bottom: 0.4em;
}

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

.etapes .adresse {
    margin-bottom: 0.75rem;
}

.a-savoir {
    padding: 1.75rem;
    background: var(--ardoise);
    border-top: 4px solid var(--braise);
    clip-path: var(--decoupe);
}

.a-savoir ul {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.a-savoir li {
    color: var(--cendre);
}

/* Sur le serveur */
.serveur {
    padding-block: var(--respiration);
    background: var(--ardoise);
    border-block: 1px solid var(--joint);
}

.recit {
    display: grid;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: clamp(3rem, 7vw, 5rem);
}

.recit__image img {
    width: 100%;
    clip-path: var(--decoupe);
}

.recit__texte {
    max-width: var(--mesure);
}

@media (min-width: 60rem) {
    .recit {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
        gap: 4rem;
    }

    .recit--inverse {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    }

    .recit--inverse .recit__image {
        order: 2;
    }
}

.commandes {
    display: grid;
    gap: 0.6rem;
    margin: 0;
}

.commandes div {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
}

.commandes dt code {
    color: var(--ame);
    font-size: 1.15rem;
}

.commandes dd {
    margin: 0;
    color: var(--cendre);
}

.tuiles {
    display: grid;
    gap: 1rem;
}

@media (min-width: 44rem) {
    .tuiles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tuile {
    padding: 1.75rem;
    background: var(--nuit);
    border-left: 4px solid var(--ame-profonde);
    clip-path: var(--decoupe);
}

.tuile p:not(.source) {
    color: var(--cendre);
}

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

/* Règles */
.regles {
    padding-bottom: var(--respiration);
}

.regles__image {
    display: block;
    width: min(100%, 72rem);
    margin: 0 auto;
}

.regles__image img {
    width: 100%;
    clip-path: var(--decoupe);
    max-height: 32rem;
    object-fit: cover;
    object-position: 50% 65%;
}

.regles__corps {
    margin-top: clamp(2.5rem, 6vw, 4rem);
}

.regles__liste {
    display: grid;
    gap: 1.1rem;
    max-width: var(--mesure);
    margin: 0 0 3rem;
    padding: 0;
    list-style: none;
}

.regles__liste li {
    position: relative;
    padding-left: 2.25rem;
}

/* La flamme d'âme sert de puce : un repère décoratif, l'information est dans le texte */
.regles__liste li::before {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.25rem;
    width: 0.875rem;
    height: 1.125rem;
    background: url('../img/flamme.svg') no-repeat center / contain;
    image-rendering: pixelated;
}

.reperes {
    display: grid;
    gap: 1rem;
    margin: 0;
}

@media (min-width: 44rem) {
    .reperes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.reperes div {
    padding-top: 1rem;
    border-top: 2px solid var(--joint);
}

.reperes dt {
    color: var(--cendre);
    font-size: 1rem;
}

.reperes dd {
    margin: 0.25rem 0 0;
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.35;
}

/* Pied de page */
.pied {
    padding-block: 2.5rem 3rem;
    border-top: 1px solid var(--joint);
    background: var(--ardoise);
    color: var(--cendre);
    font-size: 1rem;
}

.pied__grille {
    display: grid;
    gap: 1rem;
}

.pied__marque {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    color: var(--os);
}

.pied__marque img {
    image-rendering: pixelated;
}

.pied__liens {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pied__liens a {
    display: inline-block;
    padding-block: 0.25rem;
}

.pied__signature {
    margin: 0;
    color: var(--os);
}

.pied__signature a {
    display: inline-block;
    padding-block: 0.25rem;
}

.pied__avertissement {
    margin: 0;
}

/* Pages de texte (mentions légales, note de contenu) */
.page-texte {
    padding-block: clamp(3rem, 8vw, 5rem) var(--respiration);
}

.page-texte .conteneur {
    max-width: 46rem;
}

.page-texte h1 {
    font-size: clamp(2.25rem, 6vw, 3.25rem);
}

.page-texte h2 {
    font-size: 1.6rem;
    margin-top: 2.5rem;
}

.page-texte h3 {
    font-size: 1.2rem;
    margin-top: 1.75rem;
}

.page-texte p,
.page-texte li {
    color: var(--cendre);
}

.page-texte strong {
    color: var(--os);
}

.page-texte address {
    font-style: normal;
}

.retour {
    display: inline-block;
    margin-bottom: 2rem;
}

/* Petits écrans : la navigation passe sous la marque */
@media (max-width: 34rem) {
    .bandeau {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding-block: 0.5rem 0.25rem;
    }

    .bandeau ul {
        gap: 0 1.1rem;
    }

    .bandeau nav a {
        font-size: 1rem;
    }

    .etapes > li {
        padding-left: 3.5rem;
    }
}

/* Zone de texte temporaire du repli de copie, hors écran */
.copie-tampon {
    position: fixed;
    left: -9999px;
    top: 0;
    opacity: 0;
}
