/* ============================================================
   poster-mobile.css
   Design system "Liquid Glass" iOS 2026 — Commerce Éthique Club
   Actif jusqu'à 767px de large — portrait ET paysage

   Comportement "web app" : la zone de contenu occupe exactement
   l'espace entre le header-mobile et la bottom-nav (tous deux
   fixes), sans scroll de page. Les cartes s'étirent en grille
   pour remplir tout l'espace disponible plutôt que de garder
   une hauteur fixe entourée de vide.

   ⚠️ À AJUSTER : --header-h et --bottomnav-h doivent correspondre
   à la hauteur RÉELLE de .header-mobile et .bottom-nav définies
   dans header-mobile.css. Si ton header/bottom-nav ont une
   hauteur différente, change juste ces deux variables.
   ============================================================ */

:root {
    --accent: #1abc9c;
    --accent-dark: #0f6e56;
    --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent-dark));

    --ink: #16241f;
    --ink-soft: rgba(22, 36, 31, .62);

    --glass-bg: rgba(255, 255, 255, .3);
    --glass-bg-strong: rgba(255, 255, 255, .4);
    --glass-border: rgba(255, 255, 255, .35);
    --glass-blur: blur(24px) saturate(180%);
    --glass-shadow: 0 6px 24px rgba(15, 110, 86, .16);

    --glass-dark: rgba(18, 30, 26, .45);
    --glass-dark-strong: rgba(18, 30, 26, .56);
    --glass-dark-border: rgba(255, 255, 255, .14);
    --glass-dark-shadow: 0 6px 24px rgba(0, 0, 0, .45);

    --radius-lg: 16px;
    --radius-pill: 999px;

    --ease: cubic-bezier(.22, 1, .36, 1);

    /* Hauteurs des barres fixes du site — à recaler sur les vraies valeurs */
    --header-h: 56px;
    --bottomnav-h: 64px;
}

