/**
 * Studio : barres et panneaux mobiles (html.ptc-mob).
 *
 * Barre du haut, barre du bas, rangée « Ajouter », poignées des panneaux qu'on
 * tire vers le bas, téléchargements.
 */

/* Éléments propres à une seule taille d'écran */
:where(html.ptc-ui) .ptc-studio-mtop,
:where(html.ptc-ui) .ptc-studio-mbar,
:where(html.ptc-ui) .ptc-studio-sheet,
:where(html.ptc-ui) .ptc-studio-backdrop {
    display: none;
}

/* Barre du haut : annuler, rétablir, prix */
html:where(.ptc-ui).ptc-mob .ptc-studio-mtop {
    position: fixed;
    z-index: 100002;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: var(--ptc-haut-m);
    padding: 0 12px;
    background: var(--ptc-gris);
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mtop__price {
    /* Mobile : prix en haut à droite en pastille blanche, comme « Couleur » ; un
       appui ouvre le détail du prix (dialogs.js, openPriceDetail) */
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    margin-left: auto;
    padding: 0 10px 0 14px;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: var(--ptc-encre);
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    cursor: pointer;
}

/* Barre du bas : Produits, Ajouter, Ajouter au panier. Comme Spreadshirt :
   trois cartes posées sur le fond (pas de bandeau blanc commun), hautes,
   au-dessus de la barre du téléphone */
html:where(.ptc-ui).ptc-mob .ptc-studio-mbar {
    position: fixed;
    z-index: 100003;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 6px;
    padding: 0 8px calc(10px + var(--ptc-safe-b, 0px));
    background: none;
    pointer-events: none;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button {
    flex: 1 1 0;
    min-width: 0;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 6px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .07);
    color: var(--ptc-encre);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s ease, background .15s ease;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button span {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button:active {
    transform: scale(.97);
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button.is-on {
    background: #ececec;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button svg {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mbar button.is-buy {
    flex: 1.5 1 0;
    background: var(--ptc-rose);
    box-shadow: 0 4px 14px rgba(230, 60, 105, .3);
    color: #fff;
}

/* Panneau « Ajouter » */
html:where(.ptc-ui).ptc-mob .ptc-studio-sheet {
    position: fixed;
    z-index: 100004;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 26px 16px calc(20px + var(--ptc-safe-b, 0px));
    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .15);
}

html:where(.ptc-ui).ptc-mob .ptc-studio-sheet.is-open {
    display: block;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-sheet h2 {
    margin: 0 0 14px;
    font-family: var(--ptc-titre);
    font-size: 26px;
    font-weight: 400;
}

/* Voile derrière les panneaux */
html:where(.ptc-ui).ptc-mob .ptc-studio-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100003;
    background: rgba(0, 0, 0, .35);
}

/* Mobile : « ● Couleur » au centre de la barre du haut, et son panneau (mobile.js, colors.js) */
:where(html.ptc-ui) .ptc-studio-mcolor {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px 0 8px;
    border: 0;
    border-radius: 20px;
    background: #fff;
    color: var(--ptc-encre);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    cursor: pointer;
}
:where(html.ptc-ui) .ptc-studio-mcolor[hidden] {
    display: none;
}
:where(html.ptc-ui) .ptc-studio-mcolor i {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
:where(html.ptc-ui) .ptc-studio-mcolor svg {
    width: 16px;
    height: 16px;
}
:where(html.ptc-ui) .ptc-studio-colors__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 10px;
    padding: 4px 0 8px;
}
:where(html.ptc-ui) .ptc-studio-colors__swatch {
    aspect-ratio: 1;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--c);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
    cursor: pointer;
}
:where(html.ptc-ui) .ptc-studio-colors__swatch.is-on {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 2px #fff, 0 0 0 4px var(--ptc-encre);
}

/* ---------- Mobile : rangée « Ajouter », poignées, panneaux qu'on tire vers le bas ---------- */
/* « Ajouter » déplie les outils au-dessus de la barre (mobile.js, buildMobile) */
:where(html.ptc-ui) .ptc-studio-tray {
    display: none;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray {
    position: fixed;
    z-index: 100003;
    left: 8px;
    right: 8px;
    bottom: calc(80px + var(--ptc-safe-b, 0px));
    display: flex;
    gap: 4px;
    padding: 6px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .12);
    font-family: var(--ptc-texte);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.98);
    transform-origin: 50% 100%;
    transition: opacity .18s ease, transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .24s;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .18s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray button {
    flex: 1 1 0;
    min-width: 0;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 4px;
    border: 0;
    border-radius: 11px;
    background: none;
    color: var(--ptc-encre);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s ease;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray button:active {
    background: var(--ptc-gris);
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray button span {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray svg {
    width: 24px;
    height: 24px;
}
/* Les icônes apparaissent l'une après l'autre */
html:where(.ptc-ui).ptc-mob .ptc-studio-tray.is-open button {
    animation: ptc-tray-in .3s cubic-bezier(.2, .8, .2, 1) backwards;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray.is-open button:nth-child(2) {
    animation-delay: .04s;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-tray.is-open button:nth-child(3) {
    animation-delay: .08s;
}
@keyframes ptc-tray-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

/* Poignée en haut des panneaux : on les tire vers le bas pour fermer */
:where(html.ptc-ui) .ptc-studio-grip {
    display: none;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-grip {
    display: block;
    height: 22px;
    cursor: grab;
    touch-action: none;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-grip span {
    display: block;
    width: 40px;
    height: 5px;
    margin: 9px auto 0;
    border-radius: 5px;
    background: #d4d4d4;
}

/* Panneaux Couleur et panier : poignée sur le bord du haut */
html:where(.ptc-ui).ptc-mob :is(.ptc-studio-sheet, .ptc-studio-buybox) > .ptc-studio-grip {
    position: absolute;
    top: 0;
    left: 56px;
    right: 56px;
    z-index: 3;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-sheet > h2 {
    touch-action: none;
}

@media (prefers-reduced-motion: reduce) {
    html:where(.ptc-ui).ptc-mob .ptc-studio-tray,
    html:where(.ptc-ui).ptc-mob .ptc-studio-tray button {
        transition-duration: 0s !important;
        animation: none !important;
    }
}

/* Tiroirs et panneaux : le défilement ne passe jamais à la page derrière */
html:where(.ptc-ui).ptc-mob body div#LumiseDesign div#lumise-left .lumise-tab-body-wrp,
html:where(.ptc-ui).ptc-mob .ptc-studio-sheet,
html:where(.ptc-ui).ptc-mob .ptc-studio-buybox__scroll {
    overscroll-behavior: contain;
}
html:where(.ptc-ui).ptc-mob .ptc-studio-backdrop {
    touch-action: none;
}

html:where(.ptc-ui).ptc-mob .ptc-studio-mtop__price svg {
    width: 16px;
    height: 16px;
    color: #8a8a8a;
}
