/* ============================================================
   InfoHub CPNV — L'Assoce Info
   Design System v2 — Blue/Navy + Dark Mode
   Fonts: Unbounded (display) + Outfit (body)
   ============================================================ */

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

/* ── LIGHT MODE (default) ── */
:root {
    --navy:        #1a365d;
    --navy-dark:   #12284a;
    --navy-light:  #2c5282;
    --blue:        #3182ce;
    --blue-light:  #63b3ed;
    --blue-pale:   #ebf4ff;
    --blue-bg:     #f0f7ff;

    --bg:          #ffffff;
    --bg-alt:      #f7fafc;
    --bg-card:     #ffffff;
    --surface:     #edf2f7;
    --surface-h:   #e2e8f0;
    --border:      #e2e8f0;
    --border-dark: #cbd5e0;

    --text:        #1a202c;
    --text-body:   #2d3748;
    --muted:       #718096;
    --muted-light: #a0aec0;

    --green:       #38a169;
    --green-bg:    #f0fff4;
    --yellow:      #d69e2e;
    --yellow-bg:   #fffff0;
    --red:         #e53e3e;
    --red-bg:      #fff5f5;

    --shadow-sm:   0 1px 2px rgba(0,0,0,.05);
    --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --shadow-blue: 0 4px 14px rgba(49,130,206,.25);

    --header-bg:   var(--navy);
    --header-shadow: 0 2px 8px rgba(26,54,93,.3);
    --footer-bg:   var(--navy);

    --radius:      8px;
    --radius-lg:   12px;
    --max-width:   1140px;

    --f-display: 'Unbounded', sans-serif;
    --f-body:    'Outfit', sans-serif;

    color-scheme: light;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
    --navy:        #63b3ed;
    --navy-dark:   #90cdf4;
    --navy-light:  #4299e1;
    --blue:        #63b3ed;
    --blue-light:  #90cdf4;
    --blue-pale:   rgba(99,179,237,.1);
    --blue-bg:     rgba(99,179,237,.05);

    --bg:          #0d1117;
    --bg-alt:      #161b22;
    --bg-card:     #1c2333;
    --surface:     #21262d;
    --surface-h:   #30363d;
    --border:      #30363d;
    --border-dark: #484f58;

    --text:        #e6edf3;
    --text-body:   #c9d1d9;
    --muted:       #8b949e;
    --muted-light: #6e7681;

    --green:       #3fb950;
    --green-bg:    rgba(63,185,80,.1);
    --yellow:      #d29922;
    --yellow-bg:   rgba(210,153,34,.1);
    --red:         #f85149;
    --red-bg:      rgba(248,81,73,.1);

    --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
    --shadow:      0 1px 3px rgba(0,0,0,.4);
    --shadow-md:   0 4px 6px rgba(0,0,0,.4);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.5);
    --shadow-blue: 0 4px 14px rgba(99,179,237,.2);

    --header-bg:   #161b22;
    --header-shadow: 0 1px 0 #30363d;
    --footer-bg:   #161b22;

    color-scheme: dark;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--f-body);
    background: var(--bg-alt);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background .3s, color .3s;
}

a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--navy); }

img { max-width: 100%; height: auto; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */

.theme-toggle {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.8);
    border-radius: 6px;
    padding: .35rem .55rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s;
    margin-left: .5rem;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255,255,255,.2);
    border-color: rgba(255,255,255,.3);
}

[data-theme="dark"] .theme-toggle {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255,255,255,.12);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }

