/* ============================================================
   MUKBANG YT-GRID — Posters éditoriaux pastel
   Direction : magazine + playful education.
   Chaque carte = mini-poster avec icône hero, sticker matière,
   chip niveau, typographie Bricolage Grotesque pour les titres.
   ============================================================ */

body.yt-active .scroll-container { display: none !important; }
body.yt-active #mk-reco-section { display: none !important; }
body.yt-active #onboarding-tour-overlay { display: none !important; }

/* ---------- Shell ----------
   Fond ambiant qui prend la couleur de la matière scrollée actuellement.
   Transition douce entre les couleurs (cubic-bezier ~700ms).
*/
#yt-shell {
    position: fixed;
    inset: 56px 0 0 0;
    background: #fafafa;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 5;
    font-family: 'Outfit', system-ui, sans-serif;
    color: #0f172a;
}

/* Couche d'ambiance contextuelle : un wash de la couleur de la matière en cours */
#yt-shell::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 40% at 18% 8%, var(--shell-bg, #FBCFE8) 0%, transparent 55%),
        radial-gradient(ellipse 70% 40% at 82% 18%, var(--shell-bg2, #BFDBFE) 0%, transparent 55%),
        radial-gradient(ellipse 100% 30% at 50% 0%, var(--shell-bg, #FED7AA) 0%, transparent 60%);
    opacity: 0.55;
    transition: background 0.85s cubic-bezier(.4,0,.2,1), opacity 0.85s ease;
}

#yt-shell > * { position: relative; z-index: 1; }

/* ---------- Searchbar ---------- */
#yt-search {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(250, 250, 250, 0.85);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

#yt-search-wrap {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

#yt-search-input {
    width: 100%;
    padding: 13px 18px 13px 46px;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    background: #fff;
    border: 1.5px solid rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    outline: none;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03), 0 2px 8px rgba(15, 23, 42, 0.02);
    transition: all 0.2s cubic-bezier(.2,.8,.2,1);
}

#yt-search-input::placeholder { color: #94a3b8; font-weight: 500; }

#yt-search-input:focus {
    border-color: rgba(15, 23, 42, 0.18);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.06), 0 0 0 4px rgba(99, 102, 241, 0.08);
}

#yt-search-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

#yt-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

#yt-search-clear:hover { background: rgba(15, 23, 42, 0.05); color: #0f172a; }
#yt-search-clear.visible { display: inline-flex; }

/* ---------- Pills de filtres ---------- */
#yt-filters {
    position: sticky;
    top: 60px;
    z-index: 35;
    background: rgba(250, 250, 250, 0.88);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: 10px 0 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

#yt-filters-track {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#yt-filters-track::-webkit-scrollbar { display: none; }

.yt-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: var(--pill-bg, #fff);
    color: var(--pill-fg, #475569);
    border: 1.5px solid var(--pill-border, rgba(15, 23, 42, 0.06));
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s cubic-bezier(.2,.8,.2,1);
    user-select: none;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.yt-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.yt-pill.active {
    background: var(--pill-active-bg, #0f172a);
    color: var(--pill-active-fg, #fff);
    border-color: var(--pill-active-border, transparent);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.yt-pill svg { width: 14px; height: 14px; flex-shrink: 0; stroke-width: 2.2; }
.yt-pill i[data-lucide] { display: inline-flex; width: 14px; height: 14px; flex-shrink: 0; }

.yt-pill-count {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.6;
    margin-left: 2px;
    letter-spacing: 0;
}

.yt-pill.active .yt-pill-count { opacity: 0.85; }

/* ---------- BARRE NIVEAUX (sous le header de grille, non sticky) ---------- */
#yt-levels {
    margin: 4px 4px 22px;
}

#yt-levels-eyebrow {
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-left: 2px;
}

#yt-levels-track {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    flex-wrap: nowrap;
}

#yt-levels-track::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
    #yt-levels-track { flex-wrap: wrap; padding-bottom: 0; }
}

.yt-level {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    font-family: 'Outfit', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: -0.005em;
    background: transparent;
    color: #64748b;
    border: 1.5px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: all 0.16s cubic-bezier(.2,.8,.2,1);
    line-height: 1.1;
    white-space: nowrap;
}

.yt-level:hover:not(.soon) {
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.18);
    background: #fff;
}

