:root {
    color-scheme: light dark;
    --fg: #1a1a1a;
    --bg: #fdfcfa;
    --muted: #6b6b6b;
    --accent: #2f6f5e;
    --border: #e4e0d8;
    --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --fg: #e8e6e1;
        --bg: #171614;
        --muted: #9a968d;
        --accent: #6fb8a2;
        --border: #33312c;
    }
}

/* Choix explicite via le bouton thème (prioritaire sur prefers-color-scheme) */
:root[data-theme="dark"] {
    color-scheme: dark;
    --fg: #e8e6e1;
    --bg: #171614;
    --muted: #9a968d;
    --accent: #6fb8a2;
    --border: #33312c;
}

:root[data-theme="light"] {
    color-scheme: light;
    --fg: #1a1a1a;
    --bg: #fdfcfa;
    --muted: #6b6b6b;
    --accent: #2f6f5e;
    --border: #e4e0d8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    line-height: 1.9;
}

.site-header {
    height: var(--header-h);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-title {
    display: flex;
    align-items: center;
}

.site-logo {
    height: 40px;
    width: 40px;
    border-radius: 0.4rem;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--fg);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

.lang-switch {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.lang-switch a {
    color: var(--muted);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
}

.lang-switch a.active {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    font-weight: 700;
}

main {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.5rem;
}

body.reel-page main {
    max-width: none;
    margin: 0;
    padding: 0;
}

.capsule-type {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Détail — lecture classique */
.capsule h1 {
    margin: 0.25rem 0 1.5rem;
}

.source-text {
    margin: 0 0 1.5rem;
    padding: 0.75rem 1.25rem;
    border-inline-start: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.source-text cite {
    display: block;
    margin-top: 0.5rem;
    font-style: normal;
    color: var(--muted);
    font-size: 0.85rem;
}

.capsule-block {
    margin-bottom: 1.75rem;
}

.capsule-block h2 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.4rem;
}

.positions .position {
    margin-bottom: 1.25rem;
    padding-inline-start: 1rem;
    border-inline-start: 2px solid var(--border);
}

.scholar-name {
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.stance {
    margin: 0 0 0.25rem;
}

.source-book {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

.back-link {
    margin-top: 2rem;
}

.back-link a {
    color: var(--accent);
}

/* Liste — feed plein écran, scroll-snap (façon Stories), c'est l'accroche */
.capsule-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.reel {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.snap-card {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.snap-card .card-inner {
    display: block;
    max-width: min(90vw, 50rem);
    width: 100%;
    color: inherit;
    text-decoration: none;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
}

.snap-card.visible .card-inner {
    opacity: 1;
    transform: translateY(0);
}

/* Hero (carte de capsule dans le feed liste) */
.snap-card.hero {
    background: linear-gradient(160deg, var(--from), var(--to));
    color: #fdfcfa;
    text-align: center;
    overflow: hidden;
}

.snap-card.hero .bg-word {
    position: absolute;
    inset: -1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Amiri", serif;
    font-weight: 700;
    font-size: clamp(4.5rem, 24vw, 11rem);
    line-height: 1;
    color: #fdfcfa;
    opacity: 0.16;
    white-space: nowrap;
    direction: rtl;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.snap-card.hero .capsule-type,
.snap-card.hero h2 {
    position: relative;
    z-index: 1;
}

.snap-card.hero .capsule-type {
    color: #fdfcfa;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: clamp(0.8rem, 1.2vw, 1.05rem);
}

.snap-card.hero h2 {
    font-size: clamp(1.8rem, 4.5vw, 3.5rem);
    margin: 0.75rem 0 0;
}
