/* Parallax SN - Event/Festival cards component (mobile first)
   Thème CLAIR par défaut (= site public). Démo sombre : ajouter .ec-theme-dark */
:root {
    --px-bg: #ffffff;
    --px-surface: #ffffff;
    --px-surface-soft: #f4f6f8;
    --px-border: rgba(26, 26, 46, 0.12);
    --px-text: #1a1a2e;
    --px-text-muted: #4a5568;
    --px-accent: #c48a00;
    --px-accent-2: #00688c;
    --px-shadow: 0 4px 16px rgba(26, 26, 46, 0.08);
    --px-radius-card: 14px;
    --px-radius-chip: 999px;
}

/* Option démo / pack sombre uniquement */
.ec-theme-dark {
    --px-bg: #0a0f17;
    --px-surface: #111927;
    --px-surface-soft: #172233;
    --px-border: rgba(255, 255, 255, 0.09);
    --px-text: #f1f5f9;
    --px-text-muted: #a7b1c2;
    --px-accent: #fcbc00;
    --px-accent-2: #00a19a;
    --px-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

.px-feed {
    display: grid;
    gap: 16px;
    padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
}

.px-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--px-radius-card);
    border: 1px solid var(--px-border);
    background: var(--px-surface);
    color: var(--px-text);
    box-shadow: var(--px-shadow);
}
.ec-theme-dark .px-card {
    background:
        radial-gradient(130% 90% at 0% 0%, rgba(0, 161, 154, 0.14), transparent 55%),
        linear-gradient(170deg, var(--px-surface) 0%, #0d1522 100%);
}

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

.px-media-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eef1f4;
}
.ec-theme-dark .px-media-wrap {
    background: linear-gradient(140deg, #0f1725, #1a2738);
}

.px-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.px-media-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 1.75rem;
}

.px-card-body {
    padding: 14px 14px 15px;
}

.px-title {
    margin: 0;
    font-family: "Barlow", "Segoe UI", Tahoma, sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.4vw, 1.15rem);
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.px-meta-list {
    margin: 10px 0 0;
    display: grid;
    gap: 6px;
}

.px-meta {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--px-text-muted);
    font-size: 0.92rem;
    line-height: 1.35;
}

.px-meta-icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(252, 188, 0, 0.14);
    color: var(--px-accent);
    font-size: 0.78rem;
}

.px-price-chip {
    margin-top: 12px;
    width: fit-content;
    max-width: 100%;
    border-radius: var(--px-radius-chip);
    border: 1px solid rgba(0, 161, 154, 0.32);
    background: rgba(0, 161, 154, 0.16);
    color: #dffcf9;
    padding: 5px 10px;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Festival super-card */
.px-festival {
    padding: 14px;
}

.px-festival-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.px-festival-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--px-radius-chip);
    border: 1px solid rgba(252, 188, 0, 0.4);
    color: #ffe7a0;
    background: rgba(252, 188, 0, 0.12);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 5px 10px;
}

.px-festival-title {
    margin: 0;
    font-family: "Barlow", "Segoe UI", Tahoma, sans-serif;
    font-size: clamp(1.05rem, 2.7vw, 1.25rem);
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.px-festival-strip-wrap {
    position: relative;
}

.px-festival-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 76%);
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 2px;
    margin-inline: -2px;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 2px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* pan-y autorisé : sinon le scroll vertical de la page est bloqué sur Android */
    touch-action: pan-x pan-y pinch-zoom;
}

.px-festival-strip::-webkit-scrollbar {
    display: none;
}

.px-sub-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(170deg, var(--px-surface-soft), #0f1826);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.px-sub-card .px-media-wrap {
    aspect-ratio: 16 / 9;
}

.px-sub-card .px-card-body {
    padding: 10px 11px 12px;
}

.px-sub-card .px-title {
    font-size: 0.97rem;
}

.px-sub-card .px-meta {
    font-size: 0.83rem;
}

.px-sub-card .px-price-chip {
    margin-top: 8px;
    font-size: 0.78rem;
    padding: 4px 8px;
}

/* Optional left/right fades to indicate horizontal content */
.px-festival-strip-wrap::before,
.px-festival-strip-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 2;
}

