/* ===== POLICES FALLBACK ANDROID — évite le freeze rendu ===== */
/* font-display:optional = jamais de swap visible, fallback immédiat */
@font-face {
    font-family: 'Cormorant Garamond';
    font-display: optional;
    src: local('Georgia');
}
@font-face {
    font-family: 'Outfit';
    font-display: optional;
    src: local('-apple-system'), local('system-ui');
}

/* Polices chargées via <link> non-bloquant ci-dessous — @import supprimé */

:root {
    --myso-primary:    #1a1f16;
    --myso-sage:       #7d9a78;
    --myso-sage-light: #a8c4a2;
    --myso-forest:     #3d5a3d;
    --myso-terracotta: #c67b5c;
    --myso-cream:      #faf8f5;
    --myso-sand:       #e8e2d9;
    --myso-font-serif: 'Cormorant Garamond', Georgia, serif;
    --myso-font-body:  'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== RESET MOBILE ===== */
.myso-carousel-section *,
.myso-carousel-section *::before,
.myso-carousel-section *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* ✅ iOS Safari : empêche zoom auto au tap */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ===== SECTION ===== */
.myso-carousel-section {
    padding: clamp(2.5rem, 6vw, 4rem) 0;
    background: var(--myso-cream);
    font-family: var(--myso-font-body);
    overflow: hidden;
    max-width: 100%;
    width: 100%;
    position: relative;
    /* ✅ FIX CLS : hauteur réservée avant chargement JS */
    min-height: 600px;
}

/* ===== EN-TÊTE ===== */
.myso-carousel-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    padding: 0 clamp(1rem, 4vw, 2rem);
}

.myso-carousel-header h2 {
    font-family: var(--myso-font-serif);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 500;
    color: var(--myso-primary);
    margin: 0 0 0.5rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.myso-carousel-header h2 em {
    font-style: italic;
    color: var(--myso-sage);
}

.myso-carousel-header p {
    font-size: clamp(0.88rem, 2vw, 1.05rem);
    color: #666;
    margin: 0;
    line-height: 1.6;
}

/* ===== CAROUSEL CONTENEUR ===== */
.myso-carousel-outer {
    position: relative;
    width: 100%;
}

.myso-carousel-viewport {
    overflow: hidden;
    width: 100%;
    /* ✅ Hauteur exacte = image 200px + body ~150px + padding 40px = 390px
       Skeleton et vraies cards ont exactement la même hauteur → zéro saut */
    min-height: 390px;
    /* ✅ iOS/Android : scroll tactile vertical autorisé */
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}

.myso-carousel-viewport:active { cursor: grabbing; }

.myso-carousel-track {
    display: flex;
    gap: clamp(0.75rem, 2vw, 1.25rem);
    padding: 0.5rem 0.75rem 1.5rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* ✅ Empêche le scroll horizontal parasite sur Android */
}

/* ===== CARDS ===== */
.myso-product-card {
    flex: 0 0 calc(100vw - 1.5rem);
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: var(--myso-primary);
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* ✅ FIX ANDROID CLS : hauteur fixe = skeleton = vraie card
       Empêche tout reflow au remplacement */
    height: 390px;
}

.myso-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(61,90,61,0.15);
    text-decoration: none;
    color: var(--myso-primary);
}

/* ===== IMAGE ===== */
.myso-card-image {
    position: relative;
    width: 100%;
    /* ✅ Même hauteur que .myso-skeleton-img → identique avant/après remplacement */
    height: 235px;
    overflow: hidden;
    background: var(--myso-sand);
    flex-shrink: 0;
}

.myso-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 20% top;
    transition: transform 0.4s ease;
    display: block;
    max-width: 100%;
}

.myso-product-card:hover .myso-card-image img {
    transform: scale(1.05);
}