.yt-level.active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

.yt-level-count {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.6;
}

.yt-level.active .yt-level-count { opacity: 0.85; }

.yt-level.soon {
    cursor: not-allowed;
    opacity: 0.55;
    background: rgba(15, 23, 42, 0.03);
    color: #94a3b8;
    border-color: rgba(15, 23, 42, 0.06);
    border-style: dashed;
}

.yt-level-soon {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: 10.5px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 2px;
}

/* ---------- TOC matières (3e barre sticky) ---------- */
#yt-toc {
    position: sticky;
    top: 112px;
    z-index: 33;
    background: rgba(250, 250, 250, 0.92);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: 8px 12px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
    display: none;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    white-space: nowrap;
}

#yt-toc::-webkit-scrollbar { display: none; }
#yt-toc.visible { display: flex; }

.yt-toc-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: transparent;
    color: #64748b;
    border: 1.5px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(.2,.8,.2,1);
    line-height: 1;
    white-space: nowrap;
}

.yt-toc-chip:hover {
    background: var(--ct-bg, #f3f4f6);
    color: var(--ct-fg, #475569);
    border-color: var(--ct-active, transparent);
    transform: translateY(-1px);
}

.yt-toc-chip.active {
    background: var(--ct-bg, #1f2937);
    color: var(--ct-fg, #fff);
    border-color: var(--ct-active, transparent);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.yt-toc-chip-count {
    font-size: 10.5px;
    font-weight: 700;
    opacity: 0.55;
}

.yt-toc-chip.active .yt-toc-chip-count { opacity: 0.85; }

/* ---------- Header de grille (titre éditorial) ---------- */
#yt-grid-wrap {
    padding: 14px 12px 140px;
    max-width: 1800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

@media (min-width: 640px) { #yt-grid-wrap { padding: 18px 18px 140px; } }
@media (min-width: 1000px) { #yt-grid-wrap { padding: 22px 24px 140px; } }

.yt-grid-header {
    margin: 6px 4px 16px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.yt-grid-eyebrow {
    font-family: 'Outfit', sans-serif;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.yt-grid-title {
    font-family: 'Bricolage Grotesque', 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    letter-spacing: -0.025em;
    font-variation-settings: 'opsz' 36;
}

.yt-grid-title em {
    font-family: 'Instrument Serif', 'Bricolage Grotesque', serif;
    font-style: italic;
    font-weight: 400;
    color: #475569;
    letter-spacing: -0.015em;
}

.yt-grid-count {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    padding: 5px 11px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* ---------- Grid ---------- */
#yt-grid {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

/* ===== SECTION PAR MATIÈRE ===== */
.yt-section {
    position: relative;
    scroll-margin-top: 180px;
}

.yt-section-header {
    padding: 4px 4px 16px;
    margin-bottom: 18px;
    border-bottom: 1.5px dashed color-mix(in srgb, var(--sec-text, #475569) 25%, transparent);
}

.yt-section-head-text {
    min-width: 0;
}

.yt-section-eyebrow {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: color-mix(in srgb, var(--sec-text, #475569) 80%, #94a3b8);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.yt-section-title {
    font-family: var(--sec-title-font, 'Bricolage Grotesque', sans-serif);
    font-size: 32px;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.025em;
}

.yt-section-tagline {
    font-family: 'Instrument Serif', 'Playfair Display', serif;
    font-style: italic;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
    margin: 8px 0 0;
    opacity: 0.78;
    max-width: 520px;
    letter-spacing: -0.005em;
}

@media (min-width: 640px) {
    .yt-section-title { font-size: 40px; }
    .yt-section-tagline { font-size: 18px; }
}

@media (min-width: 1000px) {
    .yt-section-title { font-size: 46px; }
    .yt-section-tagline { font-size: 19px; }
}

/* Cards grid à l'intérieur de chaque section — 3 colonnes minimum */
.yt-section-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (min-width: 480px) { .yt-section-cards { gap: 10px; } }
@media (min-width: 640px) { .yt-section-cards { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 900px) { .yt-section-cards { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 1200px) { .yt-section-cards { grid-template-columns: repeat(5, 1fr); gap: 18px; } }
@media (min-width: 1500px) { .yt-section-cards { grid-template-columns: repeat(6, 1fr); gap: 20px; } }
@media (min-width: 1800px) { .yt-section-cards { grid-template-columns: repeat(7, 1fr); gap: 22px; } }

/* ---------- Card (white, title-forward) ----------
   Variables CSS injectées par le JS via inline style :
   --c1, --c2, --c-text   = palette de la matière (accent)
   --title-font/weight/style/tracking/color = typo unique par fiche
*/
.yt-card {
    --i: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    padding: 10px 11px 12px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1),
                box-shadow 0.28s cubic-bezier(.2,.8,.2,1),
                border-color 0.28s ease;
    animation: yt-card-in 0.55s cubic-bezier(.2,.8,.2,1) backwards;
    animation-delay: calc(var(--i) * 22ms);
}

@media (min-width: 640px) {
    .yt-card { padding: 13px 13px 14px; border-radius: 16px; gap: 7px; }
}

@media (min-width: 1000px) {
    .yt-card { padding: 14px 14px 16px; border-radius: 18px; gap: 8px; }
}

/* (L'accent live maintenant à l'intérieur de la thumb, voir plus bas) */

@keyframes yt-card-in {
    0% { opacity: 0; transform: translateY(18px) scale(.985); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.yt-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 14px 32px -16px color-mix(in srgb, var(--c2, #94a3b8) 38%, rgba(15, 23, 42, 0.18)),
        0 4px 12px rgba(15, 23, 42, 0.06);
    border-color: color-mix(in srgb, var(--c2, #94a3b8) 35%, rgba(15, 23, 42, 0.06));
}

.yt-card .yt-card-accent { transition: height .25s ease; }
.yt-card:hover .yt-card-accent { height: 5px; }

/* Fade-in à l'apparition de l'image (lazy load) */
.yt-card-img {
    opacity: 0;
    animation: yt-img-in .35s ease forwards;
}
@keyframes yt-img-in {
    to { opacity: 1; }
}

.yt-card:active { transform: translateY(-1px) scale(.99); transition-duration: .12s; }

/* Ligne meta du haut : tag matière + chip niveau */
.yt-card-meta-row {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.yt-card-tag {
    font-family: 'Outfit', sans-serif;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--c-text);
    background: var(--c1);
    padding: 3px 7px;
    border-radius: 999px;
    line-height: 1;
    display: inline-block;
}

/* Chip niveau (en ligne, plus en position absolue) */
.yt-card-meta-row .yt-card-level {
    position: static;
    margin: 0;
    padding: 3px 7px;
    font-size: 8.5px;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    box-shadow: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 800;
    border-radius: 999px;
}

@media (min-width: 640px) {
    .yt-card-tag,
    .yt-card-meta-row .yt-card-level {
        font-size: 9.5px;
        padding: 4px 9px;
        letter-spacing: 0.7px;
    }
}

.yt-card-meta-row { gap: 5px; }
@media (min-width: 640px) { .yt-card-meta-row { gap: 7px; } }

/* Anciens éléments inutilisés */
.yt-card-icon,
.yt-card-letter,
.yt-card-sticker,
.yt-card-deco,
.yt-card-body,
.yt-card-foot { display: none !important; }

/* THUMBNAIL — preview screenshot du hero de la fiche */
.yt-card-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--c1, #F1F5F9), var(--c2, #E2E8F0));
    margin: -2px -2px 6px;
}

.yt-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
}

.yt-card:hover .yt-card-img {
    transform: scale(1.04);
}

/* Fallback si pas d'image : on garde le gradient + on affiche le nom matière */
.yt-card-thumb.no-img::before {
    content: attr(data-fallback);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: var(--c-text);
    opacity: 0.55;
    letter-spacing: -0.01em;
}

/* Accent bande (passe au-dessus de l'image) */
.yt-card-thumb .yt-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c1), var(--c2));
    z-index: 2;
    border-radius: 0;
}

@media (min-width: 640px) {
    .yt-card-thumb .yt-card-accent { height: 4px; }
}

/* Level badge — overlay sur la thumb en haut à droite */
.yt-card-thumb .yt-card-level {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    margin: 0;
    padding: 3px 7px;
    font-family: 'Outfit', sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    border-radius: 999px;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@media (min-width: 640px) {
    .yt-card-thumb .yt-card-level { font-size: 9.5px; padding: 4px 8px; top: 10px; right: 10px; }
}

/* Couche décorative #1 (pattern) — varie selon data-compo */
.yt-card-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
}

/* Couche décorative #2 (blob lumineux uniforme) */
.yt-card-thumb::after {
    content: '';
    position: absolute;
    width: 70%;
    height: 90%;
    top: -25%;
    right: -25%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.45), transparent 60%);
    pointer-events: none;
    transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}

/* === Composition 1 : DOTS (default) === */
.yt-card[data-compo="1"] .yt-card-thumb::before {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.55) 1px, transparent 1.4px);
    background-size: 14px 14px;
}

/* === Composition 2 : GRID (graph paper) === */
.yt-card[data-compo="2"] .yt-card-thumb::before {
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.32) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.32) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: 0.55;
}

/* === Composition 3 : STRIPES (diagonal) === */
.yt-card[data-compo="3"] .yt-card-thumb::before {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.28) 0,
        rgba(255, 255, 255, 0.28) 1.5px,
        transparent 1.5px,
        transparent 12px
    );
    opacity: 0.7;
}

/* === Composition 4 : ARCS (concentriques en coin) === */
.yt-card[data-compo="4"] .yt-card-thumb::before {
    background-image:
        radial-gradient(circle at 15% 100%, transparent 30px, rgba(255, 255, 255, 0.35) 31px, rgba(255, 255, 255, 0.35) 33px, transparent 34px),
        radial-gradient(circle at 15% 100%, transparent 55px, rgba(255, 255, 255, 0.28) 56px, rgba(255, 255, 255, 0.28) 58px, transparent 59px),
        radial-gradient(circle at 15% 100%, transparent 85px, rgba(255, 255, 255, 0.22) 86px, rgba(255, 255, 255, 0.22) 88px, transparent 89px),
        radial-gradient(circle at 15% 100%, transparent 120px, rgba(255, 255, 255, 0.16) 121px, rgba(255, 255, 255, 0.16) 123px, transparent 124px);
    opacity: 0.85;
}

/* === Composition 5 : LETTER GHOST (la lettre est visible, pattern minimal) === */
.yt-card[data-compo="5"] .yt-card-thumb::before {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0.8px, transparent 1.1px);
    background-size: 22px 22px;
    opacity: 0.35;
}
.yt-card[data-compo="5"] .yt-card-letter { display: block; }

/* ---------- Lettre fantôme (composition 5 surtout) ---------- */
.yt-card-letter {
    display: none;
    position: absolute;
    bottom: -32px;
    right: -16px;
    z-index: 0;
    font-family: var(--title-font, 'Bricolage Grotesque', sans-serif);
    font-size: 200px;
    font-weight: 900;
    font-style: var(--title-style, normal);
    line-height: 0.85;
    color: rgba(255, 255, 255, 0.55);
    text-shadow: 0 4px 18px rgba(255, 255, 255, 0.2);
    pointer-events: none;
    user-select: none;
    letter-spacing: -0.04em;
}

@media (max-width: 640px) {
    .yt-card-letter { font-size: 140px; bottom: -22px; right: -10px; }
}

/* Icône hero centrale dans une bulle glassmorphe */
.yt-card-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text, #334155);
    box-shadow:
        0 10px 28px -10px rgba(15, 23, 42, 0.18),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.85),
        inset 0 -1px 0 rgba(15, 23, 42, 0.04);
    transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
}

@media (min-width: 640px) {
    .yt-card-icon { width: 72px; height: 72px; border-radius: 24px; }
}

.yt-card-icon svg {
    width: 30px !important;
    height: 30px !important;
    stroke-width: 1.8;
}

@media (min-width: 640px) {
    .yt-card-icon svg { width: 34px !important; height: 34px !important; }
}

.yt-card-icon i[data-lucide] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Sticker matière en haut-gauche (capsule glassmorphe) */
.yt-card-sticker {
    position: absolute;
    top: 11px;
    left: 11px;
    z-index: 2;
    padding: 4px 9px 4px 8px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 999px;
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
    font-weight: 800;
    color: var(--c-text, #334155);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    line-height: 1;
}

.yt-card-sticker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-text, #334155);
    opacity: .85;
}

/* Chip niveau en haut-droite */
.yt-card-level {
    position: absolute;
    top: 11px;
    right: 11px;
    z-index: 2;
    padding: 4px 9px;
    font-family: 'Outfit', sans-serif;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
    line-height: 1;
}

/* Corner decoration : petite étoile/anneau en bas-gauche du thumb */
.yt-card-deco {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.6);
    opacity: 0.5;
}

/* Body — typographie ÉDITORIALE */
.yt-card-body {
    padding: 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

@media (min-width: 640px) {
    .yt-card-body { padding: 16px 16px 16px; }
}

/* TITRE DOMINANT — typo + couleur UNIQUES PAR FICHE */
.yt-card-title {
    font-family: var(--title-font, 'Bricolage Grotesque', 'Outfit', sans-serif);
    font-size: 14px;
    font-weight: var(--title-weight, 700);
    font-style: var(--title-style, normal);
    color: var(--title-color, var(--c-text, #0f172a));
    line-height: 1.15;
    letter-spacing: var(--title-tracking, -0.015em);
    font-variation-settings: 'opsz' 60, 'SOFT' 50;
    margin: 3px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-break: break-word;
    hyphens: auto;
}

@media (min-width: 480px) { .yt-card-title { font-size: 16px; } }
@media (min-width: 640px) { .yt-card-title { font-size: 18px; } }
@media (min-width: 900px) { .yt-card-title { font-size: 20px; } }
@media (min-width: 1200px) { .yt-card-title { font-size: 21px; } }
@media (min-width: 1500px) { .yt-card-title { font-size: 22px; } }

/* Petit emoji accent à la fin du titre (depuis fiches.json) */
.yt-card-title-emoji {
    display: inline-block;
    font-size: 0.85em;
    line-height: 1;
    vertical-align: baseline;
    margin-left: 2px;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0;
    /* Reset font pour que l'emoji soit toujours en system emoji */
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    filter: saturate(0.92);
}

.yt-card-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.35;
    letter-spacing: -0.005em;
    margin: auto 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-top: 4px;
}

@media (min-width: 480px) { .yt-card-subtitle { font-size: 11.5px; } }
@media (min-width: 640px) { .yt-card-subtitle { font-size: 12.5px; padding-top: 6px; } }
@media (min-width: 1000px) { .yt-card-subtitle { font-size: 13px; } }

.yt-card-foot {
    margin-top: auto;
    padding-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.yt-card-foot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c1, #cbd5e1), var(--c2, #94a3b8));
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6),
                0 0 0 3px var(--c2, #94a3b8);
}

/* ---------- Empty state ---------- */
#yt-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 16px;
    font-weight: 600;
    display: none;
}

#yt-empty.visible { display: block; }

/* ---------- Tweak responsive : pas trop carré sur très petit écran ---------- */
@media (max-width: 380px) {
    .yt-card-icon { width: 56px; height: 56px; }
    .yt-card-icon svg { width: 26px !important; height: 26px !important; }
    .yt-card-title { font-size: 14px; }
}

/* ============================================================
   FEATURED CARDS — 2 colonnes en desktop, icône plus grosse,
   titre plus large, plus de présence éditoriale.
   ============================================================ */
/* ============================================================
   SPOTLIGHT — première card de chaque section.
   Hero magazine : span 2 cols desktop, thumb hauteur+grosse, titre XXL.
   ============================================================ */
@media (min-width: 900px) {
    .yt-card[data-spotlight="1"] {
        grid-column: span 2;
        padding: 18px 18px 20px;
        background: linear-gradient(135deg,
            color-mix(in srgb, var(--c1, #f3f4f6) 30%, white) 0%,
            #fff 75%);
    }
    .yt-card[data-spotlight="1"] .yt-card-thumb {
        aspect-ratio: 16 / 8;
    }
    .yt-card[data-spotlight="1"] .yt-card-title {
        font-size: 26px;
        -webkit-line-clamp: 2;
    }
    .yt-card[data-spotlight="1"] .yt-card-subtitle {
        font-size: 14px;
        -webkit-line-clamp: 3;
    }
    .yt-card[data-spotlight="1"] .yt-card-tag {
        font-size: 10px;
        padding: 4px 10px;
    }
}

@media (min-width: 1200px) {
    .yt-card[data-spotlight="1"] .yt-card-title { font-size: 30px; }
}

@media (min-width: 1500px) {
    .yt-card[data-spotlight="1"] .yt-card-title { font-size: 34px; }
}

/* ============================================================
   ICÔNE FLOTTANTE — micro-animation très subtile.
   La bulle de l'icône respire (translateY de 1-2px en 4s).
   ============================================================ */
@keyframes yt-icon-float {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50%      { transform: translate(-50%, -50%) translateY(-3px); }
}

.yt-card-icon {
    animation: yt-icon-float 4.2s ease-in-out infinite;
    /* Décale chaque carte pour ne pas synchroniser tout le grid */
    animation-delay: calc(var(--i, 0) * 130ms);
}

/* Override : au hover on disable l'anim flottante au profit du scale */
.yt-card:hover .yt-card-icon {
    animation-play-state: paused;
}

/* ============================================================
   GRAIN GLOBAL — bruit SVG très léger sur tout le shell.
   ============================================================ */
#yt-shell::after {
    content: '';
    position: fixed;
    inset: 56px 0 0 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.4;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.42 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 240px 240px;
}

/* ============================================================
   HOVER REVEAL : le subtitle remonte légèrement,
   le sticker matière s'estompe pour laisser de l'air.
   ============================================================ */
.yt-card-subtitle {
    transition: transform 0.28s cubic-bezier(.2,.8,.2,1), color 0.2s;
}

.yt-card:hover .yt-card-subtitle {
    transform: translateY(-1px);
    color: #475569;
}

.yt-card-sticker {
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.yt-card:hover .yt-card-sticker {
    opacity: 0.78;
}

/* ============================================================
   FAB SCROLL-TOP — bouton flottant qui apparaît au scroll
   ============================================================ */
#yt-scroll-top {
    position: fixed;
    right: 18px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    transform: translateY(20px) scale(.85);
    pointer-events: none;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.35),
                0 4px 12px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity .28s cubic-bezier(.2,.8,.2,1),
                transform .28s cubic-bezier(.2,.8,.2,1),
                background .2s ease;
}

#yt-scroll-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#yt-scroll-top:hover {
    background: #0f172a;
    transform: translateY(-2px) scale(1.05);
}

#yt-scroll-top:active { transform: translateY(0) scale(.95); }

@media (min-width: 1000px) {
    #yt-scroll-top { right: 28px; bottom: 32px; width: 52px; height: 52px; }
}

/* ============================================================
   ACCESSIBILITÉ : respecte prefers-reduced-motion.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .yt-card-icon { animation: none; }
    .yt-card { animation: none; }
    .yt-card-subtitle, .yt-card-thumb::after, .yt-card { transition: none !important; }
    #yt-scroll-top { transition: opacity .12s ease; transform: none; }
}