.px-festival-strip-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(10, 15, 23, 0.95), rgba(10, 15, 23, 0));
}

.px-festival-strip-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(10, 15, 23, 0.95), rgba(10, 15, 23, 0));
}

@media (min-width: 700px) {
    .px-feed {
        gap: 18px;
        padding-inline: 0;
    }

    .px-card-body {
        padding: 16px;
    }

    .px-festival {
        padding: 16px;
    }

    .px-festival-strip {
        grid-auto-columns: minmax(250px, 38%);
        gap: 14px;
    }
}

@media (min-width: 1024px) {
    .px-feed {
        gap: 20px;
    }

    .px-festival-strip {
        grid-auto-columns: minmax(260px, 30%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .px-festival-strip {
        scroll-behavior: auto;
    }
}

/* ==========================================================================
   .ec-card — Composant carte événement (Festival + Solo)
   ========================================================================== */

/* --- Wrapper du fil ---------------------------------- */
.px-feed:has(.ec-card) {
    max-width: none;
    margin-inline: 0;
}
.ec-feed-wrap .px-feed {
    padding-inline: 0;
}
.ec-card--solo,
.ec-card--festival {
    max-width: 100%;
}
.ec-feed-wrap {
    max-width: none;
    margin-inline: 0;
}

/* --- Conteneur Parent — clair ------------------------------------ */
.ec-card {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #1a1a2e;
    box-shadow: 0 2px 10px rgba(26, 26, 46, 0.06);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
    .ec-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 24px rgba(0, 104, 140, 0.12);
        border-color: #00a19a;
    }
}

.px-feed:has(.ec-card),
.ec-feed-wrap .px-feed {
    gap: 12px;
}

/* --- Festival : en-tête clair ------------- */
.ec-fest-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-bottom: 1px solid #eee;
    min-height: 64px;
}

.ec-fest-thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
}

.ec-fest-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-fest-text {
    flex: 1 1 0;
    min-width: 0;
}

.ec-fest-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #00688c;
    background: rgba(0, 161, 154, 0.12);
    border-radius: 999px;
    padding: 2px 8px;
    margin-bottom: 4px;
}