/* Badge tokens */
.myso-token-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: var(--myso-forest);
    color: white;
    font-family: var(--myso-font-body);
    font-size: clamp(0.62rem, 1.4vw, 0.7rem);
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.18);
    line-height: 1.4;
    white-space: nowrap;
    z-index: 2;
    text-align: center;
}
.myso-token-badge .myso-badge-tokens {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.myso-token-badge .myso-badge-euros {
    font-size: 0.9em;
    font-weight: 500;
    opacity: 0.82;
    border-top: 1px solid rgba(255,255,255,0.25);
    padding-top: 0.15rem;
    width: 100%;
    text-align: center;
}

/* Badge état */
.myso-condition-badge {
    position: absolute;
    top: 10px; left: 10px;
    font-family: var(--myso-font-body);
    font-size: clamp(0.58rem, 1.3vw, 0.65rem);
    font-weight: 600;
    padding: 0.22rem 0.5rem;
    border-radius: 50px;
    line-height: 1;
    white-space: nowrap;
    z-index: 2;
}
.myso-condition-badge.new,
.myso-condition-badge.excellent { background: #e1f5ee; color: #0f6e56; }
.myso-condition-badge.good      { background: #e6f1fb; color: #185fa5; }
.myso-condition-badge.fair      { background: #faeeda; color: #854f0b; }
.myso-condition-badge.poor      { background: #fcebeb; color: #a32d2d; }

/* Placeholder si pas d'image */
.myso-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 0.75rem;
    gap: 0.4rem;
    text-align: center;
    padding: 1rem;
}

/* ===== CORPS DE CARD ===== */
.myso-card-body {
    padding: clamp(0.75rem, 3vw, 1rem);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.myso-card-brand {
    font-size: clamp(0.65rem, 1.4vw, 0.75rem);
    font-weight: 600;
    color: var(--myso-sage);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.myso-card-name {
    font-family: var(--myso-font-serif);
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    font-weight: 500;
    color: var(--myso-primary);
    line-height: 1.3;
    /* Tronque à 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.myso-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.myso-card-tag {
    font-size: clamp(0.62rem, 1.3vw, 0.68rem);
    font-weight: 500;
    padding: 0.18rem 0.5rem;
    border-radius: 50px;
    background: var(--myso-sand);
    color: #555;
    white-space: nowrap;
    line-height: 1.4;
}

/* ===== NAVIGATION ===== */
.myso-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding: 0 1rem;
}

.myso-carousel-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--myso-sage);
    background: white;
    color: var(--myso-forest);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    flex-shrink: 0;
    /* ✅ iOS/Android : tap réactif */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* ✅ Zone de tap suffisante */
    min-width: 44px;
    min-height: 44px;
}
.myso-carousel-btn:hover:not(:disabled) {
    background: var(--myso-forest);
    border-color: var(--myso-forest);
    color: white;
}
.myso-carousel-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.myso-carousel-btn svg {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2.5;
    stroke-linecap: round; stroke-linejoin: round;
}

/* Dots */
.myso-carousel-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.myso-carousel-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--myso-sand);
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    /* ✅ Zone de tap agrandie */
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.myso-carousel-dot::after {
    content: '';
    position: absolute;
    top: -8px; left: -8px;
    right: -8px; bottom: -8px;
}
.myso-carousel-dot.active {
    background: var(--myso-sage);
    transform: scale(1.3);
}




/* ===== BARRE DE CHARGEMENT ===== */
.myso-loading-bar {
    width: 100%;
    height: 3px;
    background: var(--myso-sand);
    overflow: hidden;
    position: relative;
    /* Visible pendant le fetch, cachée après */
    transition: opacity 0.4s ease;
}
.myso-loading-bar.hidden {
    opacity: 0;
    pointer-events: none;
}
.myso-loading-bar-inner {
    position: absolute;
    top: 0; left: -50%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--myso-sage), var(--myso-forest), var(--myso-sage), transparent);
    animation: mysoBarSlide 1.2s ease-in-out infinite;
}
@keyframes mysoBarSlide {
    0%   { left: -50%; }
    100% { left: 150%; }
}
@media (prefers-reduced-motion: reduce) {
    .myso-loading-bar-inner { animation: none; background: var(--myso-sage); }
}

/* ===== SKELETON LOADER ===== */
.myso-skeleton-card {
    flex: 0 0 calc(100vw - 1.5rem);
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    flex-shrink: 0;
    /* ✅ Même hauteur que .myso-product-card → zéro reflow Android */
    height: 390px;
}

.myso-skeleton-img {
    width: 100%;
    /* image = 390px - 1rem padding - 3 lignes (11px + 9px margin) x3 = ~235px */
    height: 235px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: mySoShimmer 1.5s infinite;
}

.myso-skeleton-body { padding: 1rem; }
.myso-skeleton-line {
    height: 11px; border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: mySoShimmer 1.5s infinite;
    margin-bottom: 9px;
}
.myso-skeleton-line.short  { width: 45%; }
.myso-skeleton-line.medium { width: 70%; }
.myso-skeleton-line.long   { width: 90%; }

@keyframes mySoShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== ERREUR ===== */
.myso-carousel-error {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
    font-family: var(--myso-font-body);
    font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
/* Mobile < 640px : 1 card (calc 100vw - padding) — défaut ci-dessus */

@media (min-width: 640px) {
    .myso-product-card,
    .myso-skeleton-card { flex: 0 0 220px; height: 370px; }
    .myso-card-image, .myso-skeleton-img { height: 215px; }
}

@media (min-width: 768px) {
    .myso-product-card,
    .myso-skeleton-card { flex: 0 0 235px; height: 370px; }
    .myso-card-image, .myso-skeleton-img { height: 215px; }
}

@media (min-width: 1024px) {
    .myso-product-card,
    .myso-skeleton-card { flex: 0 0 250px; height: 380px; }
    .myso-card-image, .myso-skeleton-img { height: 220px; }
}


/* ===== FIX ANDROID CLS MOBILE ===== */
@media (max-width: 639px) {
    /* Hauteur totale verrouillée : skeleton = cards = viewport */
    .myso-product-card,
    .myso-skeleton-card {
        height: 390px !important;
        min-height: 390px !important;
        max-height: 390px !important;
    }
    .myso-card-image,
    .myso-skeleton-img {
        height: 235px !important;
        min-height: 235px !important;
        max-height: 235px !important;
        flex-shrink: 0 !important;
    }
    .myso-card-body {
        height: 155px !important;
        overflow: hidden;
    }
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
    .myso-carousel-track,
    .myso-card-image img,
    .myso-product-card { transition: none !important; animation: none !important; }
    .myso-skeleton-img,
    .myso-skeleton-line { animation: none; background: #f0f0f0; }
}

/* ===== TRÈS PETIT ÉCRAN 360px ===== */
@media (max-width: 360px) {
    .myso-carousel-header h2 { font-size: 1.6rem; }
    /* Sur 360px, calc(100vw - 2rem) = 344px — correct, pas besoin d'override */
}