/* =========================================================================
   base.css — design tokens, reset et éléments communs.
   Chargé sur TOUTES les pages, avant shared-nav.css.
   Aucune règle de navbar ici : elle vit uniquement dans shared-nav.css.
   ========================================================================= */

/* --- 1. Tokens : thème clair (défaut) ---------------------------------- */
:root {
    --bg-color:        #F5F5F7;
    --bg-elevated:     #FFFFFF;
    --text-color:      #1D1D1F;
    --text-secondary:  #86868B;
    --accent-color:    #0066CC;
    --accent-soft:     rgba(0, 102, 204, 0.10);
    --nav-bg:          rgba(255, 255, 255, 0.80);
    --card-bg:         #FFFFFF;
    --submenu-bg:      #FFFFFF;
    --submenu-hover:   #F5F5F7;
    --border-color:    rgba(0, 0, 0, 0.10);
    --shadow-card:     0 20px 40px rgba(0, 0, 0, 0.08);

    /* Couleurs de marque tierces */
    --discord-color:   #5865F2;
    --twitch-color:    #9146FF;
    --success-color:   #3BA55C;
    --hot-color:       #FF2D55;

    /* Typo & rythme */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --nav-height: 60px;
    --radius-sm: 12px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --gutter: 5%;
    --maxw: 1200px;
}

/* --- 2. Tokens : thème sombre ------------------------------------------
   La classe est posée sur <html> par theme-init.js AVANT le premier rendu.
   On accepte aussi body.dark-mode pour compatibilité avec d'anciennes pages.
   ---------------------------------------------------------------------- */
:root.dark-mode,
body.dark-mode {
    --bg-color:       #000000;
    --bg-elevated:    #1C1C1E;
    --text-color:     #F5F5F7;
    --text-secondary: #A1A1A6;
    --accent-color:   #2997FF;
    --accent-soft:    rgba(41, 151, 255, 0.15);
    --nav-bg:         rgba(28, 28, 30, 0.80);
    --card-bg:        #1C1C1E;
    --submenu-bg:     #1C1C1E;
    --submenu-hover:  #2C2C2E;
    --border-color:   rgba(255, 255, 255, 0.10);
    --shadow-card:    0 20px 40px rgba(0, 0, 0, 0.45);
}

/* --- 3. Reset ---------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
    color-scheme: light;
}
html.dark-mode { color-scheme: dark; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-color); }
button { font: inherit; color: inherit; }

/* --- 4. Accessibilité -------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    background: var(--accent-color);
    color: #fff;
    padding: 12px 20px;
    border-radius: 0 0 var(--radius-sm) 0;
    text-decoration: none;
    font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* --- 5. En-tête de page réutilisable ----------------------------------- */
.page-header {
    padding: calc(var(--nav-height) + 80px) var(--gutter) 60px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}
.page-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1rem;
    line-height: 1.15;
}
.page-header p {
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--text-secondary);
}

/* --- 6. Grille de cartes générique ------------------------------------- */
.grid-container {
    padding: 0 var(--gutter) 80px;
    max-width: var(--maxw);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

/* --- 7. Boutons -------------------------------------------------------- */
.btn {
    display: inline-block;
    text-align: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}
.btn-primary { background: var(--accent-color); color: #FFF; }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }

.btn-solid { background: var(--text-color); color: var(--bg-color); width: 100%; display: block; }
.btn-solid:hover { transform: scale(1.02); opacity: 0.9; }

.btn-ghost { border-color: var(--border-color); color: var(--text-color); background: transparent; }
.btn-ghost:hover { background: var(--submenu-hover); }

/* --- 8. Animations ----------------------------------------------------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate,
.animate-fade-up {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* --- 9. Pied de page --------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem var(--gutter) 2rem;
    background: var(--bg-color);
    flex-shrink: 0;
}
.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    justify-content: space-between;
}
.footer-logo { font-weight: 600; font-size: 1.1rem; letter-spacing: -0.5px; }
.footer-tagline { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.3rem; }
.footer-nav ul, .footer-legal ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.footer-nav a, .footer-legal a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}
.footer-nav a:hover, .footer-legal a:hover { color: var(--accent-color); }
.footer-copy {
    max-width: var(--maxw);
    margin: 2.5rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* --- 10. Préférence "réduire les animations" --------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .animate, .animate-fade-up { opacity: 1; }
}
