/*
 * Feuille de style volontairement sobre.
 *
 * Les exigences qui comptent ici ne sont pas décoratives : contraste vérifié,
 * focus visible en permanence, cibles tactiles suffisantes, ordre de
 * tabulation conforme à l'ordre visuel. Voir CLAUDE.md, section Accessibilité.
 */

:root {
    --encre: #1c1a17;
    --papier: #fbfaf8;
    --trait: #cfc8bd;
    --accent: #7a3e12;
    --accent-clair: #f3ece3;
    --alerte: #8a1c1c;
}

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

body {
    margin: 0;
    background: var(--papier);
    color: var(--encre);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

main,
header,
footer {
    max-width: 68rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

header {
    border-bottom: 1px solid var(--trait);
}

footer {
    border-top: 1px solid var(--trait);
    margin-top: 3rem;
    font-size: 0.9375rem;
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.2;
}

h2 {
    margin-top: 2.5rem;
    border-bottom: 1px solid var(--trait);
    padding-bottom: 0.25rem;
}

a {
    color: var(--accent);
}

/* Le focus reste visible partout, sans exception. */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.lien-evitement {
    position: absolute;
    left: -9999px;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1rem;
    z-index: 10;
}

.lien-evitement:focus {
    left: 0;
    top: 0;
}

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

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

fieldset {
    border: 1px solid var(--trait);
    border-radius: 4px;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem 1.25rem;
}

legend {
    font-weight: 600;
    padding: 0 0.5rem;
}

label {
    display: inline-block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    max-width: 28rem;
    /* Cible tactile confortable. */
    min-height: 2.75rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--trait);
    border-radius: 4px;
    background: #fff;
    color: inherit;
    font: inherit;
}

input[type="radio"],
input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.form-help,
.help-text,
small {
    display: block;
    margin: 0.25rem 0 1rem;
    color: #55504a;
    font-size: 0.9375rem;
}

button {
    min-height: 2.75rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

button[name="ajouter_module"] {
    background: #fff;
    color: var(--accent);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 2rem;
}

caption {
    text-align: left;
    padding-bottom: 0.5rem;
    color: #55504a;
    font-size: 0.9375rem;
}

th,
td {
    border: 1px solid var(--trait);
    padding: 0.5rem 0.625rem;
    text-align: left;
    vertical-align: top;
}

thead th {
    background: var(--accent-clair);
}

tfoot th,
tfoot td {
    background: var(--accent-clair);
    font-weight: 600;
}

/* Les tableaux larges défilent dans leur boîte, jamais la page. */
section {
    overflow-x: auto;
}

/* ------------------------------------------------------------- messages */

[role="alert"],
#prerequis-bloquant {
    border-left: 4px solid var(--alerte);
    background: #fdf3f3;
    margin: 1rem 0;
    padding: 0.75rem 1rem;
}

[role="alert"]:empty {
    display: none;
}

#anomalies [role="status"] {
    border-left: 4px solid var(--accent);
    background: var(--accent-clair);
    padding: 0.75rem 1rem;
}

/* ------------------------------------------------------------------- 3D */

#scene-3d {
    background: #eeeae4;
    border: 1px solid var(--trait);
    border-radius: 4px;
    min-height: 12rem;
}

#scene-3d canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

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