:root .theme-toggle .icon-moon { display: inline; }
:root .theme-toggle .icon-sun  { display: none; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */

.site-header {
    background: var(--header-bg);
    color: #fff;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--header-shadow);
    transition: background .3s, box-shadow .3s;
}

[data-theme="dark"] .site-header {
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 64px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #ffffff !important;
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-right: auto;
    opacity: 1 !important;
    text-decoration: none;
}

.logo img {
    height: 38px;
    width: auto;
    border-radius: 4px;
}

.logo span {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo .logo-sub {
    font-size: .55rem;
    font-weight: 400;
    opacity: .65;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    align-items: center;
    height: 64px;
    gap: 0;
}

.main-nav a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    color: rgba(255,255,255,.7);
    font-family: var(--f-display);
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: color .15s, background .15s;
    opacity: 1;
    position: relative;
    text-decoration: none;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%; right: 50%;
    height: 3px;
    background: var(--blue-light);
    border-radius: 3px 3px 0 0;
    transition: left .2s, right .2s;
}

.main-nav a:hover {
    color: #ffffff;
    background: rgba(255,255,255,.08);
    opacity: 1;
}

.main-nav a:hover::after { left: .75rem; right: .75rem; }

/* Logout button styled comme un lien de nav */
.main-nav .logout-form {
    display: inline-flex;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
}
.main-nav .nav-logout {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    background: transparent;
    border: 0;
    color: rgba(255,255,255,.7);
    font-family: var(--f-display);
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .15s, background .15s;
}
.main-nav .nav-logout:hover {
    color: #ffffff;
    background: rgba(255,255,255,.08);
}

/* ============================================================
   HERO / BANNER
   ============================================================ */

.hero {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #3182ce 100%);
    color: #ffffff;
    padding: 2rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1c2333 100%);
    border-bottom: 1px solid var(--border);
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,179,237,.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(99,179,237,.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-banner { display: none; }

.hero .hero-logo {
    width: 80px; height: 80px;
    border-radius: var(--radius-lg);
    margin: 0 auto 1.25rem;
    display: block;
    background: #fff;
    padding: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.hero h1 {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    line-height: 1.1;
    margin-bottom: .75rem;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.hero p {
    font-family: var(--f-body);
    font-size: 1rem;
    color: rgba(255,255,255,.75);
    font-weight: 400;
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
    animation: fadeUp .4s ease-out both;
    flex: 1;
    width: 100%;
}

.main-content > h1 {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.main-content > h1::before {
    content: '';
    display: inline-block;
    width: 4px; height: 22px;
    background: var(--blue);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ============================================================
   SECTIONS
   ============================================================ */

.section { margin-bottom: 2.5rem; }

.section h2 {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .65rem;
    color: var(--muted);
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .6rem;
    text-transform: uppercase;
    letter-spacing: .15em;
}

.section h2::before {
    content: '';
    display: inline-block;
    width: 16px; height: 1px;
    background: var(--blue);
    flex-shrink: 0;
}

.see-all {
    margin-left: auto;
    font-family: var(--f-display);
    font-size: .58rem;
    color: var(--blue);
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.see-all:hover { opacity: .7; }

/* ── Contest section ── */

.contest-section {
    background: var(--blue-pale);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
}

.contest-section h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: .75rem;
    color: var(--text);
}

.contest-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    transition: none !important;
    transform: none !important;
}

.contest-card:hover { background: transparent !important; transform: none !important; }

.contest-card h3 {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .9rem;
    color: var(--text);
    margin-bottom: .4rem;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.contest-card > p,
.contest-card .card-body > p {
    color: var(--text-body);
    font-size: .9rem;
    margin-bottom: .75rem;
}

/* ── Pubs section ── */

.pubs-section {
    border-top: 1px dashed var(--border);
    padding-top: 2rem;
}

.pubs-section h2 { color: var(--muted-light); }
.pubs-section h2::before { background: var(--muted-light); }

/* ============================================================
   CARD GRID
   ============================================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s, border-color .2s;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--blue);
}

.card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

[data-theme="dark"] .card img {
    filter: brightness(.9) saturate(.9);
}

.card-body {
    padding: 1.1rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.card-body h3 {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .78rem;
    color: var(--text);
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.card-body p {
    font-size: .875rem;
    color: var(--muted);
    flex: 1;
    line-height: 1.6;
    font-weight: 300;
}

/* ── Meta, tags, price ── */

.meta {
    font-family: var(--f-display);
    font-size: .55rem;
    color: var(--muted);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tag {
    display: inline-flex;
    align-items: center;
    font-family: var(--f-display);
    font-size: .55rem;
    font-weight: 700;
    color: var(--blue);
    border: 1px solid var(--border);
    padding: .2rem .55rem;
    border-radius: 2px;
    background: var(--blue-pale);
    align-self: flex-start;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.price {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .8rem;
    color: var(--blue);
    letter-spacing: .02em;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1.1rem;
    background: var(--blue);
    color: #ffffff;
    border: 1px solid var(--blue);
    border-radius: 2px;
    cursor: pointer;
    font-family: var(--f-display);
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    transition: background .15s, box-shadow .15s, transform .1s, border-color .15s;
    align-self: flex-start;
    white-space: nowrap;
    text-decoration: none;
    opacity: 1;
}

.btn:hover {
    background: var(--navy-light);
    border-color: var(--navy-light);
    box-shadow: var(--shadow-blue);
    color: #fff;
    opacity: 1;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn:hover {
    background: #4299e1;
    border-color: #4299e1;
}

.btn-sm {
    padding: .38rem .75rem;
    font-size: .56rem;
}

.btn-active,
.btn.btn-active {
    background: var(--navy);
    color: #ffffff;
    border-color: var(--navy);
}

[data-theme="dark"] .btn-active,
[data-theme="dark"] .btn.btn-active {
    background: var(--blue);
    border-color: var(--blue);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-dark);
    box-shadow: none;
    transform: none;
}

.btn-outline {
    background: transparent;
    color: var(--blue);
    border-color: var(--blue);
}

.btn-outline:hover {
    background: var(--blue);
    color: #fff;
}

/* ============================================================
   AUTH FORMS
   ============================================================ */

.auth-form {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-form h1 {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: .9rem;
    color: var(--text);
    margin-bottom: 1.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.auth-form h1::before {
    content: '';
    display: inline-block;
    width: 16px; height: 2px;
    background: var(--blue);
    flex-shrink: 0;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1.1rem;
    font-family: var(--f-display);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.auth-form input {
    padding: .7rem .85rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: .9rem;
    font-family: var(--f-body);
    color: var(--text);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}

.auth-form input::placeholder { color: var(--muted-light); }

.auth-form .btn {
    width: 100%;
    justify-content: center;
    margin-top: .5rem;
    padding: .7rem;
    font-size: .62rem;
}

.auth-form p {
    margin-top: 1rem;
    font-size: .82rem;
    color: var(--muted);
    text-align: center;
}

.auth-form p a { color: var(--blue); font-weight: 600; }

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: .7rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-family: var(--f-display);
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    line-height: 1.6;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid currentColor;
    border-color: rgba(229,62,62,.25);
}

.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid currentColor;
    border-color: rgba(56,161,105,.25);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty {
    grid-column: 1 / -1;
    color: var(--muted);
    font-family: var(--f-display);
    font-size: .6rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3rem;
    text-align: center;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    background: var(--footer-bg);
    color: rgba(255,255,255,.5);
    padding: 1.5rem 2rem;
    text-align: center;
    font-family: var(--f-display);
    font-size: .55rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-top: 2rem;
    transition: background .3s;
}

[data-theme="dark"] .site-footer {
    border-top: 1px solid var(--border);
}

.site-footer a { color: var(--blue-light); }

/* ============================================================
   FORM CARD
   ============================================================ */

.form-card {
    max-width: 640px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-md);
}

.form-card h1 {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: .9rem;
    color: var(--text);
    margin-bottom: 1.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-card h1::before {
    content: '';
    display: inline-block;
    width: 16px; height: 2px;
    background: var(--blue);
    flex-shrink: 0;
}

.form-card label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1.1rem;
    font-family: var(--f-display);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.form-card input,
.form-card textarea,
.form-card select {
    padding: .7rem .85rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: .9rem;
    font-family: var(--f-body);
    color: var(--text);
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}

.form-card textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

.form-card select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233182ce' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.5rem;
}

.form-card select option {
    background: var(--bg);
    color: var(--text);
}

.form-card input[type="file"] {
    cursor: pointer;
    color: var(--muted);
    font-size: .82rem;
    padding: .55rem .85rem;
}

.form-card input[type="file"]::file-selector-button {
    background: var(--blue-pale);
    border: 1px solid var(--border);
    color: var(--blue);
    font-family: var(--f-display);
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .3rem .7rem;
    border-radius: 2px;
    cursor: pointer;
    margin-right: .6rem;
    transition: background .15s, color .15s;
}

.form-card input[type="file"]::file-selector-button:hover {
    background: var(--blue);
    color: #fff;
}

.form-card input:focus,
.form-card textarea:focus,
.form-card select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}

.form-card input::placeholder,
.form-card textarea::placeholder { color: var(--muted-light); }

.form-hint {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: .78rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
    margin-left: .25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin-top: .75rem;
}

/* Checkbox label inline dans les formulaires */
.label-inline {
    flex-direction: row !important;
    align-items: center;
    gap: .5rem !important;
    margin-bottom: 1.1rem;
}
.label-inline input[type="checkbox"] {
    width: auto;
    accent-color: var(--blue);
}

/* Pub card cliquable */
.pub-card--link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform .15s, box-shadow .15s;
}
.pub-card--link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

/* ============================================================
   ARTICLE / AD DETAIL
   ============================================================ */

.article-single { max-width: 740px; margin: 0 auto; }

.article-cover {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    background: var(--bg-alt);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.article-cover-link {
    display: block;
    cursor: zoom-in;
    margin-bottom: 1.5rem;
}
.article-cover-link .article-cover { margin-bottom: 0; }
.article-cover-link:hover .article-cover { border-color: var(--blue); }

[data-theme="dark"] .article-cover { filter: brightness(.9); }

.article-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.article-header h1 {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--text);
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.article-body {
    font-size: .95rem;
    color: var(--text-body);
    line-height: 1.8;
    font-weight: 300;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    margin-bottom: 2rem;
}

.article-footer {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    margin-top: 1rem;
}

.ad-meta-box {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    background: var(--blue-pale);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.ad-meta-item { display: flex; flex-direction: column; gap: .2rem; }

.ad-meta-label {
    font-family: var(--f-display);
    font-size: .52rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
}

/* ============================================================
   COMMENTS
   ============================================================ */

.comments-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.comments-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: .65rem;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    text-transform: uppercase;
    letter-spacing: .15em;
}

.comments-title::before {
    content: '';
    display: inline-block;
    width: 16px; height: 1px;
    background: var(--blue);
    flex-shrink: 0;
}

.comment {
    border-left: 2px solid var(--border);
    padding: .6rem .9rem;
    margin-bottom: .6rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--bg-alt);
    transition: border-left-color .15s;
}

.comment:hover { border-left-color: var(--blue); }
.comment p { font-size: .875rem; color: var(--text-body); line-height: 1.6; }

.comment-form {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.comment-form label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-family: var(--f-display);
    font-size: .56rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.comment-form textarea {
    padding: .7rem .85rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: .9rem;
    font-family: var(--f-body);
    color: var(--text);
    width: 100%;
    resize: vertical;
    min-height: 90px;
    transition: border-color .15s, box-shadow .15s;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(49,130,206,.15);
}

/* ============================================================
   ADMIN
   ============================================================ */

.admin-filters {
    display: flex; gap: .5rem; flex-wrap: wrap;
    align-items: center; margin-bottom: 1.5rem;
}

.admin-count {
    background: var(--blue-pale);
    color: var(--blue);
    font-size: .55rem; font-weight: 700;
    font-family: var(--f-display);
    padding: .12rem .45rem; border-radius: 10px;
    letter-spacing: .05em;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.admin-table {
    width: 100%; border-collapse: collapse;
    font-size: .85rem; background: var(--bg-card);
}

.admin-table thead tr {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.admin-table th {
    font-family: var(--f-display);
    font-size: .52rem; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); padding: .8rem 1rem;
    text-align: left; white-space: nowrap;
}

.admin-table td {
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text-body);
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--surface); }

.admin-id { font-family: var(--f-display); font-size: .6rem; color: var(--muted); letter-spacing: .06em; width: 40px; }
.admin-title { font-family: var(--f-display); font-size: .72rem; font-weight: 600; letter-spacing: .02em; color: var(--text); display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.admin-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.admin-actions form { margin: 0; }

.status-badge {
    font-family: var(--f-display);
    font-size: .52rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    padding: .18rem .5rem; border-radius: 2px; border: 1px solid;
}

.status-pending   { color: var(--yellow); border-color: currentColor; background: var(--yellow-bg); }
.status-published { color: var(--green);  border-color: currentColor; background: var(--green-bg); }
.status-hidden    { color: var(--muted);  border-color: var(--border); background: var(--surface); }

.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #2f855a; border-color: #2f855a; }

.btn-warn { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.btn-warn:hover { background: #b7791f; border-color: #b7791f; }

.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ============================================================
   ERROR PAGES (404 / 500)
   ============================================================ */

.error-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg-alt); padding: 2rem;
}
.error-box {
    text-align: center; max-width: 480px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 3rem 2rem;
    box-shadow: var(--shadow-lg);
}
.error-code {
    font-family: var(--f-display); font-size: 4rem; font-weight: 900;
    color: var(--blue); line-height: 1; margin: 0 0 .5rem;
}
.error-title {
    font-family: var(--f-display); font-size: .9rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: var(--text); margin: 0 0 1rem;
}
.error-msg { color: var(--muted); margin: 0 0 1.75rem; font-size: .95rem; }

/* ============================================================
   HERO — fix: pleine largeur sans inline style
   ============================================================ */

.hero--full {
    margin-left: calc(-1 * var(--page-px, 2rem));
    margin-right: calc(-1 * var(--page-px, 2rem));
    margin-bottom: 2rem;
    width: calc(100% + 2 * var(--page-px, 2rem));
    max-width: none;
}

/* ============================================================
   ACCESSIBILITÉ — Skip link, focus visible, reduced motion
   ============================================================ */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--navy);
    color: #fff;
    padding: .75rem 1rem;
    font-family: var(--f-display);
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    border-radius: 0 0 6px 0;
    z-index: 1000;
    text-decoration: none;
}
.skip-link:focus { left: 0; outline: 2px solid #fff; outline-offset: -4px; }

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 3px;
}
.btn:focus-visible, .main-nav a:focus-visible, .nav-logout:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   NAV MOBILE — Hamburger toggle
   ============================================================ */

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    padding: .45rem .55rem;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   RESPONSIVE — Mobile-first: M(≤640), T(≤1024), D(≤1280)
   ============================================================ */

/* ≤ 1280 : légers ajustements large-desktop → desktop */
@media (max-width: 1280px) {
    .main-content { padding: 2rem 1.5rem 3rem; }
}

/* ≤ 1024 : tablette paysage */
@media (max-width: 1024px) {
    .site-header { padding: 0 1.25rem; }
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .main-nav a { padding: 0 .75rem; font-size: .58rem; }
    .hero { padding: 1.5rem 1.5rem; }
    .topic-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ≤ 768 : tablette portrait — activation nav mobile */
@media (max-width: 768px) {
    .site-header { padding: 0 1rem; }
    .header-inner { height: 56px; gap: .5rem; }

    .nav-toggle { display: flex; order: 2; margin-left: auto; }
    #theme-toggle { order: 3; }

    .main-nav {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        height: auto;
        background: var(--header-bg);
        padding: .5rem 0;
        gap: 0;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid rgba(255,255,255,.08);
    }
    .main-nav.is-open { display: flex; }
    .main-nav a,
    .main-nav .nav-logout {
        height: auto;
        padding: .9rem 1.25rem;
        font-size: .7rem;
        letter-spacing: .08em;
        width: 100%;
        text-align: left;
    }
    .main-nav a::after { display: none; }
    .main-nav .logout-form { width: 100%; height: auto; }

    .hero { padding: 1.25rem 1.25rem; }
    .hero h1 { font-size: clamp(1.25rem, 5vw, 1.8rem); }
    .main-content { padding: 1.5rem 1.25rem; }
    .contest-section { padding: 1rem 1.25rem; }
    .admin-filters { flex-wrap: wrap; }
    .ad-meta-box { gap: 1rem; }
}

/* ≤ 640 : smartphone */
@media (max-width: 640px) {
    .card-grid { grid-template-columns: 1fr; }
    .logo { font-size: .68rem; }
    .logo img { height: 30px; width: 30px; }
    .main-content > h1 { font-size: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .form-card { margin: 1rem auto; padding: 1.5rem 1.25rem; }
    .auth-form { margin: 1.5rem auto; padding: 1.75rem 1.25rem; }
    .hero .hero-logo { width: 56px; height: 56px; }
    .hero p { font-size: .9rem; }
    .card img { height: 160px; }
    .section h2 { font-size: .6rem; }
    .admin-table { font-size: .8rem; }
    .admin-table th, .admin-table td { padding: .6rem .75rem; }
    .admin-actions { flex-direction: column; align-items: stretch; }
    .admin-actions form { width: 100%; }
    .admin-actions .btn { width: 100%; justify-content: center; }
    .topic-grid { grid-template-columns: 1fr 1fr; }
    .memory-board { gap: .5rem; }
    .mem-card .mem-face { font-size: 1rem; }
    .qg-answers { grid-template-columns: 1fr; }
    .game-hud { font-size: .8rem; gap: .5rem; }
    .flashcard { height: 220px; }
    .flashcard-face p { font-size: .95rem; }
}

/* ≤ 400 : petits écrans */
@media (max-width: 400px) {
    .topic-grid { grid-template-columns: 1fr; }
    .memory-board { grid-template-columns: repeat(3, 1fr); }
    .hero h1 { font-size: 1.1rem; }
    .btn { font-size: .55rem; padding: .5rem .85rem; }
}

/* Impression */
@media print {
    .site-header, .site-footer, .nav-toggle, .theme-toggle, .btn, .admin-actions { display: none !important; }
    .main-content { padding: 0; max-width: none; }
    a { color: #000; text-decoration: underline; }
    .card { page-break-inside: avoid; }
}

/* ============================================================
   APPRENDRE — Topics, quiz, flashcards, fill-in-the-blank
   ============================================================ */

.learn-hero {
    background: linear-gradient(135deg, #1a365d, #3182ce);
    color: #fff;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}
.learn-hero h1 { color: #fff; font-size: 2rem; margin: 0 0 .5rem; }
.learn-hero p  { color: rgba(255,255,255,.9); max-width: 640px; margin: 0 auto; }
.learn-stats {
    display: inline-block;
    margin-top: 1rem;
    padding: .5rem 1rem;
    background: rgba(255,255,255,.15);
    border-radius: var(--radius);
    font-size: .9rem;
}
[data-theme="dark"] .learn-hero {
    background: linear-gradient(135deg, #0d1117, #1c2333);
    border: 1px solid var(--border);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}
.topic-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}
.topic-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.topic-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    margin: 0 auto .75rem;
    font-family: var(--f-display);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--blue);
    background: var(--blue-pale);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-transform: uppercase;
}
.topic-card h3 { margin: .25rem 0 .35rem; font-size: 1rem; }
.topic-counts {
    display: flex;
    justify-content: center;
    gap: .85rem;
    flex-wrap: wrap;
    font-size: .75rem;
    color: var(--text-meta);
    margin: .75rem 0;
}
.topic-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: center;
}

/* Quiz play */
.quiz-play { max-width: 720px; margin: 0 auto; }
.quiz-progress {
    height: 8px;
    background: var(--bg-alt);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0;
}
.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    transition: width .3s ease;
}
.quiz-question {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-sm);
}
.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
}
.quiz-answer-btn,
.quiz-answer {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: .55rem;
    font-size: .95rem;
    color: var(--text);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
    font-family: inherit;
}
.quiz-answer-btn:hover {
    background: var(--bg-card);
    border-color: var(--blue);
    transform: translateX(2px);
}
.quiz-answer.answer-correct {
    background: rgba(56,161,105,.12);
    border-color: var(--green);
    color: var(--green);
    font-weight: 600;
}
.quiz-answer.answer-wrong {
    background: rgba(229,62,62,.12);
    border-color: var(--red);
    color: var(--red);
    font-weight: 600;
}

.quiz-result { max-width: 520px; margin: 2rem auto; text-align: center; }
.score-ring {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--blue) calc(var(--p,0) * 1%), var(--bg-alt) 0);
    margin: 1rem auto;
    position: relative;
}
.score-ring::before {
    content: '';
    position: absolute;
    inset: 12px;
    background: var(--bg-card);
    border-radius: 50%;
}
.score-ring strong, .score-ring span {
    position: relative;
    z-index: 1;
}
.score-ring strong { font-size: 1.5rem; }
.score-ring span   { font-size: .85rem; color: var(--text-meta); }

/* Flashcards */
.flashcards-play { max-width: 560px; margin: 0 auto; text-align: center; }
.flashcard {
    perspective: 1000px;
    width: 100%;
    height: 280px;
    margin: 1.5rem auto;
    cursor: pointer;
    outline: none;
}
.flashcard:focus-visible .flashcard-inner {
    box-shadow: 0 0 0 3px var(--blue);
}
.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .6s;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}
.flashcard-front {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #fff;
}
.flashcard-back {
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--border);
    transform: rotateY(180deg);
}
.flashcard-face p {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 1rem;
}
.flashcard-face .meta { color: rgba(255,255,255,.75); font-size: .7rem; }
.flashcard-back .meta { color: var(--text-meta); }

/* Fill-in-the-blank — code block */
.code-block {
    background: #1a1a2e;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    font-family: 'Consolas','Monaco','Courier New',monospace;
    font-size: .95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid #333;
}
.code-blank {
    display: inline-block;
    min-width: 80px;
    padding: 0 .35rem;
    background: rgba(99, 179, 237, 0.18);
    border: 2px dashed var(--blue-light);
    border-radius: 4px;
    color: var(--blue-light);
    font-weight: 700;
}
.code-blank.correct {
    background: rgba(56,161,105,.25);
    border-color: var(--green);
    color: #9ae6b4;
}
.code-blank.wrong {
    background: rgba(229,62,62,.25);
    border-color: var(--red);
    color: #feb2b2;
}
.fillblanks-play { max-width: 720px; margin: 0 auto; }

/* ============================================================
   JEUX — panel, hud, memory, typing, quizgame
   ============================================================ */

.game-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 1.5rem auto;
    max-width: 720px;
    box-shadow: var(--shadow-md);
}
.game-hud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--bg-alt);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: .9rem;
}
.game-hud strong { color: var(--blue); font-size: 1.1rem; }
.game-emoji { display: none; }
.game-card { text-align: center; }

