/* Coque commune des pages "app" (fragments/nav.html) : barre latérale groupée, barre du haut, contenu.
   Tokens : tokens.css. Variantes : A (sobre) et C (Weiss / Schwarz : barre latérale inversée, bandeau, frise). */

body { font-family: var(--font-body); }
h1, h2, h3 { font-family: var(--font-title); }

.app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--shell-w);
    background: var(--bg-0); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 12px; box-sizing: border-box; overflow-y: auto;
    font-family: var(--font-body); z-index: 20;
}
.app-sidebar-logo {
    display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px;
    font: 700 18px var(--font-title); color: var(--text); text-decoration: none;
}
/* Pastille Weiss / Schwarz : moitié blanche, moitié noire, liseré d'accent. */
.app-sidebar-logo::before, .hub-logo::before {
    content: ""; width: 1.05em; height: 1.05em; border-radius: var(--radius); flex-shrink: 0;
    background: linear-gradient(135deg, #f3f3f5 50%, #0c0d10 50%); box-shadow: 0 0 0 1.5px var(--accent);
}
.app-nav-label {
    padding: 10px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--faint);
}
.app-nav {
    display: flex; align-items: center; gap: 11px; padding: 6px 10px; border-radius: var(--radius);
    color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none;
}
.app-nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-nav:hover { background: var(--bg-3); color: var(--text); }
.app-nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.app-nav .unread {
    margin-left: auto; background: var(--accent); color: var(--accent-ink);
    font: 700 11px var(--font-mono); border-radius: var(--radius); padding: 0 6px;
}
/* Sous-menu depliable (ex. Decks) : le titre se comporte comme une entree, les sous-entrees sont decalees
   sous son libelle ; le chevron tourne quand le groupe est ouvert. */
.app-nav-group { display: flex; flex-direction: column; gap: 4px; }
.app-nav-group > summary { cursor: pointer; list-style: none; user-select: none; }
.app-nav-group > summary::-webkit-details-marker { display: none; }
.app-nav-chevron { margin-left: auto; transition: transform 0.15s ease; }
.app-nav-group[open] > summary .app-nav-chevron { transform: rotate(90deg); }
.app-nav-sub { padding-left: 39px; font-size: 13.5px; }
.app-sidebar-grow { flex: 1; }

.app-sidebar-bottom {
    display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 12px;
    border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
.app-sidebar-opt { display: flex; align-items: center; gap: 6px; }
.app-sidebar-opt > span { flex: 1; }
.app-sidebar-bottom button.appearance-btn, .site-footer button.appearance-btn {
    background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 3px 9px; font: 700 11px var(--font-mono); cursor: pointer; width: auto; margin: 0;
}
.appearance-btn:hover { color: var(--accent); }
.app-sidebar-bottom .appearance-btn.on, .site-footer .appearance-btn.on { background: var(--text); color: var(--bg-1); border-color: var(--text); }
.app-sidebar-lang { display: flex; gap: 0.6rem; }
.app-sidebar-lang a { color: var(--muted); text-decoration: none; }
.app-sidebar-lang a.active { color: var(--accent); font-weight: 700; }
.app-sidebar-kofi { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); text-decoration: none; font-weight: 600; }
.app-sidebar-kofi:hover { color: var(--accent); }
.app-sidebar-account { display: flex; flex-direction: column; gap: 0.35rem; }
.app-sidebar-account button {
    background: none; border: none; padding: 0; color: var(--muted); font: inherit;
    text-decoration: underline; cursor: pointer; text-align: left;
}

/* Barre du haut : thème, alertes, compte. */
.app-topbar {
    position: fixed; top: 0; left: var(--shell-w); right: 0; height: var(--topbar-h); z-index: 15;
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 24px;
    background: var(--bg-1); border-bottom: 1px solid var(--line); font-family: var(--font-body);
}
.app-iconbtn {
    position: relative; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); color: var(--muted); padding: 0; width: 36px; margin: 0;
}
.app-iconbtn:hover { color: var(--text); border-color: var(--faint); }
.app-iconbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.app-iconbtn .dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; background: var(--accent); }
.app-avatar {
    width: 34px; height: 34px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; font: 700 13px var(--font-title); flex: none; text-decoration: none;
}
.app-username { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }

