/* Cherche ton tuto — feuille unique, sans framework ni CDN. */

:root {
    --bg: #faf9f7;
    --surface: #ffffff;
    --border: #e2ded7;
    --text: #221f1b;
    --muted: #6b655c;
    --accent: #9a4f2b;
    --accent-text: #ffffff;
    --error-bg: #fdecea;
    --error-text: #8a2318;
    --warn-bg: #fdf4e3;
    --warn-text: #7a5a12;
    --info-bg: #eaf2fb;
    --info-text: #1d4e83;
    --radius: 10px;
    --gap: 1rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #171614;
        --surface: #211f1c;
        --border: #35322d;
        --text: #ece8e2;
        --muted: #a39c92;
        --accent: #d4825a;
        --accent-text: #1a1613;
        --error-bg: #3a1f1c;
        --error-text: #f2b5ac;
        --warn-bg: #352c16;
        --warn-text: #e8cd8a;
        --info-bg: #1b2a3c;
        --info-text: #a8c8ec;
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.05em 0.35em;
    font-size: 0.9em;
}

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

/* --- En-tête ---------------------------------------------------------- */

.topbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap);
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 650;
    font-size: 1.05rem;
    text-decoration: none;
    color: var(--text);
}

.topbar-nav { display: flex; align-items: center; gap: 0.6rem; }
.inline-form { margin: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* --- Boutons et champs ------------------------------------------------ */

.button {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

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

.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
}

.button-quiet { background: transparent; color: var(--muted); }

.button-danger {
    background: var(--error-bg);
    border-color: var(--error-bg);
    color: var(--error-text);
}

.button-danger:hover { border-color: var(--error-text); }

input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

input:focus-visible, select:focus-visible, textarea:focus-visible, .button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

textarea { resize: vertical; }
label { font-weight: 600; font-size: 0.93rem; }

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem 1rem;
}

legend { font-weight: 600; font-size: 0.93rem; padding: 0 0.3rem; }
.required { font-weight: 400; color: var(--muted); font-size: 0.82rem; }

.checkboxes, .radios { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; }
.checkbox { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; }
.checkbox input { width: auto; }

.hint { color: var(--muted); font-size: 0.86rem; margin: -0.35rem 0 0; }
.actions { display: flex; gap: 0.6rem; align-items: center; }

/* --- Panneaux et alertes --------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem 1.5rem;
}

.panel-narrow { max-width: 30rem; margin: 2rem auto; }
.panel h1 { margin-top: 0; font-size: 1.4rem; }

.stack { display: flex; flex-direction: column; gap: 0.7rem; }
.stack > .button-primary { align-self: flex-start; }

.alert {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius);
    margin: 0 0 1rem;
}

.alert p:first-child { margin-top: 0; }
.alert p:last-child { margin-bottom: 0; }
.alert ul { margin: 0; padding-left: 1.2rem; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* --- Filtres ---------------------------------------------------------- */

.filters {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    margin: 0 0 1.5rem;
}

.filters p { margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }

@media (min-width: 40rem) {
    .filters { grid-template-columns: 2fr 1fr 1fr; align-items: end; }
}

/* --- Grille ----------------------------------------------------------- */

.grid {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-link { text-decoration: none; color: inherit; }

.card-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb-empty { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.03em; }

.card-duration {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 0.78rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.card-title { font-size: 0.97rem; margin: 0.7rem 0.8rem 0.4rem; line-height: 1.35; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0.8rem 0.6rem; align-items: center; }
.card-tags { color: var(--muted); font-size: 0.83rem; margin: 0 0.8rem 0.8rem; }

.badge {
    font-size: 0.76rem;
    padding: 0.12rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
}

.badge-level { border-color: var(--accent); color: var(--accent); }

.empty, .loading { color: var(--muted); text-align: center; margin: 2.5rem 0; }
#sentinel { height: 1px; }

/* --- Fiche détaillée -------------------------------------------------- */

.detail { max-width: 48rem; margin: 0 auto; }
.detail h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.3rem 0 0.7rem; }
.detail h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.breadcrumb { margin: 0; font-size: 0.9rem; }

.detail-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin: 1.6rem 0 0;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}
.breadcrumb a { text-decoration: none; }
.meta-author, .meta-duration { color: var(--muted); font-size: 0.86rem; }

.player {
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    margin: 1rem 0 0.6rem;
}

.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.source { font-size: 0.88rem; margin: 0 0 1.5rem; }

.timecode-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }

.timecode {
    display: flex;
    gap: 0.7rem;
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.6rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.timecode:hover { background: var(--surface); border-color: var(--border); }
.timecode-position { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4rem; }

.prose > :first-child { margin-top: 0; }
.prose h3 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.prose h4 { font-size: 0.93rem; margin: 1rem 0 0.3rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose a { overflow-wrap: anywhere; }

.description, .notes, .timecodes { margin-bottom: 1.8rem; }
