/* Système de design « École Quiz » — base : typographie, mise en page, accessibilité, animations. */

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

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1 0 auto;
    width: 100%;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-font {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--c-ink);
}

.page-title {
    font-family: var(--font-display);
    font-weight: 800;
    margin-bottom: 1.25rem;
    letter-spacing: -.01em;
}

p, li {
    overflow-wrap: anywhere;
}

a {
    text-underline-offset: .18em;
}

img, svg, video {
    max-width: 100%;
}

code {
    color: var(--c-primary-800);
    background: var(--c-primary-50);
    padding: .1em .4em;
    border-radius: 6px;
}

.text-muted {
    color: var(--c-muted) !important;
}

/* --- Accessibilité --- */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 2000;
    padding: .75rem 1.25rem;
    border-radius: var(--r-pill);
    background: var(--c-ink);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.skip-link:focus {
    top: 1rem;
    color: #fff;
}

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

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    outline: none;
    box-shadow: var(--sh-focus);
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
}

/* --- Animations légères (désactivées si l'utilisateur préfère moins de mouvement) --- */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes pop-in {
    0% { opacity: 0; transform: scale(.85); }
    70% { opacity: 1; transform: scale(1.04); }
    100% { transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-6deg); }
    75% { transform: rotate(6deg); }
}

@keyframes bounce-in {
    0% { transform: scale(1); }
    40% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.anim-fade-up {
    animation: fade-up .5s ease both;
}

.anim-pop {
    animation: pop-in .55s var(--ease-bounce) both;
}

/* Apparition en cascade : style="--i: n" sur chaque élément. */
.stagger > * {
    animation: fade-up .45s ease both;
    animation-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Pied de page --- */
.site-footer {
    flex-shrink: 0;
    padding: 1.5rem 0 2rem;
    color: var(--c-muted);
    font-size: .875rem;
    text-align: center;
}

.min-w-0 {
    min-width: 0;
}

/*
 * Contenus arabes (dir="auto") dans une interface en français : les titres et cellules gardent
 * l'alignement de la mise en page ; le texte lui-même reste écrit de droite à gauche.
 */
td[dir="auto"],
th[dir="auto"],
.next-card h2[dir="auto"],
.score-row-title[dir="auto"],
.subject-name[dir="auto"],
.page-title[dir="auto"],
.data-table [dir="auto"] {
    text-align: left;
}
