/*
    Feuille de style principale du projet.

    Objectif graphique :
    - interface moderne ;
    - lecture confortable ;
    - design sobre et professionnel ;
    - responsive pour mobile et desktop.
*/

:root {
    --color-background: #f6f7fb;
    --color-surface: #ffffff;
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-soft-blue: #eff6ff;

    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

/* HEADER */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
}

.navbar {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
}

.nav-links {
    display: flex;
    gap: 22px;
    font-size: 0.95rem;
    color: var(--color-muted);
}

.nav-links a:hover {
    color: var(--color-primary);
}

/* STRUCTURE */

.main-content {
    max-width: 1180px;
    margin: 0 auto;
    padding: 56px 24px;
}

/* HERO */

.hero {
    min-height: 440px;
    display: flex;
    align-items: center;
    background:
        radial-gradient(circle at top left, #dbeafe, transparent 35%),
        linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 72px;
}

.hero-content {
    max-width: 760px;
}

.eyebrow {
    color: var(--color-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

.hero h1,
.page-heading h1 {
    font-size: clamp(2.3rem, 5vw, 4.7rem);
    line-height: 1;
    letter-spacing: -0.06em;
    margin: 0 0 24px;
}

.hero-text,
.page-heading p {
    color: var(--color-muted);
    font-size: 1.15rem;
    max-width: 680px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    margin-top: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    border-radius: 999px;
    font-weight: 700;
    transition: 0.2s ease;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-soft-blue);
    color: var(--color-primary-dark);
}

.btn-secondary:hover {
    background: #dbeafe;
}

/* FEATURES */

.features-grid {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.feature-card,
.paper-card,
.empty-state {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.feature-card {
    padding: 28px;
}

.feature-card h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.feature-card p {
    color: var(--color-muted);
}

/* PAGE ARTICLES */

.page-heading {
    margin-bottom: 34px;
}

.paper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.paper-card {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 310px;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.paper-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.11);
    border-color: rgba(37, 99, 235, 0.25);
}

.paper-card-main {
    display: block;
    flex: 1;
    padding: 26px 26px 0;
}

.paper-card h2 {
    font-size: 1.15rem;
    line-height: 1.35;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.paper-card h2:hover {
    color: var(--color-primary);
}

.paper-authors {
    margin: 0 0 16px;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.paper-summary {
    color: var(--color-muted);
    margin-bottom: 0;
}

.paper-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
    row-gap: 6px;
    margin-top: auto;
    padding: 16px 26px 22px;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.paper-meta-source {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.paper-meta-date {
    white-space: nowrap;
    text-align: right;
}

.paper-meta-author {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paper-link {
    display: none;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 42px;
    text-align: center;
}

/* CATÉGORIES */

.category-pill {
    width: fit-content;
    margin-bottom: 16px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--category-pill-bg, var(--color-soft-blue));
    color: var(--category-pill-color, var(--color-primary-dark));
}

.paper-card[class*="category-card-"] {
    border-top: 5px solid var(--category-accent, #cbd5e1);
    border-left: 6px solid var(--category-accent, #cbd5e1);
}

.category-showcase[class*="category-card-"] {
    border-top: 5px solid var(--category-accent, #cbd5e1);
}

.category-card-default,
.category-card-autre,
.category-pill-default {
    --category-accent: #cbd5e1;
    --category-pill-bg: #f1f5f9;
    --category-pill-color: #475569;
}

.category-pill-autre {
    --category-pill-bg: #f1f5f9;
    --category-pill-color: #475569;
}

.category-card-astrophysique,
.category-card-astronomie,
.category-card-espace,
.category-pill-astrophysique,
.category-pill-astronomie,
.category-pill-espace {
    --category-accent: #818cf8;
    --category-pill-bg: #eef2ff;
    --category-pill-color: #3730a3;
}

.category-card-biologie,
.category-pill-biologie {
    --category-accent: #34d399;
    --category-pill-bg: #ecfdf5;
    --category-pill-color: #065f46;
}

.category-card-economie,
.category-pill-economie {
    --category-accent: #f59e0b;
    --category-pill-bg: #fffbeb;
    --category-pill-color: #92400e;
}

.category-card-energie,
.category-pill-energie {
    --category-accent: #facc15;
    --category-pill-bg: #fefce8;
    --category-pill-color: #854d0e;
}

.category-card-finance,
.category-pill-finance {
    --category-accent: #22c55e;
    --category-pill-bg: #f0fdf4;
    --category-pill-color: #166534;
}

.category-card-informatique,
.category-pill-informatique {
    --category-accent: #38bdf8;
    --category-pill-bg: #f0f9ff;
    --category-pill-color: #075985;
}

.category-card-mathematique,
.category-card-mathematiques,
.category-pill-mathematique,
.category-pill-mathematiques {
    --category-accent: #a78bfa;
    --category-pill-bg: #f5f3ff;
    --category-pill-color: #5b21b6;
}

.category-card-matiere-condense,
.category-card-matiere-condensee,
.category-pill-matiere-condense,
.category-pill-matiere-condensee {
    --category-accent: #fb7185;
    --category-pill-bg: #fff1f2;
    --category-pill-color: #9f1239;
}

.category-card-non-lineaire,
.category-pill-non-lineaire {
    --category-accent: #f97316;
    --category-pill-bg: #fff7ed;
    --category-pill-color: #9a3412;
}

.category-card-nucleaire,
.category-pill-nucleaire {
    --category-accent: #ef4444;
    --category-pill-bg: #fef2f2;
    --category-pill-color: #991b1b;
}

.category-card-physique,
.category-pill-physique {
    --category-accent: #60a5fa;
    --category-pill-bg: #eff6ff;
    --category-pill-color: #1d4ed8;
}

.category-card-relativite-general,
.category-card-relativite-generale,
.category-pill-relativite-general,
.category-pill-relativite-generale {
    --category-accent: #6366f1;
    --category-pill-bg: #eef2ff;
    --category-pill-color: #4338ca;
}

.category-card-statistique,
.category-pill-statistique {
    --category-accent: #14b8a6;
    --category-pill-bg: #f0fdfa;
    --category-pill-color: #115e59;
}

.category-card-traitement-du-signal,
.category-pill-traitement-du-signal {
    --category-accent: #06b6d4;
    --category-pill-bg: #ecfeff;
    --category-pill-color: #155e75;
}

.category-card-medecine {
    --category-accent: #f9a8d4;
}

.category-pill-medecine {
    --category-pill-bg: #fdf2f8;
    --category-pill-color: #9d174d;
}

.category-card-climat {
    --category-accent: #86efac;
}

.category-pill-climat {
    --category-pill-bg: #f0fdf4;
    --category-pill-color: #166534;
}

.category-card-intelligence-artificielle {
    --category-accent: #c4b5fd;
}

.category-pill-intelligence-artificielle {
    --category-pill-bg: #f5f3ff;
    --category-pill-color: #5b21b6;
}

.category-card-geologie {
    --category-accent: #fdba74;
}

.category-pill-geologie {
    --category-pill-bg: #fff7ed;
    --category-pill-color: #9a3412;
}

/* PAGE DÉTAIL ARTICLE */

.article-page {
    max-width: 960px;
    margin: auto;
}

.article-header {
    margin-bottom: 36px;
}

.article-header h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.1;
    margin: 10px 0 18px;
    letter-spacing: -0.05em;
}

.article-authors {
    color: var(--color-muted);
    font-size: 1rem;
    margin: 0 0 8px;
}

.article-meta {
    color: var(--color-muted);
    margin: 0;
}

.reader-toggle {
    width: fit-content;
    margin: 0 auto 32px;
    padding: 6px;
    display: flex;
    gap: 6px;
    background: #e5e7eb;
    border-radius: 999px;
}

.reader-toggle-btn {
    border: none;
    cursor: pointer;
    padding: 11px 18px;
    border-radius: 999px;
    background: transparent;
    color: var(--color-muted);
    font-weight: 700;
}

.reader-toggle-btn.active {
    background: white;
    color: var(--color-primary-dark);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.reader-view {
    display: none;
    animation: softSlide 0.25s ease;
}

.reader-view.active {
    display: block;
}

@keyframes softSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.article-reading-card {
    background: white;
    padding: 38px;
    border-radius: 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.public-reading {
    font-size: 1.05rem;
}

.lead-summary {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--color-primary-dark);
    margin-bottom: 26px;
}

.article-text {
    color: var(--color-text);
}

.article-two-columns {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.article-soft-card {
    background: white;
    padding: 28px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.article-soft-card h2 {
    margin-top: 0;
}

.scientific-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}

.scientific-main {
    background: white;
    padding: 42px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.scientific-main h2 {
    margin-top: 0;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--color-border);
}

.scientific-text {
    font-size: 1rem;
    line-height: 1.75;
}

.scientific-aside {
    display: grid;
    gap: 18px;
}

.scientific-aside section {
    background: #f8fafc;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid var(--color-border);
}

.scientific-aside h3 {
    margin-top: 0;
}

.figures-section {
    margin-top: 34px;
}

.figures-section h2 {
    margin-bottom: 18px;
}

.figures-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.figure-card {
    background: white;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.figure-card img,
.scientific-figure-row img {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--color-border);
}

.figure-card p {
    color: var(--color-muted);
}

.scientific-figure-row {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    background: white;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    margin-bottom: 22px;
}

.figure-caption {
    color: var(--color-muted);
    font-style: italic;
}

.article-actions {
    margin-top: 36px;
    display: flex;
    gap: 14px;
}

/* FOOTER */

.site-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* RESPONSIVE */

@media (max-width: 900px) {
    .hero {
        padding: 48px;
    }

    .features-grid,
    .paper-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 850px) {
    .scientific-layout,
    .article-two-columns,
    .figures-grid,
    .scientific-figure-row {
        grid-template-columns: 1fr;
    }

    .article-reading-card,
    .scientific-main {
        padding: 28px;
    }

    .reader-toggle {
        width: 100%;
    }

    .reader-toggle-btn {
        flex: 1;
    }

    .article-actions {
        flex-direction: column;
    }

    .scientific-figure-row img {
        max-width: 100%;
    }
}

@media (max-width: 680px) {
    .navbar {
        align-items: flex-start;
        gap: 16px;
        flex-direction: column;
    }

    .nav-links {
        flex-wrap: wrap;
        gap: 14px;
    }

    .main-content {
        padding: 32px 18px;
    }

    .hero {
        padding: 34px 26px;
        min-height: auto;
    }

    .hero-actions {
        flex-direction: column;
    }

    .features-grid,
    .paper-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .article-header h1 {
        font-size: 2rem;
    }

    .article-reading-card,
    .scientific-main,
    .article-soft-card,
    .scientific-aside section,
    .figure-card,
    .scientific-figure-row {
        padding: 22px;
    }

    .lead-summary {
        font-size: 1.1rem;
    }

    .reader-toggle {
        flex-direction: column;
        border-radius: 18px;
    }

    .reader-toggle-btn {
        width: 100%;
    }
}

.clickable-figure {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.clickable-figure:hover {
    transform: scale(1.02);
}

.figure-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: none;
    justify-content: center;
    align-items: center;

    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
}

.figure-modal.active {
    display: flex;
}

.figure-modal-image {
    max-width: 92vw;
    max-height: 92vh;

    border-radius: 16px;
    background: white;
}

.figure-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;

    font-size: 3rem;
    color: white;
    cursor: pointer;

    user-select: none;
}

.similar-papers {
    margin-top: 60px;
}

.similar-papers h2 {
    margin-bottom: 20px;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.similar-card {
    background: white;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);

    transition: all 0.2s ease;
}

.similar-card:hover {
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.25);
}

.similar-card h3 {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 1rem;
}

.similar-card p {
    color: var(--color-muted);
    margin: 0;
}

@media (max-width: 850px) {

    .similar-grid {
        grid-template-columns: 1fr;
    }

}

/* AMÉLIORATION VISUELLE DES COMPTES */

.auth-page {
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background:
        radial-gradient(circle at top left, #dbeafe, transparent 38%),
        white;
    padding: 42px;
    border-radius: 28px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.auth-card h1 {
    margin-top: 0;
    font-size: 2.6rem;
    line-height: 1;
    letter-spacing: -0.06em;
}

.auth-form p {
    display: grid;
    gap: 7px;
    margin-bottom: 18px;
}

.auth-form label {
    font-weight: 750;
}

.auth-form input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    font: inherit;
}

.auth-form input:focus {
    outline: none;
    background: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px #dbeafe;
}

.auth-form .helptext,
.auth-form ul {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.auth-form button {
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
}

.auth-help {
    margin-top: 24px;
    text-align: center;
    color: var(--color-muted);
}

.auth-help a {
    color: var(--color-primary);
    font-weight: 800;
}

.dashboard-page h1 {
    font-size: clamp(2.3rem, 5vw, 4.4rem);
    line-height: 1;
    letter-spacing: -0.06em;
    margin-top: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-top: 30px;
}

.dashboard-card {
    display: block;
    background: white;
    padding: 28px;
    border-radius: 22px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    border-color: rgba(37, 99, 235, 0.25);
}

.dashboard-card h2 {
    margin-top: 0;
}

.dashboard-card p {
    color: var(--color-muted);
}

.muted-card {
    opacity: 0.75;
}

@media (max-width: 850px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* BOUTON FAVORI */

.article-header-actions {
    margin-top: 26px;
}

.favorite-form {
    margin: 0;
}

.favorite-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--color-border);

    background: white;
    color: var(--color-text);

    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);

    font: inherit;
    font-weight: 750;
    cursor: pointer;

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.favorite-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.favorite-pill.is-active {
    background: #eff6ff;
    color: var(--color-primary-dark);
    border-color: #bfdbfe;
}

.favorite-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* PAGE CATÉGORIES — VERSION RAIL ÉLÉGANT */

.category-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 44px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--color-border);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
}

.category-filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    color: var(--color-muted);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.category-filter-pill:hover {
    color: var(--color-primary-dark);
    border-color: #bfdbfe;
    background: #eff6ff;
    transform: translateY(-1px);
}

.category-filter-pill.active {
    color: white;
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.category-showcase {
    margin-bottom: 52px;
    padding: 30px;
    background:
        radial-gradient(circle at top left, rgba(219, 234, 254, 0.38), transparent 28%),
        #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
}

.category-showcase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.category-showcase-header h2 {
    margin: 10px 0 0;
    font-size: clamp(2rem, 4vw, 2.7rem);
    line-height: 1;
    letter-spacing: -0.06em;
}

.category-showcase-header p {
    display: none;
}

.category-follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--color-primary-dark);
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.category-follow-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.category-article-frame {
    position: relative;
    padding: 20px;
    border-radius: 26px;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.category-article-frame::before,
.category-article-frame::after {
    content: "";
    position: absolute;
    top: 20px;
    bottom: 28px;
    z-index: 2;
    width: 42px;
    pointer-events: none;
}

.category-article-frame::before {
    left: 20px;
    background: linear-gradient(90deg, #f8fafc, transparent);
}

.category-article-frame::after {
    right: 20px;
    background: linear-gradient(270deg, #f8fafc, transparent);
}

.category-article-rail {
    display: flex;
    gap: 22px;
    overflow-x: auto;
    padding: 4px 4px 18px;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
}

.category-article-rail-marquee {
    overflow: visible;
    width: max-content;
    scroll-snap-type: none;
    animation: category-rail-marquee 95s linear infinite;
    will-change: transform;
}

.category-article-frame-marquee:hover .category-article-rail-marquee {
    animation-play-state: paused;
}

.category-article-rail .paper-card {
    flex: 0 0 340px;
    width: 340px;
    min-height: 360px;
    scroll-snap-align: start;
}

.category-article-rail .paper-card-main {
    padding: 26px 26px 0;
}

.category-article-rail::-webkit-scrollbar {
    height: 8px;
}

.category-article-rail::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 999px;
}

.category-article-rail::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.category-article-rail::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@keyframes category-rail-marquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .category-article-rail-marquee {
        width: auto;
        overflow-x: auto;
        animation: none;
    }

    .category-article-rail-marquee [aria-hidden="true"] {
        display: none;
    }
}

.category-selected-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.category-selected-grid .paper-card {
    min-height: 360px;
}

@media (max-width: 1000px) {
    .category-selected-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .category-filter-bar {
        padding: 12px;
        border-radius: 22px;
    }

    .category-filter-pill {
        flex: 1 1 auto;
    }

    .category-showcase {
        padding: 22px;
        border-radius: 24px;
    }

    .category-showcase-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-article-frame {
        padding: 14px;
    }

    .category-article-frame::before,
    .category-article-frame::after {
        display: none;
    }

    .category-article-rail .paper-card {
        flex: 0 0 285px;
        width: 285px;
        min-height: 340px;
    }

    .category-selected-grid {
        grid-template-columns: 1fr;
    }
}

/* FILTRES MULTI-CATÉGORIES */

.category-filter-reset,
.category-filter-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    font-weight: 800;
    cursor: pointer;
}

.category-filter-reset {
    background: #f8fafc;
    color: var(--color-muted);
}

.category-filter-reset.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.category-filter-pill input {
    display: none;
}

.category-filter-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    color: var(--color-muted);
    font-weight: 800;
    cursor: pointer;
    transition: 0.18s ease;
}

.category-filter-pill input:checked + span {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.category-filter-submit {
    background: #111827;
    color: white;
    border: 1px solid #111827;
}

.category-filter-submit:hover,
.category-filter-pill span:hover,
.category-filter-reset:hover {
    transform: translateY(-1px);
}

/* CORRECTION FINALE FILTRES CATÉGORIES */

.category-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 42px;
    padding: 14px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
}

.category-filter-pill {
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    min-height: auto !important;
}

.category-filter-pill input {
    display: none;
}

.category-filter-pill span,
.category-filter-reset,
.category-filter-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    color: var(--color-muted);
    font-weight: 800;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: 0.18s ease;
}

.category-filter-pill input:checked + span,
.category-filter-reset.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
}

.category-filter-pill span:hover,
.category-filter-reset:hover {
    background: #eff6ff;
    color: var(--color-primary-dark);
    border-color: #bfdbfe;
}

.category-filter-submit {
    margin-left: auto;
    background: #111827;
    color: white;
    border-color: #111827;
}

.category-filter-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

@media (max-width: 760px) {
    .category-filter-submit {
        margin-left: 0;
        width: 100%;
    }

    .category-filter-reset,
    .category-filter-pill span {
        flex: 1 1 auto;
    }
}

/* BARRE DE RECHERCHE */

.search-bar {
    display: flex;
    gap: 12px;
    margin: 30px 0 36px;
    padding: 10px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 16px;
    font: inherit;
    color: var(--color-text);
}

.search-bar input:focus {
    outline: none;
}

.search-bar button {
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--color-primary);
    color: white;
    font-weight: 800;
    font: inherit;
}

.search-bar button:hover {
    background: var(--color-primary-dark);
}

@media (max-width: 680px) {
    .search-bar {
        flex-direction: column;
        border-radius: 22px;
    }

    .search-bar button {
        width: 100%;
    }
}

/* COMMENTAIRES */

.comments-wrapper {
    margin-top: 56px;
}

.comments-toggle {
    width: 100%;
    padding: 16px 20px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    background: white;
    box-shadow: var(--shadow-soft);
    color: var(--color-text);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    transition: 0.18s ease;
}

.comments-toggle:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    color: var(--color-primary-dark);
}

.comments-panel {
    display: none;
    margin-top: 18px;
    padding: 26px;
    background: white;
    border-radius: 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.comments-panel.active {
    display: block;
}

.comments-header h2 {
    margin: 0 0 6px;
    font-size: 1.6rem;
    letter-spacing: -0.04em;
}

.comments-header p {
    margin: 0 0 24px;
    color: var(--color-muted);
}

.comment-form {
    display: grid;
    gap: 14px;
    margin-bottom: 28px;
}

.comment-form textarea {
    width: 100%;
    resize: vertical;
    padding: 15px;
    border-radius: 18px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    font: inherit;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px #dbeafe;
    background: white;
}

.comment-login-box {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 18px;
    margin-bottom: 24px;
    background: #f8fafc;
    border-radius: 18px;
    border: 1px solid var(--color-border);
}

.comment-login-box p {
    margin: 0;
    color: var(--color-muted);
}

.comment-list {
    display: grid;
    gap: 16px;
}

.comment-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 18px;
    background: #f8fafc;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    font-weight: 900;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.comment-meta span {
    color: var(--color-text);
    font-weight: 800;
}

.comment-content p {
    margin: 8px 0 0;
}

.empty-comments {
    padding: 18px;
    border-radius: 18px;
    background: #f8fafc;
    color: var(--color-muted);
    text-align: center;
}

@media (max-width: 680px) {
    .comment-login-box {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-card {
        grid-template-columns: 1fr;
    }
}

/* DASHBOARD COMMENTAIRES */

.dashboard-section {
    margin-top: 42px;
}

.dashboard-section h2 {
    font-size: 1.8rem;
    letter-spacing: -0.04em;
}

.dashboard-comment-list {
    display: grid;
    gap: 14px;
}

.dashboard-comment-card {
    display: block;
    padding: 18px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.dashboard-comment-card span {
    font-weight: 850;
}

.dashboard-comment-card p {
    margin: 8px 0;
    color: var(--color-muted);
}

.dashboard-comment-card small {
    color: var(--color-primary-dark);
    font-weight: 800;
}


/* COMMENTAIRES — AFFICHAGE FINAL */

.comment-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 18px;
    background: #f8fafc;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.comment-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.comment-meta span {
    color: var(--color-text);
    font-weight: 800;
}

.comment-text {
    margin-top: 8px;
    line-height: 1.6;
    color: var(--color-text);
}

.comment-text p {
    margin: 0;
}

.comment-actions-youtube {
    width: 220px;
    margin-top: 18px;
    margin-left: auto;
    align-self: flex-end;
}

.comment-vote-bar {
    pointer-events: none;
    height: 5px;
    width: 100%;
    overflow: hidden;
    border-radius: 999px;
    background: #fee2e2;
    margin-bottom: 8px;
}

.comment-vote-positive {
    height: 100%;
    background: #bfdbfe;
    border-radius: 999px;
}

.comment-vote-buttons {
    position: relative;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.comment-vote-buttons form {
    margin: 0;
}

.comment-vote-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 58px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: white;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.comment-vote-icon:hover {
    transform: translateY(-1px);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.comment-vote-icon span {
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.muted-votes {
    color: var(--color-muted);
    font-size: 0.9rem;
    font-weight: 800;
}

@media (max-width: 680px) {
    .comment-card {
        grid-template-columns: 1fr;
    }

    .comment-actions-youtube {
        width: 100%;
    }
}

.comment-user-reputation {
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--color-primary-dark);
    font-size: 0.75rem;
    font-weight: 800;
}

.dashboard-card-link {
    display: inline-flex;
    margin-top: 12px;
    color: var(--color-primary);
    font-weight: 800;
}

.dashboard-card-link:hover {
    color: var(--color-primary-dark);
}

/* TABLEAU DE BORD ADMIN */

.admin-dashboard-heading {
    margin-bottom: 24px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-stat-card,
.admin-dashboard-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.admin-stat-card {
    padding: 20px;
}

.admin-stat-card span {
    display: block;
    color: var(--color-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.admin-stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2.4rem;
    line-height: 1;
    letter-spacing: 0;
}

.admin-dashboard-panel {
    padding: 22px;
    margin-bottom: 24px;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.admin-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: 0;
}

.admin-panel-header .eyebrow {
    margin-bottom: 6px;
}

.admin-chart-wrapper {
    min-height: 320px;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-dashboard-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.admin-dashboard-table th,
.admin-dashboard-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.admin-dashboard-table th {
    color: var(--color-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-dashboard-table a,
.admin-link-list a,
.admin-error-card a {
    color: var(--color-primary-dark);
    font-weight: 800;
}

.admin-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #ffedd5;
    color: #9a3412;
}

.status-neutral {
    background: #f1f5f9;
    color: #475569;
}

.admin-error-list {
    display: grid;
    gap: 14px;
}

.admin-error-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fffafa;
}

.admin-error-card h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.admin-error-card time {
    display: block;
    color: var(--color-muted);
    font-size: 0.84rem;
}

.admin-error-card p {
    margin: 8px 0 0;
    color: var(--color-muted);
}

@media (max-width: 900px) {
    .admin-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-error-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-dashboard-panel {
        padding: 16px;
    }

    .admin-chart-wrapper {
        min-height: 260px;
    }
}

/* MODIFICATION / SUPPRESSION COMMENTAIRES */

.comment-edit-details {
    margin-top: 12px;
}

.comment-edit-details summary {
    cursor: pointer;
    width: fit-content;
    color: var(--color-primary);
    font-weight: 800;
}

.comment-edit-form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.comment-edit-form textarea {
    width: 100%;
    resize: vertical;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--color-border);
    font: inherit;
}

.comment-delete-form {
    margin-top: 10px;
}

.comment-small-action {
    width: fit-content;
    border: 1px solid var(--color-border);
    background: white;
    color: var(--color-primary-dark);
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.comment-small-action:hover {
    background: #eff6ff;
}

.comment-small-action.danger {
    color: #991b1b;
}

.comment-small-action.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

/* ACTIONS PROPRIÉTAIRE COMMENTAIRE */

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.comment-author {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comment-owner-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.comment-owner-actions form {
    margin: 0;
}

.comment-owner-btn {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    border: 1px solid var(--color-border);

    background: white;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        background 0.18s ease;
}

.comment-owner-btn:hover {
    transform: translateY(-1px);
    background: #eff6ff;
}

.comment-owner-btn.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

.comment-edit-details summary {
    list-style: none;
}

.comment-edit-details summary::-webkit-details-marker {
    display: none;
}

.comment-edit-form {
    margin-top: 12px;
}

.comment-owner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-owner-btn,
.comment-owner-actions summary {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;

    border-radius: 999px;
    border: 1px solid var(--color-border);

    background: white;

    cursor: pointer;
}

.comment-owner-actions summary {
    list-style: none;
}

.comment-owner-actions summary::-webkit-details-marker {
    display: none;
}

.comment-edit-container {
    display: none;
    margin-top: 14px;
}

.comment-edit-container.active {
    display: block;
}

.comment-display.is-hidden {
    display: none;
}

/* GLOSSAIRE */

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
}

.glossary-card {
    background: white;
    padding: 26px;
    border-radius: 22px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.glossary-card h2 {
    margin: 0 0 14px;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
}

.glossary-short {
    color: var(--color-text);
    font-weight: 650;
}

.glossary-long {
    color: var(--color-muted);
    margin-top: 14px;
}

@media (max-width: 900px) {
    .glossary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 680px) {
    .glossary-grid {
        grid-template-columns: 1fr;
    }
}

/* GLOSSAIRE — VERSION DICTIONNAIRE */

.glossary-layout {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.glossary-alphabet {
    position: sticky;
    top: 100px;
    display: grid;
    gap: 8px;
    padding: 14px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
}

.glossary-alphabet a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border-radius: 999px;
    color: var(--color-muted);
    font-weight: 850;
}

.glossary-alphabet a:hover,
.glossary-alphabet a.active {
    background: var(--color-primary);
    color: white;
}

.glossary-current-letter {
    margin: 0 0 22px;
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.glossary-list {
    display: grid;
    gap: 16px;
}

.glossary-entry {
    background: white;
    padding: 24px;
    border-radius: 22px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.glossary-entry h3 {
    margin: 0 0 10px;
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.glossary-short {
    margin: 0;
    color: var(--color-text);
    font-weight: 650;
}

.glossary-long {
    margin: 12px 0 0;
    color: var(--color-muted);
}

@media (max-width: 760px) {
    .glossary-layout {
        grid-template-columns: 1fr;
    }

    .glossary-alphabet {
        position: static;
        display: flex;
        flex-wrap: wrap;
    }

    .glossary-alphabet a {
        min-width: 38px;
    }
}

/* GLOSSAIRE — STYLE DICTIONNAIRE */

.glossary-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px;
    gap: 24px;
    align-items: start;
}

.glossary-content {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 30px;
}

.glossary-current-letter {
    margin: 0 0 24px;
    font-size: 2.2rem;
    letter-spacing: -0.05em;
}

.glossary-list {
    column-count: 2;
    column-gap: 34px;
}

.glossary-entry {
    break-inside: avoid;
    padding: 0 0 22px;
    margin: 0 0 22px;
    border-bottom: 1px solid var(--color-border);
}

.glossary-entry-letter {
    display: none;
}

.glossary-entry h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}

.glossary-short {
    margin: 0;
    font-weight: 650;
}

.glossary-definition-pair {
    display: grid;
    gap: 12px;
}

.glossary-definition-block {
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.glossary-definition-block span {
    display: block;
    margin-bottom: 6px;
    color: var(--color-primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.glossary-definition-block.scientific {
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.glossary-long {
    margin: 10px 0 0;
    color: var(--color-muted);
}

.glossary-alphabet {
    position: sticky;
    top: 100px;
    display: grid;
    gap: 6px;
    padding: 10px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
}

.glossary-alphabet a {
    width: 42px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--color-muted);
    font-weight: 900;
    font-size: 0.86rem;
}

.glossary-alphabet a:hover,
.glossary-alphabet a.active {
    background: var(--color-primary);
    color: white;
}

@media (max-width: 850px) {
    .glossary-layout {
        grid-template-columns: 1fr;
    }

    .glossary-list {
        column-count: 1;
    }

    .glossary-alphabet {
        position: static;
        display: flex;
        flex-wrap: wrap;
        border-radius: 22px;
    }
}

/* GLOSSAIRE INLINE */

.glossary-inline {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--color-primary-dark);
    font-weight: 800;
    border-bottom: 1px dotted var(--color-primary);
    cursor: help;
}

.glossary-inline::after {
    content: "ⓘ";
    font-size: 0.72em;
    opacity: 0.75;
}

.glossary-inline:not(.has-rich-tooltip):hover::before,
.glossary-inline:not(.has-rich-tooltip):focus::before {
    content: attr(data-definition);
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 50;
    width: min(280px, 80vw);
    padding: 12px 14px;
    border-radius: 14px;
    background: #111827;
    color: white;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.25);
}

.glossary-tooltip {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 50;
    width: min(280px, 80vw);
    padding: 12px 14px;
    border-radius: 14px;
    background: #111827;
    color: white;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.25);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    visibility: hidden;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.glossary-inline:hover .glossary-tooltip,
.glossary-inline:focus .glossary-tooltip {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.glossary-inline:hover::after,
.glossary-inline:focus::after {
    opacity: 1;
}

/* FORMULES MATHÉMATIQUES */

.math-inline-rendered {
    display: inline-flex;
    max-width: 100%;
    vertical-align: middle;
}

.math-display {
    display: block;
    max-width: 100%;
    margin: 14px 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #f8fbff;
    color: #0f172a;
}

.math-display mjx-container {
    min-width: max-content;
}

/* HOME — ARTICLES MIS EN AVANT */

.home-featured-section {
    margin: 64px 0;
}

.home-section-header {
    margin-bottom: 22px;
}

.home-section-header h2 {
    margin: 8px 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1;
    letter-spacing: -0.06em;
}

.home-section-header p:not(.eyebrow) {
    max-width: 720px;
    color: var(--color-muted);
}

.featured-marquee-frame {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border-radius: 28px;
    border: 1px solid var(--color-border);
    background: #f8fafc;
    box-shadow: var(--shadow-soft);
}

.featured-marquee-track {
    display: flex;
    gap: 22px;
    width: max-content;
    animation: featured-marquee 45s linear infinite;
}

.featured-marquee-track:hover {
    animation-play-state: paused;
}

.featured-marquee-track .paper-card {
    flex: 0 0 340px;
    width: 340px;
    min-height: 360px;
}

@keyframes featured-marquee {
    from {
        transform: translateX(-50%);
    }

    to {
        transform: translateX(0);
    }
}

/* FORMULES MATHÉMATIQUES */

mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

mjx-container[display="true"] {
    margin: 1.25rem 0 !important;
    padding: 0.8rem 1rem;
    text-align: center !important;
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: 14px;
}

.scientific-summary mjx-container,
.paper-detail mjx-container {
    font-size: 1.05em;
}

/*
Évite que le span du glossaire adopte une largeur énorme
lorsqu'un ancien terme anormal subsiste encore dans la base.
*/
.glossary-inline {
    max-width: 100%;
}
