/* Le monde du coffret de voyage : feutrine, noyer, érable, laiton, et la nacre des cases jouables.
   La nacre ne sert qu'aux cases jouables ; le rouge sang-de-bœuf ne sert qu'à l'échec. */

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("polices/atkinson-hyperlegible-next-latin.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

@font-face {
    font-family: "Marcellus SC";
    src: url("polices/marcellus-sc-latin.woff2") format("woff2");
    font-display: swap;
}

:root {
    color-scheme: dark;

    --feutrine-950: #0b1f15;
    --feutrine-900: #11301f;
    --feutrine-800: #163a26;
    --feutrine-700: #1c4730;
    --feutrine-600: #23573b;

    --noyer-950: #170d07;
    --noyer-900: #24160d;
    --noyer-800: #352014;
    --noyer-700: #4a2d1b;
    --noyer-600: #5f3a23;
    --noyer-500: #79492b;

    --erable-100: #f6e8c8;
    --erable-200: #efdcb2;
    --erable-300: #e2c48e;
    --erable-400: #d0aa6f;

    --laiton-100: #f8ecc4;
    --laiton-200: #efd998;
    --laiton-300: #e0c174;
    --laiton-400: #c9a24c;
    --laiton-500: #a9832f;
    --laiton-700: #6f5419;

    --ivoire: #f5eedc;
    --ivoire-doux: #cfc5ad;
    --ivoire-pale: #9d9480;

    --sang: #a3221b;
    --sang-lueur: rgb(222 52 38 / 0.78);

    --nacre-1: #fffdf7;
    --nacre-2: #dcebf0;
    --nacre-3: #f2dfea;
    --nacre-4: #e5f0dc;

    --police-ui: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
    --police-gravee: "Marcellus SC", "Atkinson Hyperlegible Next", Georgia, serif;

    /* La barre de noyer a une hauteur fixe : le plateau se taille sur ce qui reste de l'écran. */
    --barre: calc(56px + env(safe-area-inset-top, 0px));

    --rayon: 10px;
    --rayon-petit: 6px;
    --courbe-pose: cubic-bezier(0.2, 0.8, 0.2, 1);
    --courbe-sortie: cubic-bezier(0.4, 0, 0.2, 1);

    /* Les matières sont des tuiles tissées par outils/matieres/generer.sh (ImageMagick, graines fixes).
       Leurs url() s'écrivent en toutes lettres dans chaque feuille ; --laiton, qui en porte une, ne
       sert que dans celle-ci. */
    --veinage-noyer: repeating-linear-gradient(92deg, rgb(0 0 0 / 0.16) 0 2px, transparent 2px 7px, rgb(255 220 170 / 0.05) 7px 8px, transparent 8px 15px);
    /* Laiton brossé : la tuile s'étire à la hauteur de la plaque, ses chanfreins avec elle. */
    --laiton: url("matieres/laiton-brosse.webp") 0 0 / auto 100% repeat-x var(--laiton-300);
    --gravure: 0 1px 0 rgb(255 244 210 / 0.5), 0 -1px 0 rgb(70 45 8 / 0.32);
}

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

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

body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--police-ui);
    font-size: 1rem;
    line-height: 1.45;
    color: var(--ivoire);
    background: url("matieres/feutrine.webp") var(--feutrine-700);
}

/* La lumière tombe d'en haut sur la feutrine. Elle est fixée à l'écran par un calque, pas par
   background-attachment: fixed, qu'iOS ignore et qui coupe le dégradé sur une page longue. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(130% 100% at 50% 0%, rgb(255 246 220 / 0.05) 0%, transparent 45%, rgb(0 0 0 / 0.22) 100%);
}

a {
    color: var(--laiton-200);
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--laiton-100);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.15;
    font-weight: 700;
    text-wrap: balance;
}

h1:focus {
    outline: none;
}

p {
    margin: 0;
    text-wrap: pretty;
}

button {
    font: inherit;
}

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

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

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

.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 44px;
    padding: 0.55em 1.1em;
    border: 1px solid transparent;
    border-radius: var(--rayon);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 120ms var(--courbe-pose), background-color 160ms, border-color 160ms, box-shadow 160ms;
}

.bouton:active:not(:disabled) {
    transform: translateY(1px) scale(0.985);
}

.bouton:disabled {
    cursor: default;
    opacity: 0.55;
}

.bouton svg {
    width: 1.25em;
    height: 1.25em;
    flex: none;
}

/* Le laiton : l'action principale. */
.bouton-laiton {
    color: var(--noyer-900);
    background: var(--laiton);
    border-color: var(--laiton-700);
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
    text-shadow: var(--gravure);
}