/* Memory grid */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.mem-card {
    aspect-ratio: 1;
    position: relative;
    border: none;
    background: transparent;
    cursor: pointer;
    perspective: 800px;
    padding: 0;
}
.mem-card .mem-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-weight: 800;
    font-size: 1.4rem;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform .4s;
    box-shadow: var(--shadow-sm);
}
.mem-card .mem-back {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #fff;
    transform: rotateY(0deg);
}
.mem-card .mem-front {
    background: var(--bg-card);
    color: var(--blue);
    border: 2px solid var(--blue);
    transform: rotateY(180deg);
}
.mem-card.flipped .mem-back  { transform: rotateY(180deg); }
.mem-card.flipped .mem-front { transform: rotateY(360deg); }
.mem-card.matched .mem-front {
    border-color: var(--green);
    color: var(--green);
    background: rgba(56,161,105,.08);
}

/* Typing */
.typing-stream {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 1rem;
    background: var(--bg-alt);
    border-radius: var(--radius);
    min-height: 56px;
    font-family: 'Consolas','Courier New',monospace;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}
.ty-word {
    padding: .15rem .5rem;
    border-radius: 4px;
    color: var(--text-meta);
    transition: background .15s;
}
.ty-current {
    background: var(--blue);
    color: #fff;
    font-weight: 700;
}
.ty-error { background: var(--red); color: #fff; }
.typing-input {
    width: 100%;
    padding: .85rem 1rem;
    font-size: 1.1rem;
    font-family: 'Consolas','Courier New',monospace;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
}
.typing-input:focus { outline: none; border-color: var(--blue); }

/* Quiz-game (speed) */
.qg-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    margin-top: 1rem;
}
.qg-answer {
    background: var(--bg-alt);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    font-size: .95rem;
    transition: background .15s, transform .15s, border-color .15s;
}
.qg-answer:hover {
    background: var(--bg-card);
    border-color: var(--blue);
    transform: translateY(-2px);
}
.qg-answer.qg-correct { background: rgba(56,161,105,.18); border-color: var(--green); }
.qg-answer.qg-wrong   { background: rgba(229,62,62,.18); border-color: var(--red); }
.qg-answer:disabled   { cursor: not-allowed; opacity: .85; }

/* (Breakpoints regroupés plus haut, section RESPONSIVE) */
