/* Unanim RP tokens — source de vérité : /DESIGN_TOKENS.md.
   Exceptions assumées (hors palette) :
   - --discord : couleur de marque de Discord pour le bouton de connexion ;
   - --paper / --ink / --stamp-* : le pass est un objet « papier » (fond crème,
     encre foncée, tampons) ; les couleurs d'état y sont assombries pour rester
     lisibles sur fond clair. */
:root {
    --orange: #ff8c00;
    --orange-bright: #ffa733;
    --gold: #ffc107;
    --bg-0: #0d0806;
    --bg-1: #1a100a;
    --bg-2: #2a1810;
    --border: #4a2a1c;
    --text: #ffffff;
    --muted: #c7c7c7;
    --dim: #808080;
    --success: #3cb371;
    --danger: #e63946;
    --info: #4fa3d1;
    --discord: #5865f2;

    --paper: #f4ead8;
    --paper-2: #ebdcc2;
    --perf: #cbb896;
    --ink: #1a100a;
    --ink-soft: #7a6448;
    --stamp-ok: #1f7a4a;
    --stamp-no: #b3261e;
    --stamp-wait: #b45309;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }
body {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px 16px 24px;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    color: var(--text);
    /* Dégradé « Sunset » de la charte, très atténué pour garder la lecture. */
    background:
        radial-gradient(ellipse 80% 60% at 50% 115%, rgba(255, 140, 0, 0.28), transparent 70%),
        linear-gradient(180deg, var(--bg-0) 0%, var(--bg-0) 45%, #1d0f07 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ---- En-tête */
.top { text-align: center; animation: in 380ms var(--ease-out); }
.logo { display: block; width: 96px; height: 96px; margin: 0 auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5)); }
.top h1 { margin-top: 2px; font-size: 14px; font-weight: 800; letter-spacing: 0.32em; text-transform: uppercase; color: var(--muted); }

.stage { width: 100%; max-width: 540px; margin-top: 22px; display: flex; flex-direction: column; align-items: stretch; gap: 18px; }

/* ---- Le pass */
.pass {
    position: relative;
    display: grid; grid-template-columns: 1fr 150px;
    border-radius: 18px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
    overflow: hidden;
    animation: passIn 520ms var(--ease-out);
}
@keyframes passIn { from { opacity: 0; transform: translateY(18px) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
@keyframes in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.band {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--gold), var(--orange));
    font-size: 11px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink);
}
.pass-body { display: flex; gap: 18px; align-items: center; padding: 20px 22px 24px; }

