/* En-tête, navigation (barre latérale ≥ 1024 px, tiroir en dessous), contenu, pied de page */
.skip-link {
    position: absolute;
    left: 12px;
    top: -100px;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--yellow);
    border: var(--line);
    border-radius: var(--radius-sm);
    color: var(--navy);
    font-weight: 700;
}

.skip-link:focus {
    top: 12px;
}

/* --- bandeau hors ligne (docs/spec/hors-ligne.md) -------------------------------------------------------------
   Collant en haut, au-dessus de l'en-tête ; assets/js/hors-ligne.js met sa hauteur dans --hors-ligne-h pour que
   l'en-tête collant se range dessous. Brun chaud hors ligne, vert au retour du réseau. */
.bandeau-hors-ligne {
    position: sticky;
    top: 0;
    z-index: 110;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.6rem var(--gutter);
    background: #6b5446;
    border-bottom: var(--line);
    color: var(--paper);
    font-size: 0.875rem;
}

.bandeau-hors-ligne[hidden] {
    display: none;
}

.bandeau-hors-ligne__message {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.bandeau-hors-ligne .icon {
    flex: none;
    width: 20px;
    height: 20px;
}

.bandeau-hors-ligne__date {
    font-weight: 400;
}

.bandeau-hors-ligne__recharger {
    padding: 0.125rem 0.75rem;
    border: var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--navy);
    font-weight: 700;
    cursor: pointer;
}

.bandeau-hors-ligne[data-etat="coupe"] .bandeau-hors-ligne__message--retour,
.bandeau-hors-ligne[data-etat="retour"] .bandeau-hors-ligne__message--coupe {
    display: none;
}

.bandeau-hors-ligne[data-etat="retour"] {
    background: var(--green);
    color: var(--navy);
}

/* la page entière passe en niveaux de gris sous le contenu ; l'en-tête, le bandeau et la personne tirée restent en couleur */
body.page-hors-ligne::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    -webkit-backdrop-filter: grayscale(0.4) sepia(0.15);
    backdrop-filter: grayscale(0.4) sepia(0.15);
}

body.page-hors-ligne .card--tiree {
    position: relative;
    z-index: 21;
}

/* --- en-tête ------------------------------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: var(--hors-ligne-h, 0px);
    z-index: 40;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 var(--gutter);
    background: var(--paper);
    border-bottom: var(--line);
}

.topbar__menu {
    margin-left: -6px;
}

.topbar__menu .icon {
    width: 24px;
    height: 24px;
}

.topbar__user {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    border: var(--line);
    border-radius: 999px;
    background: var(--cream);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--navy);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.topbar__user:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--navy);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cyan);
    border: 2px solid var(--navy);
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--navy);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
}

.brand__logo {
    width: 40px;
    height: 40px;
    transition: transform 0.3s var(--ease);
}

.brand:hover .brand__logo {
    transform: rotate(-12deg) scale(1.08);
}

.brand__cursor {
    display: inline-block;
    animation: cursor-blink 1.1s steps(1) infinite;
    color: var(--blue);
}

@keyframes cursor-blink {
    50% {
        opacity: 0;
    }
}

/* --- coque : barre latérale + contenu ------------------------------------------------------------------ */
.shell {
    display: flex;
    min-height: calc(100dvh - var(--header-height));
}

.sidebar {
    flex: 0 0 var(--sidebar-width);
    padding: 1.25rem 1rem 2rem;
    border-right: var(--line);
    background: var(--cream);
}

.sidebar__inner {
    position: sticky;
    top: calc(var(--header-height) + 1.25rem + var(--hors-ligne-h, 0px));
}

.nav {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 4px;
}

.nav__group {
    margin: 1.25rem 0 0.35rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav__group:first-child {
    margin-top: 0;
}

/* Titre de section qui est aussi un lien (« Mes groupes », « Tirages ») */
.nav__group a {
    color: inherit;
    text-decoration: none;
}

.nav__group a:hover,
.nav__group a[aria-current="page"] {
    color: var(--navy);
    text-decoration: underline;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-sm);
    color: var(--navy);
    font-weight: 500;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease);
}

.nav__link .icon {
    width: 1.25em;
    height: 1.25em;
}

.nav__link:hover {
    background: var(--paper);
    border-color: var(--navy);
}

.nav__link.is-active {
    background: var(--yellow);
    border-color: var(--navy);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
}

.nav__link--quiet {
    color: var(--muted);
}

/* Lien à deux lignes : le nom, et en petit le groupe d'un tirage ; les noms longs sont coupés */
.nav__link--double {
    align-items: flex-start;
}

.nav__link--double .icon {
    margin-top: 0.15em;
    flex: none;
}

.nav__texte {
    display: grid;
    min-width: 0;
}

.nav__texte > span,
.nav__texte > small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav__texte > small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--muted);
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    width: 100%;
    max-width: calc(var(--content-width) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 2rem var(--gutter) 3rem;
}

.footer {
    padding: 1.5rem var(--gutter);
    text-align: center;
    color: var(--muted);
    font-size: 0.8125rem;
}

.footer a {
    color: inherit;
}

.backdrop {
    display: none;
}

/* --- tiroir (mobile et tablette) ----------------------------------------------------------------------- */
@media (max-width: 1023.98px) {
    .sidebar {
        position: fixed;
        z-index: 60;
        top: var(--hors-ligne-h, 0px);
        bottom: 0;
        left: 0;
        width: min(300px, 86vw);
        overflow-y: auto;
        padding-top: calc(var(--header-height) + 1rem);
        border-right: var(--line);
        box-shadow: var(--shadow-lg);
        transform: translateX(calc(-100% - 12px));
        transition: transform 0.3s var(--ease);
        visibility: hidden;
    }
    .sidebar__inner {
        position: static;
    }
    .menu-ouvert .sidebar {
        transform: none;
        visibility: visible;
    }
    .backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(0, 0, 75, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }
    .menu-ouvert .backdrop {
        opacity: 1;
        pointer-events: auto;
    }
    .menu-ouvert {
        overflow: hidden;
    }
    .topbar {
        z-index: 70;
    }
}

@media (min-width: 1024px) {
    .topbar .topbar__menu {
        display: none;
    }
}

@media (max-width: 520px) {
    .topbar__user-name {
        display: none;
    }
    .topbar__user {
        padding-right: 0.25rem;
    }
}

/* --- pages sans navigation (accueil publique, connexion, inscription) ---------------------------------- */
.app--invite .content {
    max-width: calc(560px + 2 * var(--gutter));
    padding-top: clamp(2rem, 8vh, 5rem);
}

/* --- « agir pour » : bandeau et sélecteur « Je gère » ----------------------------------------------------- */
.gerance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem var(--gutter);
    background: var(--cream);
    border-bottom: var(--line);
    font-size: 0.875rem;
}

.gerance--actif {
    background: var(--yellow);
    color: var(--navy);
    font-weight: 700;
}

.gerance--agir {
    background: var(--cyan);
}

.gerance .icon {
    width: 18px;
    height: 18px;
}

.gerance__titre {
    font-weight: 700;
}

.gerance__choix {
    padding: 0.125rem 0.75rem;
    border: var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--navy);
    text-decoration: none;
}

.gerance__choix.is-active {
    background: var(--cyan);
    font-weight: 700;
}

.gerance__lien {
    margin-left: auto;
    color: var(--navy);
}