.app-content { margin-left: var(--shell-w); min-height: 100vh; padding-top: var(--topbar-h); }

/* Variante C : barre latérale inversée, frise « chaîne » sous la barre du haut, bandeau Weiss / Schwarz. */
html[data-variant="c"] .app-sidebar {
    --bg-0: var(--inv-bg); --bg-3: var(--inv-bg3); --line: var(--inv-line); --text: var(--inv-text);
    --muted: var(--inv-muted); --faint: var(--inv-muted); --accent: var(--inv-accent);
    --accent-soft: var(--inv-accent-soft); --accent-ink: var(--inv-accent-ink);
    background: var(--inv-bg); color: var(--inv-text);
}
html[data-variant="c"] .app-sidebar-logo { text-transform: uppercase; letter-spacing: .1em; font-size: 15px; }
html[data-variant="c"] .app-nav.active { background: var(--inv-text); color: var(--inv-bg); }
html[data-variant="c"] .app-sidebar-bottom .appearance-btn.on { background: var(--inv-text); color: var(--inv-bg); border-color: var(--inv-text); }
html[data-variant="c"] .app-topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 4px;
    background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 14px);
}
html[data-variant="c"] .app-content::before {
    content: "WEISS \00B7  SCHWARZ"; display: block; box-sizing: border-box; margin: 0 24px 0 auto;
    width: min(38%, 420px); height: 44px; padding: 0 14px 6px 0; text-align: right; align-content: end;
    background: linear-gradient(115deg, transparent 0 22%, var(--text) 22% 100%); color: var(--bg-1);
    font: 700 11px var(--font-mono); letter-spacing: .2em;
}
html[data-variant="c"] h1 { text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 820px) {
    .app-sidebar {
        position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
        border-right: none; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px;
    }
    .app-nav-label, .app-sidebar-grow { display: none; }
    .app-sidebar-logo { padding: 0 10px 0 4px; }
    .app-nav { white-space: nowrap; padding: 5px 8px; font-size: 13px; }
    .app-nav svg { display: none; }
    .app-nav-group { flex-direction: row; flex-wrap: wrap; }
    .app-nav-sub { padding-left: 8px; }
    .app-sidebar-bottom { flex-direction: row; flex-wrap: wrap; align-items: center; border-top: none; margin: 0 0 0 auto; padding: 0; }
    .app-topbar { position: static; padding: 8px 14px; }
    .app-content { margin-left: 0; padding-top: 0; }
    html[data-variant="c"] .app-content::before, html[data-variant="c"] .app-topbar::after { display: none; }
}

/* Bouton wishlist (fragment wishlist/toggle) : coeur seul sur les tuiles, coeur + libellé dans le panneau. */
.wish-toggle { display: inline-flex; margin: 0; }
.wish-btn {
    display: inline-flex; align-items: center; gap: 0.4rem; background: transparent;
    border: 1px solid var(--border); color: var(--muted); border-radius: var(--radius);
    padding: 0.3rem 0.5rem; font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.wish-btn:hover { border-color: var(--accent); color: var(--accent); }
.wish-btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Cartes foil (raretes brillantes, cf. FoilRarities) : reflet arc-en-ciel fixe + trait de lumiere qui balaie
   la carte. La classe se pose sur le cadre de la miniature (qui porte sa taille), l'image reste dessous.
   Seul le transform est anime : composite par le GPU, sans repeindre l'image ni declencher de mise en page. */
.foil { position: relative; overflow: hidden; isolation: isolate; }
.foil::before, .foil::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
}
.foil::before {
    background: repeating-linear-gradient(125deg, #ff5ea8 0, #ffd36b 12%, #6bffb8 24%, #5ec8ff 36%, #b98bff 48%, #ff5ea8 60%);
    mix-blend-mode: overlay; opacity: 0.42;
}
.foil::after {
    background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, 0.5) 50%, transparent 62%);
    transform: translateX(-100%);
    animation: foil-sweep 5s ease-in-out infinite;
}
@keyframes foil-sweep {
    0% { transform: translateX(-100%); }
    30%, 100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
    .foil::after { animation: none; opacity: 0; }
}
