/* ===== Accueil « Découvrir » : carrousel des derniers mèmes ===== */

.discover-section {
    position: relative;
    padding: 118px 0 2rem;
    overflow: hidden;
}

.discover-section::before {
    content: '';
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 760px;
    height: 340px;
    background: radial-gradient(closest-side, rgba(135, 206, 235, 0.18), transparent);
    pointer-events: none;
}

.discover-head {
    text-align: center;
    margin-bottom: 1.6rem;
}

.discover-title {
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    font-weight: 800;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    line-height: 1.25;
}

.discover-title i {
    color: var(--primary-blue);
}

.discover-subtitle {
    margin: 0.4rem 0 0;
    color: var(--text-secondary);
    font-size: 0.98rem;
}

.discover-carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.discover-track {
    display: flex;
    gap: 1.1rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.4rem 0.2rem 1rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    cursor: grab;
}

.discover-track.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.discover-track::-webkit-scrollbar {
    display: none;
}

.discover-card {
    position: relative;
    flex: 0 0 auto;
    width: 304px;
    display: flex;
    flex-direction: column;
    text-align: left;
    padding: 0;
    border: var(--border-light);
    border-radius: 18px;
    background: var(--dark-card);
    color: var(--text-primary);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.discover-card:hover,
.discover-card:focus-visible {
    transform: translateY(-5px);
    border-color: rgba(135, 206, 235, 0.45);
    box-shadow: var(--shadow-dark);
    outline: none;
}

.discover-card--skeleton {
    height: 228px;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0.04) 30%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 70%);
    background-size: 200% 100%;
    animation: discover-shimmer 1.4s linear infinite;
    cursor: default;
}

@keyframes discover-shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.discover-card-media {
    position: relative;
    display: block;
    height: 228px;
    background: rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.discover-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    transition: transform var(--transition-smooth);
}

.discover-card:hover .discover-card-media img {
    transform: scale(1.05);
}

.discover-card-open {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(6, 18, 28, 0.72);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.discover-card-open i {
    color: var(--primary-blue);
    margin-left: 3px;
}

.discover-card:hover .discover-card-open,
.discover-card:focus-visible .discover-card-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.discover-card-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 1.6rem;
}

.discover-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.75rem;
}

.discover-empty {
    color: var(--text-secondary);
    padding: 2rem 0;
}

.discover-arrow {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: var(--border-light);
    background: var(--dark-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.discover-arrow:hover {
    background: var(--primary-steel);
    transform: scale(1.06);
}

.discover-cta {
    text-align: center;
    margin-top: 0.6rem;
}

.discover-feed-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.95rem 2.2rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-steel), var(--primary-blue));
    color: #06121c;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--glow-blue);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.discover-feed-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-steel);
}

.discover-cta-hint {
    margin: 0.6rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .discover-section { padding-top: 96px; }
    .discover-arrow { display: none; }
    .discover-track { cursor: default; }
    .discover-card { width: 232px; }
    .discover-card-media { height: 176px; }
}

/* ===== Flux plein écran ===== */

body.feed-open {
    overflow: hidden;
}

/* L'assistant IA ne doit pas flotter au-dessus du flux. */
body.feed-open #memehubChatbot,
body.feed-open #cookieBanner,
body.feed-open .mobile-bottom-nav {
    display: none !important;
}

.feed-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    background: #05070c;
}

.feed-overlay[hidden] {
    display: none;
}

.feed-stage {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    transition: margin-right var(--transition-smooth), height var(--transition-smooth);
}

.feed-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1.2rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

.feed-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-weight: 700;
}

.feed-brand i {
    color: var(--primary-blue);
}