.bouton-laiton:hover:not(:disabled) {
    color: var(--noyer-950);
    filter: brightness(1.06);
}

/* Le feutre : les actions secondaires, posées sur la feutrine. */
.bouton-feutre {
    color: var(--ivoire);
    background: rgb(255 255 255 / 0.04);
    border-color: rgb(224 193 116 / 0.42);
}

.bouton-feutre:hover:not(:disabled) {
    color: var(--ivoire);
    background: rgb(255 255 255 / 0.08);
    border-color: var(--laiton-300);
}

.bouton-compact {
    min-height: 40px;
    padding: 0.45em 0.8em;
    font-size: 0.95rem;
}

/* ------------------------------------------------------------------ plaques de laiton */

.plaque-laiton {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.28em 1.15em 0.22em;
    color: var(--noyer-900);
    font-family: var(--police-gravee);
    letter-spacing: 0.06em;
    background: var(--laiton);
    border-radius: 3px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.55);
    text-shadow: var(--gravure);
}

/* Les deux vis de la plaque. */
.plaque-laiton::before,
.plaque-laiton::after {
    content: "";
    position: absolute;
    top: 50%;
    width: max(6px, 0.36em);
    height: max(6px, 0.36em);
    transform: translateY(-50%);
    background: url("matieres/vis.webp") center / contain no-repeat;
}

.plaque-laiton::before {
    left: 0.38em;
}

.plaque-laiton::after {
    right: 0.38em;
}

/* La couronne d'un défi d'Apprendre réussi sans faute (Components/Apprendre/Couronne.razor). */
.couronne {
    display: inline-block;
    flex: none;
    width: 1.2em;
    height: 1.2em;
    color: var(--laiton-200);
    vertical-align: -0.2em;
}

/* ------------------------------------------------------------------ surfaces */

.encart {
    background: rgb(8 24 16 / 0.45);
    border: 1px solid rgb(224 193 116 / 0.16);
    border-radius: var(--rayon);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.03);
}

/* Le logement creusé dans la feutrine, où se couchent les pièces prises : plus sombre que le fond,
   avec sa paroi d'ombre en haut et le liseré de lumière de son bord bas. */
.logement {
    background: linear-gradient(rgb(0 0 0 / 0.36), rgb(0 0 0 / 0.26)), url("matieres/feutrine.webp") var(--feutrine-800);
    border-radius: var(--rayon-petit);
    box-shadow:
        inset 0 3px 7px rgb(0 0 0 / 0.62),
        inset 0 -1px 0 rgb(255 255 255 / 0.05),
        0 1px 0 rgb(255 255 255 / 0.06);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.8rem 1.2rem;
    color: var(--noyer-900);
    background: var(--laiton-200);
    box-shadow: 0 -2px 12px rgb(0 0 0 / 0.4);
}

#blazor-error-ui .dismiss {
    float: right;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -0.6rem -0.8rem -0.6rem 0.5rem;
    padding: 0;
    color: inherit;
    background: none;
    border: 0;
    border-radius: var(--rayon-petit);
    cursor: pointer;
}

#blazor-error-ui .dismiss svg {
    width: 1.25rem;
    height: 1.25rem;
}

.blazor-error-boundary {
    padding: 1rem;
    color: var(--ivoire);
    background: var(--noyer-800);
    border-radius: var(--rayon);
}

.blazor-error-boundary::after {
    content: "Une erreur est survenue.";
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }

    .bouton {
        transition: none;
    }
}

/* ------------------------------------------------------------------ la bulle « lien copié » */

.bulle {
    position: fixed;
    left: 50%;
    bottom: max(1.25rem, env(safe-area-inset-bottom));
    z-index: 900;
    max-width: calc(100vw - 2rem);
    padding: 0.7rem 1.1rem;
    color: var(--noyer-900);
    font-weight: 700;
    background: var(--laiton);
    border-radius: var(--rayon);
    box-shadow: 0 10px 28px rgb(0 0 0 / 0.45);
    opacity: 0;
    transform: translate(-50%, 10px);
    pointer-events: none;
    transition: opacity 180ms, transform 220ms var(--courbe-pose);
}

.bulle.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}