.photo {
    width: 92px; height: 112px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 10px; overflow: hidden;
    background: linear-gradient(160deg, var(--paper-2), var(--perf));
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo svg { width: 58px; height: 58px; fill: var(--ink-soft); opacity: 0.55; }

.fields { min-width: 0; }
.fields dt { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.fields dd { margin: 2px 0 10px; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.fields dd:last-child { margin-bottom: 0; }
.fields dd.big { font-size: 20px; font-weight: 900; line-height: 1.15; }
.fields .status.ok { color: var(--stamp-ok); }
.fields .status.no { color: var(--stamp-no); }
.fields .status.wait { color: var(--stamp-wait); }

/* Talon détachable : pointillés + encoches. */
.stub {
    position: relative;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 10px;
    padding: 18px 16px; text-align: center;
    border-left: 3px dashed var(--perf);
    background: linear-gradient(180deg, var(--paper), var(--paper-2));
}
.stub::before, .stub::after {
    content: ''; position: absolute; left: -13px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--bg-0);
}
.stub::before { top: -11px; }
.stub::after { bottom: -11px; }
.stub .f { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); line-height: 1.4; }
.code {
    display: block; width: 100%; height: 64px;
    background: repeating-linear-gradient(90deg,
        var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 9px,
        var(--ink) 9px 10px, transparent 10px 13px, var(--ink) 13px 16px, transparent 16px 17px);
}
.pass-no { font-family: Consolas, 'Courier New', monospace; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; }

/* Pass vierge (pas encore connecté) : encre estompée. */
.pass.blank .fields dd, .pass.blank .pass-no { color: var(--ink-soft); }

/* ---- Tampon */
/* Posé sur le talon, par-dessus le code-barres : ne cache aucune information. */
.stamp {
    position: absolute; right: 8px; top: 38%;
    padding: 5px 12px;
    border: 3px solid currentColor; border-radius: 8px;
    /* Fond papier : reste lisible par-dessus les barres noires du code-barres. */
    background: rgba(244, 234, 216, 0.9);
    box-shadow: 0 0 0 2px rgba(244, 234, 216, 0.9);
    font-size: 14px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase;
    transform: rotate(-12deg);
    opacity: 0.92;
    pointer-events: none;
}
.stamp.ok { color: var(--stamp-ok); }
.stamp.no { color: var(--stamp-no); }
.stamp.wait { color: var(--stamp-wait); opacity: 0.8; }
/* Juste après une vérification : le tampon s'appose. */
.stamp.fresh { animation: stamp 520ms 300ms cubic-bezier(0.2, 0.9, 0.3, 1.3) backwards; }
@keyframes stamp {
    from { opacity: 0; transform: rotate(-12deg) scale(2.4); }
    60%  { opacity: 0.95; transform: rotate(-12deg) scale(0.94); }
    to   { opacity: 0.92; transform: rotate(-12deg) scale(1); }
}

/* ---- Résultat */
.result {
    display: flex; gap: 12px; padding: 14px 16px;
    border-radius: 12px; border: 1px solid;
    background: rgba(13, 8, 6, 0.85);
    animation: in 300ms var(--ease-out);
}
.result strong { display: block; font-size: 15px; }
.result p { margin-top: 3px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.result.ok { border-color: rgba(60, 179, 113, 0.6); }
.result.err { border-color: rgba(230, 57, 70, 0.6); }
.result.info { border-color: rgba(79, 163, 209, 0.55); }
.result-ic { flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border-radius: 9999px; display: grid; place-items: center; }
.result-ic::after { font-size: 13px; font-weight: 900; color: var(--bg-0); }
.result.ok .result-ic { background: var(--success); }
.result.ok .result-ic::after { content: '✓'; }
.result.err .result-ic { background: var(--danger); }
.result.err .result-ic::after { content: '!'; color: var(--text); }
.result.info .result-ic { background: var(--info); }
.result.info .result-ic::after { content: 'i'; }
.result-link { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--text); }

/* ---- Actions */
.actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.actions form:not(.switch) { width: 100%; }
.btn {
    width: 100%; min-height: 54px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px 20px; border: 0; border-radius: 12px;
    font: inherit; font-size: 16px; font-weight: 800; text-decoration: none; cursor: pointer;
    transition: transform 120ms ease, filter 140ms ease, box-shadow 180ms ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn:focus-visible, .link:focus-visible, .result-link:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.btn svg { width: 22px; height: 22px; fill: currentColor; flex-shrink: 0; }
.btn.discord { background: var(--discord); color: #fff; box-shadow: 0 8px 26px rgba(88, 101, 242, 0.4); }
.btn.primary { background: linear-gradient(135deg, var(--gold), var(--orange)); color: var(--bg-0); box-shadow: 0 0 28px rgba(255, 140, 0, 0.45); }
.btn.busy { pointer-events: none; filter: saturate(0.7); }
.btn.busy::before {
    content: ''; width: 16px; height: 16px; border-radius: 9999px;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin 700ms linear infinite;
}
.btn.busy svg { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.switch { font-size: 13px; color: var(--dim); }
.link { background: none; border: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--text); }

.fine { font-size: 12px; line-height: 1.6; color: var(--dim); text-align: center; }
.foot { margin-top: 22px; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }

/* ---- Téléphone : le talon passe sous le pass. */
@media (max-width: 520px) {
    .pass { grid-template-columns: 1fr; }
    .band { flex-direction: column; gap: 2px; }
    .pass-body { padding: 18px; gap: 14px; }
    .photo { width: 76px; height: 94px; }
    .fields dd.big { font-size: 18px; }
    .stub { flex-direction: row; flex-wrap: wrap; justify-content: space-between; border-left: 0; border-top: 3px dashed var(--perf); padding: 14px 18px; }
    .stub::before, .stub::after { top: -13px; left: auto; }
    .stub::before { left: -11px; }
    .stub::after { right: -11px; bottom: auto; }
    .code { order: 3; flex-basis: 100%; height: 40px; }
    .stamp { top: auto; right: 18px; bottom: 22px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