.feed-close {
    pointer-events: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.feed-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.feed-scroller {
    position: relative;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    outline: none;
}

.feed-scroller::-webkit-scrollbar {
    display: none;
}

.feed-item {
    position: relative;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Flou de remplissage quand le média ne couvre pas tout l'écran. */
.feed-backdrop {
    position: absolute;
    inset: -8%;
    background-position: center;
    background-size: cover;
    filter: blur(38px) brightness(0.45) saturate(1.2);
    transform: scale(1.08);
    pointer-events: none;
}

.feed-backdrop--plain {
    background: radial-gradient(circle at 50% 40%, #1b2333, #05070c);
    filter: none;
}

.feed-frame {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-frame.has-ratio {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.feed-media-el {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

/* Zone cliquable qui couvre le média : un clic met en pause / relance. */
.feed-media-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.feed-frame--audio .feed-media-el {
    object-fit: cover;
    border-radius: 18px;
}

/* ----- Lecteur maison ----- */

.feed-player-big {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 78px;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 1.7rem;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.feed-item.is-playing .feed-player-big {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.2);
}

.feed-player {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.9rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
}

.feed-player-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.feed-player-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

.feed-player-track {
    position: relative;
    flex: 1 1 auto;
    height: 22px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.feed-player-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 9px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
}

.feed-player-progress {
    position: relative;
    height: 4px;
    width: 0;
    border-radius: 999px;
    background: var(--primary-blue);
    transition: height var(--transition-fast);
}

.feed-player-progress::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transform: translateY(-50%) scale(0);
    transition: transform var(--transition-fast);
}

.feed-player-track:hover .feed-player-progress::after,
.feed-player-track.is-seeking .feed-player-progress::after {
    transform: translateY(-50%) scale(1);
}

.feed-player-track.is-seeking .feed-player-progress,
.feed-player-track:hover .feed-player-progress {
    height: 6px;
}

.feed-player-time {
    flex: 0 0 auto;
    min-width: 42px;
    color: #fff;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

/* ----- Légende dans le média ----- */

.feed-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    pointer-events: none;
    padding: 2.5rem 5.5rem 1rem 1.1rem;
    color: #fff;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.35) 55%, transparent);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.feed-frame--video .feed-caption,
.feed-frame--audio .feed-caption {
    padding-bottom: 3.2rem;
}

.feed-item-title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.feed-item-desc {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.82);
    max-height: 40vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.feed-item-desc::-webkit-scrollbar {
    display: none;
}

/* Une fois dépliée, la description doit pouvoir être parcourue. */
.feed-item-desc.is-expanded {
    pointer-events: auto;
}

.feed-desc-more {
    margin-left: 0.35rem;
    padding: 0;
    border: none;
    background: none;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    pointer-events: auto;
    white-space: nowrap;
}

.feed-desc-more:hover {
    color: var(--primary-blue);
}

/* ----- Colonne d'actions ----- */

.feed-rail {
    position: absolute;
    right: 1rem;
    bottom: 5.4rem;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
}

.feed-rail-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.feed-act {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.feed-act:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: scale(1.06);
}

.feed-act.is-liked {
    color: var(--accent-pink);
    border-color: rgba(236, 72, 153, 0.55);
}

.feed-act-count {
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.feed-status {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.feed-status[hidden] {
    display: none;
}

/* ===== Panneaux (commentaires, partage) ===== */

.feed-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    z-index: 6;
    display: flex;
    flex-direction: column;
    background: #10141d;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateX(100%);
    transition: transform var(--transition-smooth);
}

.feed-panel.is-open {
    transform: translateX(0);
}

.feed-panel.is-dragging {
    transition: none;
}

.feed-panel-handle {
    display: none;
}

.feed-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.feed-panel-head h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.feed-panel-head span {
    color: var(--text-muted);
    font-weight: 500;
}

.feed-panel-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    cursor: pointer;
}

.feed-comments-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-comment {
    display: flex;
    gap: 0.7rem;
}

.feed-comment img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.feed-comment-head {
    margin: 0 0 0.15rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.feed-comment-head time {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.feed-comment-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.feed-comments-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    margin: auto 0;
}

.feed-comment-form {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.feed-comment-form textarea {
    flex: 1 1 auto;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: var(--border-light);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.feed-comment-form textarea:focus {
    outline: none;
    border-color: rgba(135, 206, 235, 0.5);
}

.feed-comment-form button {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-steel);
    color: #fff;
    cursor: pointer;
}

.feed-comment-form button:hover {
    background: var(--primary-blue);
    color: #06121c;
}

/* ----- Contenu du panneau partage ----- */

.feed-share-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.feed-share-list button {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 0.9rem;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.feed-share-list button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.feed-share-list button i {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(135, 206, 235, 0.15);
    color: var(--primary-blue);
    flex: 0 0 auto;
}

.feed-share-list button span {
    display: flex;
    flex-direction: column;
}

.feed-share-list button small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ----- Desktop : le flux se décale quand un panneau s'ouvre ----- */

@media (min-width: 901px) {
    body.feed-panel-open .feed-stage {
        margin-right: 380px;
    }
}

/* ----- Mobile : feuille basse, le mème se réduit au-dessus ----- */

@media (max-width: 900px) {
    .feed-caption {
        padding: 2.2rem 4.6rem 0.9rem 0.9rem;
    }

    .feed-rail {
        right: 0.6rem;
        bottom: 5rem;
        gap: 0.9rem;
    }

    .feed-act {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }

    body.feed-panel-open .feed-stage {
        height: 38dvh;
    }

    .feed-panel {
        top: auto;
        bottom: 0;
        width: 100%;
        height: 62dvh;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
    }

    .feed-panel.is-open {
        transform: translateY(0);
    }

    .feed-panel-handle {
        display: block;
        width: 44px;
        height: 4px;
        margin: 0.6rem auto 0.2rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.28);
        cursor: grab;
        touch-action: none;
    }

    .feed-panel-head {
        padding: 0.7rem 1rem;
        touch-action: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .feed-stage,
    .feed-panel {
        transition: none;
    }
}