/* ── Base commune mobile (portrait + paysage) ── */
@media (max-width: 767px) {

    html, body.poster-page {
        height: 100%;
        margin: 0;
    }

    body.poster-page {
        font-family: -apple-system, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
        color: var(--ink);
        position: relative;
        overflow: hidden; /* pas de scroll de page — tout tient dans l'écran */
        background: linear-gradient(160deg, #eefaf6 0%, #e3f5ee 35%, #eaf3fb 70%, #e4edf7 100%);
        transition: background .35s var(--ease);
    }
    body.poster-page.dark-mode {
        background: linear-gradient(160deg, #0d1613 0%, #101c18 45%, #0c1720 100%);
    }

    .poster-blob {
        position: fixed;
        border-radius: 50%;
        filter: blur(56px);
        opacity: .35;
        z-index: 0;
        pointer-events: none;
        animation: poster-float 18s var(--ease) infinite;
    }
    .poster-blob--1 { width: 200px; height: 200px; background: var(--accent); top: -60px; left: -60px; }
    .poster-blob--2 { width: 180px; height: 180px; background: var(--accent-dark); bottom: -70px; right: -50px; animation-delay: -6s; }
    .poster-blob--3 { width: 140px; height: 140px; background: #8fe3cf; top: 45%; left: 62%; animation-delay: -11s; }

    @keyframes poster-float {
        0%, 100% { transform: translate(0, 0) scale(1); }
        50%      { transform: translate(14px, -14px) scale(1.05); }
    }

    /* ── Zone de contenu : calée EXACTEMENT entre header et bottom-nav ── */
    .poster-main {
        position: fixed;
        top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
        bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        z-index: 1;
        display: flex;
        flex-direction: column;
        padding: 14px 14px 10px;
        padding-left: calc(14px + env(safe-area-inset-left, 0px));
        padding-right: calc(14px + env(safe-area-inset-right, 0px));
        overflow: hidden; /* le contenu remplit, il ne dépasse jamais */
        box-sizing: border-box;
    }

    .poster-hero {
        flex: 0 0 auto;
        text-align: center;
        margin-bottom: 12px;
    }

    .poster-title {
        font-size: clamp(1.1rem, 5vw, 1.4rem);
        font-weight: 600;
        letter-spacing: -.01em;
        margin: 0 0 4px;
        color: var(--ink);
    }
    body.poster-page.dark-mode .poster-title { color: #eaf6f1; }

    .poster-subtitle {
        font-size: 12px;
        margin: 0;
        color: var(--ink-soft);
    }
    body.poster-page.dark-mode .poster-subtitle { color: rgba(234, 246, 241, .62); }

    .poster-form { margin: 0; min-height: 0; }

    /* ── Grille : occupe tout l'espace restant, les cartes s'étirent ── */
    .poster-grid {
        flex: 1 1 auto;
        min-height: 0; /* indispensable pour que la grille se contracte dans le flex */
        display: grid;
        gap: 12px;
    }

    .poster-card {
        width: 100%;
        height: 100%;
        min-height: 0;
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-lg);
        background: var(--glass-bg);
        -webkit-backdrop-filter: var(--glass-blur);
        backdrop-filter: var(--glass-blur);
        box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .5);
        color: var(--ink);
        font-family: inherit;
        cursor: pointer;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 8px;
        box-sizing: border-box;
        transition: transform .28s var(--ease), background .28s var(--ease), box-shadow .28s var(--ease), border-color .28s var(--ease);
    }
    body.poster-page.dark-mode .poster-card {
        background: var(--glass-dark);
        border-color: var(--glass-dark-border);
        box-shadow: var(--glass-dark-shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
        color: #eaf6f1;
    }

    .poster-card__icon {
        border-radius: var(--radius-pill);
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--glass-bg-strong);
        border: 1px solid var(--glass-border);
        transition: transform .26s var(--ease), background .26s var(--ease);
        flex-shrink: 0;
        width: 32px;
        height: 32px;
    }
    body.poster-page.dark-mode .poster-card__icon {
        background: var(--glass-dark-strong);
        border-color: var(--glass-dark-border);
    }

    .poster-card__icon i {
        font-size: 14px;
        background: var(--accent-gradient);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .poster-card__label {
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
    }

    .poster-card:active {
        transform: scale(.97);
        background: var(--glass-bg-strong);
    }
    body.poster-page.dark-mode .poster-card:active { background: var(--glass-dark-strong); }

    .poster-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

    .poster-locked-note {
        flex: 0 0 auto;
        margin: 10px 0 0;
        text-align: center;
        font-size: 11px;
        color: var(--ink-soft);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    body.poster-page.dark-mode .poster-locked-note { color: rgba(234, 246, 241, .62); }

    /* ── Portrait : grille 2×2, chaque carte occupe sa cellule en entier ── */
    @media (orientation: portrait) {
        .poster-grid {
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }
        .poster-card__icon { width: 34px; height: 34px; }
        .poster-card__icon i { font-size: 15px; }
        .poster-card__label { font-size: 13px; }
    }

    /* ── Paysage : une seule ligne de 4 cartes, hauteur = tout l'espace dispo ── */
    @media (orientation: landscape) {
        .poster-main { padding: 10px 14px; }
        .poster-hero { margin-bottom: 8px; }

        .poster-grid {
            grid-template-columns: repeat(4, 1fr);
            grid-template-rows: 1fr;
        }
        .poster-card { gap: 6px; padding: 6px; }
        .poster-card__icon { width: 28px; height: 28px; }
        .poster-card__icon i { font-size: 12px; }
        .poster-card__label { font-size: 11px; }
    }

    /* Paysage sur petit téléphone à plat : 2×2 pour garder des cartes lisibles */
    @media (orientation: landscape) and (max-height: 400px) {
        .poster-grid {
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(2, 1fr);
        }
        .poster-card { flex-direction: row; gap: 8px; padding: 6px 10px; justify-content: flex-start; text-align: left; }
        .poster-card__icon { width: 26px; height: 26px; }
        .poster-card__icon i { font-size: 11px; }
        .poster-card__label { font-size: 11px; }
    }
}