.ec-fest-title {
    margin: 0;
    font-family: "Barlow", "Segoe UI", Tahoma, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a2e;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-fest-dates {
    margin: 3px 0 0;
    font-size: 0.85rem;
    color: #555;
}

.ec-fest-chevron {
    flex-shrink: 0;
    color: #999;
    font-size: 1.5rem;
    line-height: 1;
}

/* Legacy header sombre → clair */
.ec-header {
    display: flex !important;
    align-items: center;
    gap: 12px;
    position: relative !important;
    aspect-ratio: auto !important;
    max-height: none !important;
    min-height: 64px;
    padding: 12px 14px;
    background: #fff !important;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #1a1a2e;
}
.ec-header-img {
    position: static !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.ec-header-overlay {
    position: static !important;
    inset: auto !important;
    background: none !important;
    padding: 0 !important;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.ec-header-tag {
    color: #00688c !important;
    background: rgba(0, 161, 154, 0.12) !important;
    border-color: transparent !important;
    font-size: 0.7rem;
}
.ec-header-title {
    color: #1a1a2e !important;
    text-shadow: none !important;
    font-size: 1.05rem !important;
}
.ec-header-dates {
    color: #555 !important;
    font-size: 0.85rem !important;
}

/* Rail horizontal (base ; desktop passe en grille plus bas) */
.ec-rail-wrap {
    position: relative;
    padding: 12px 0 14px;
    background: #f8f9fa;
}

.ec-rail {
    gap: 12px;
    padding-inline: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.ec-rail::-webkit-scrollbar {
    height: 6px;
}
.ec-rail::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.ec-micro-item {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    text-decoration: none;
    color: #1a1a2e;
    scroll-snap-align: start;
    transition: border-color 0.15s, box-shadow 0.15s;
}
@media (hover: hover) {
    .ec-micro-item:hover {
        border-color: #00a19a;
        box-shadow: 0 4px 14px rgba(0, 104, 140, 0.1);
    }
}

.ec-micro-img-wrap {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f3f4f6;
}

.ec-micro-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-micro-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-size: 1.4rem;
    background: #f3f4f6;
}

.ec-micro-body {
    padding: 8px 9px 10px;
}

.ec-micro-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a2e;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-micro-date {
    margin: 4px 0 0;
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ec-rail-wrap::before,
.ec-rail-wrap::after {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 14px;
    width: 16px;
    pointer-events: none;
    z-index: 2;
}

.ec-rail-wrap::before {
    left: 0;
    background: linear-gradient(to right, #f8f9fa, transparent);
}

.ec-rail-wrap::after {
    right: 0;
    background: linear-gradient(to left, #f8f9fa, transparent);
}

/* --- Solo : DESKTOP-FIRST = cartes verticales en grille ------------------- */
.ec-feed-wrap .px-feed,
.px-feed:has(.ec-card) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 22px;
    align-items: stretch;
}

.ec-card--solo {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 0;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.ec-solo-img-wrap {
    flex: none;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f3f4f6;
    border-bottom: 3px solid #00a19a;
}

.ec-solo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-solo-placeholder {
    width: 100%;
    height: 100%;
    min-height: 180px;
    display: grid;
    place-items: center;
    color: #9ca3af;
    font-size: 2.5rem;
    background: #f3f4f6;
}

.ec-solo-info {
    flex: 1;
    min-width: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.ec-solo-fest {
    display: inline-block;
    width: fit-content;
    margin: 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(0, 161, 154, 0.12);
    color: #00688c;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ec-solo-title {
    margin: 0;
    font-family: "Barlow", "Segoe UI", Tahoma, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1a2e;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ec-solo-meta {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.88rem;
    color: #555;
    white-space: normal;
}

.ec-solo-meta-icon {
    flex: 0 0 auto;
    font-size: 0.72rem;
}

.ec-solo-price {
    margin: auto 0 0;
    align-self: flex-start;
    display: inline-block;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid rgba(0, 104, 140, 0.22);
    background: rgba(0, 161, 154, 0.1);
    color: #00688c;
    padding: 4px 10px;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.35;
}

/* Festival (si utilisé hors day-feed) : grille de flyers adaptative */
.ec-card--festival {
    grid-column: 1 / -1;
}
.ec-rail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    overflow: visible;
    padding: 14px;
    scroll-snap-type: none;
}
.ec-micro-item {
    flex: none;
    width: auto;
    min-width: 0;
}
.ec-rail-wrap::before,
.ec-rail-wrap::after {
    display: none;
}

@media (min-width: 1024px) {
    .ec-feed-wrap .px-feed,
    .px-feed:has(.ec-card) {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 24px;
    }
    .ec-solo-img-wrap {
        height: 200px;
    }
    .ec-solo-placeholder {
        min-height: 200px;
    }
    .ec-rail {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 16px;
    }
}

/* --- Mobile : lignes compactes + rail horizontal festivals ---------------- */
@media (max-width: 767px) {
    .ec-feed-wrap .px-feed,
    .px-feed:has(.ec-card) {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ec-card--solo {
        flex-direction: row;
        min-height: 76px;
        height: auto;
    }
    .ec-solo-img-wrap {
        flex: 0 0 76px;
        width: 76px;
        height: auto;
        border-bottom: none;
    }
    .ec-solo-placeholder {
        min-height: 76px;
        font-size: 1.4rem;
    }
    .ec-solo-info {
        padding: 10px 12px;
        gap: 4px;
        justify-content: center;
    }
    .ec-solo-title {
        font-size: 0.98rem;
        -webkit-line-clamp: 2;
    }
    .ec-solo-meta {
        font-size: 0.84rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ec-solo-price {
        margin: 0;
        padding: 2px 8px;
        font-size: 0.78rem;
    }

    .ec-rail {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-inline: 14px;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 14px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        touch-action: pan-x pan-y pinch-zoom;
    }
    .ec-micro-item {
        flex: 0 0 140px;
        width: 140px;
    }
    .ec-rail-wrap::before,
    .ec-rail-wrap::after {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ec-card,
    .ec-micro-item {
        transition: none;
    }
    .ec-card:hover {
        transform: none;
    }
}
