/*
 * Le cadre commun à toutes les pages : en-tête, menu du haut, menu mobile, messages, lien d'évitement.
 * Chargé sur toutes les pages (administration comprise), avant cinema.css (les couleurs) et polish.css.
 * Les teintes reprennent celles de cinema.css, avec une valeur de secours quand la page ne le charge pas.
 */

/* ------------------------------------------------------------------ accessibilité */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* « Aller au contenu » : invisible tant qu'on ne navigue pas au clavier. */
.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 500;
    padding: .7rem 1.1rem;
    border-radius: 10px;
    background: var(--cine-gold, #e8b04b);
    color: #140f05;
    font-weight: 700;
    transform: translateY(-160%);
    transition: transform .15s ease;
}
.skip-link:focus { transform: none; outline: 2px solid #fff; outline-offset: 2px; }
.site-main:focus { outline: none; }

/* ------------------------------------------------------------------ en-tête */

.site-header { padding-inline: clamp(1rem, 4.5vw, 4rem); }

.site-header-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 64px;
    max-width: 1600px;
    margin-inline: auto;
}

.site-brand { display: flex; align-items: center; gap: .7rem; flex: none; min-width: 0; color: #fff; }
.site-brand img { width: 36px; height: 36px; border-radius: .75rem; }
.site-brand-text { display: flex; flex-direction: column; gap: .2rem; line-height: 1; }
.site-brand-text strong { font-size: 1rem; font-weight: 700; }
.site-brand-text small { font-size: .75rem; color: var(--cine-muted, #94a3b8); }

/* Le menu du haut s'affiche dès 1024 px (avant : seulement à partir de 1536 px, un portable n'avait que ☰). */
.site-nav { display: none; flex: 1; justify-content: center; align-items: center; gap: .25rem; min-width: 0; }

.nav-item { min-height: 40px; }
.nav-item > svg { width: 17px; height: 17px; flex: none; }
.nav-external { font-size: .75em; opacity: .6; margin-left: -.15rem; }

.site-account { display: flex; align-items: center; gap: .75rem; flex: none; margin-left: auto; }

.site-account-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    padding: 2px .9rem 2px 2px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: #fff;
    transition: background .2s ease, border-color .2s ease;
}
.site-account-link:hover { background: rgba(241, 236, 226, .07); }
.site-account-link.active { border-color: rgba(232, 176, 75, .35); }
.site-account-link img { width: 40px; height: 40px; flex: none; border-radius: 999px; border: 2px solid rgba(245, 158, 11, .5); object-fit: cover; }
.site-account-label { display: none; flex-direction: column; gap: .2rem; line-height: 1; }
.site-account-label strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 600; }
.site-account-label small { font-size: .75rem; color: var(--cine-muted, #94a3b8); }

.site-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    margin-right: -.4rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #fff;
}
.site-burger:hover { background: rgba(241, 236, 226, .08); }
.site-burger svg { width: 26px; height: 26px; }

@media (min-width: 768px) {
    .site-account-label { display: flex; }
}

@media (min-width: 1024px) {
    .site-nav { display: flex; }
    .site-burger { display: none; }
    /* Entre 1024 et 1279 px, la place manque : pas d'icônes dans le menu, pas de sous-titre ni de nom. */
    .site-brand-text small, .site-nav .nav-item > svg { display: none; }
    .site-account-label { display: none; }
    .site-account-link { padding-right: 2px; }
}

@media (min-width: 1280px) {
    .site-brand-text small, .site-nav .nav-item > svg { display: block; }
    .site-account-label { display: flex; }
    .site-account-link { padding-right: .9rem; }
}

@media (max-width: 480px) {
    .site-brand-text { display: none; }
    .site-account-link { padding-right: 2px; }
    .site-account-label { display: none; }
}

/* ------------------------------------------------------------------ menu mobile (tiroir à droite, sous le ☰) */

body.menu-open { overflow: hidden; }

.mobile-drawer { z-index: var(--z-drawer, 100); }

html body .mobile-drawer aside {
    inset: 0 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: min(340px, 88vw);
    padding: 1rem 1rem 1.5rem;
    overflow-y: auto;
    border-right: 0;
    border-left: 1px solid var(--cine-line, #1e293b);
    background: #0a0b0f !important;
    box-shadow: -24px 0 60px rgba(0, 0, 0, .5);
    animation: chrome-drawer-in .2s ease-out;
}

.mobile-drawer .drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .25rem; }
.mobile-drawer .drawer-brand { display: flex; width: auto; min-height: 44px; align-items: center; gap: .65rem; padding: 0 .25rem; color: #fff; }
.mobile-drawer .drawer-brand:hover { background: none; }
.mobile-drawer .drawer-brand img { border-radius: .6rem; }
.mobile-drawer .drawer-brand span { display: flex; flex-direction: column; gap: .15rem; line-height: 1.1; }
.mobile-drawer .drawer-brand small { font-size: .75rem; color: var(--cine-muted, #94a3b8); }

.mobile-drawer .drawer-close {
    width: 44px;
    height: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    color: var(--cine-ink, #fff);
}
.mobile-drawer .drawer-close svg { width: 22px; height: 22px; }

.mobile-drawer .drawer-account {
    gap: .8rem;
    padding: .7rem;
    border: 1px solid var(--cine-line, #1e293b);
    border-radius: 14px;
    background: rgba(241, 236, 226, .04);
    color: var(--cine-ink, #fff);
}
.mobile-drawer .drawer-account.is-active { border-color: rgba(232, 176, 75, .45); }
.mobile-drawer .drawer-account img { width: 44px; height: 44px; flex: none; border-radius: 999px; border: 2px solid rgba(245, 158, 11, .5); object-fit: cover; }
.mobile-drawer .drawer-account span { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.mobile-drawer .drawer-account strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-drawer .drawer-account small { font-size: .8rem; color: var(--cine-muted, #94a3b8); }

.mobile-drawer .drawer-guest p { margin: .6rem .25rem 0; font-size: .8125rem; line-height: 1.45; color: var(--cine-muted, #94a3b8); }
.mobile-drawer .drawer-guest .drawer-login { justify-content: center; min-height: 48px; border-radius: 999px; background: var(--cine-gold, #e8b04b); border: 1px solid var(--cine-gold, #e8b04b); color: #140f05; font-weight: 700; }
.mobile-drawer .drawer-guest .drawer-login svg { fill: #140f05; }
.mobile-drawer .drawer-guest .drawer-login:hover { background: var(--cine-gold-hover, #f3c46a); color: #140f05; }

.mobile-drawer .drawer-nav { display: flex; flex-direction: column; gap: .2rem; padding-top: .75rem; border-top: 1px solid var(--cine-line, #1e293b); }
.mobile-drawer .drawer-nav a { gap: .85rem; min-height: 48px; padding: .7rem .8rem; font-size: 1rem; }
.mobile-drawer .drawer-nav a svg { width: 20px; height: 20px; flex: none; opacity: .75; }
.mobile-drawer .drawer-nav a.is-active { background: rgba(232, 176, 75, .12); color: var(--cine-gold, #fbbf24); }
.mobile-drawer .drawer-nav a.is-active svg { opacity: 1; }
.mobile-drawer .drawer-nav .nav-external { margin-left: auto; }

.mobile-drawer .drawer-logout { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--cine-line, #1e293b); }
.mobile-drawer .drawer-logout button { gap: .85rem; min-height: 48px; padding: .7rem .8rem; color: var(--cine-muted, #94a3b8); }
.mobile-drawer .drawer-logout button svg { width: 20px; height: 20px; flex: none; }
.mobile-drawer .drawer-logout button:hover { color: #fca5a5; }

@keyframes chrome-drawer-in { from { transform: translateX(24px); opacity: .4; } }

/* ------------------------------------------------------------------ messages (succès, erreurs) */

.flash-stack {
    position: fixed;
    z-index: var(--z-flash, 200);
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    width: min(calc(100% - 2rem), 650px);
    pointer-events: none;
}

html body .flash-stack .flash {
    position: static;
    transform: none;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    width: 100%;
    max-width: none;
    padding: .9rem .75rem .9rem 1.1rem;
    pointer-events: auto;
    line-height: 1.45;
    animation: chrome-toast-in .25s ease-out;
}
.flash-stack .flash > p, .flash-stack .flash > div { flex: 1; margin: 0; min-width: 0; }
.flash-stack .flash.success::before { flex: none; }
html body .flash-stack .flash.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .25s ease, transform .25s ease; }

.flash-close {
    flex: none;
    width: 32px;
    height: 32px;
    margin: -.3rem 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    opacity: .7;
    font-size: .9rem;
}
.flash-close:hover { opacity: 1; background: rgba(255, 255, 255, .08); }

@keyframes chrome-toast-in { from { transform: translateY(-8px); opacity: 0; } }

@media (max-width: 767px) {
    .flash-stack { top: 70px; }
    html body .flash-stack .flash { font-size: .875rem; }
}

@media (prefers-reduced-motion: reduce) {
    html body .mobile-drawer aside, html body .flash-stack .flash, .skip-link { animation: none !important; transition: none !important; }
}
