/* ═══ WIDGET BENTO — InkSide ═════════════════════════════
 * Mosaïque curée de tuiles produits/catégories, tailles variées (auto/manuel),
 * grid-auto-flow:dense → sans trous. Tokens --ink-*. Scope : .ink-bento.
 * ════════════════════════════════════════════════════════ */

.ink-bento-wrap {
    font-family: var(--ink-font);
}

.ink-bento__header {
    margin: 0 0 22px;
}

.ink-bento__title {
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink-text);
    margin: 0 0 8px;
}

.ink-bento__subtitle {
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink-text-muted);
    margin: 0;
    max-width: 720px;
}

/* ── Grille ── */
.ink-bento {
    display: grid;
    grid-template-columns: repeat(var(--ink-bento-cols, 4), minmax(0, 1fr));
    grid-auto-rows: var(--ink-bento-row, 210px);
    grid-auto-flow: dense;
    gap: var(--ink-bento-gap, 16px);
}

/* ── Tuile (lien) : jamais de soulignement (override Astra) ── */
.ink-bento__tile,
.ink-bento__tile:hover,
.ink-bento__tile:focus,
.ink-bento__tile * {
    text-decoration: none !important;
}

.ink-bento__tile {
    position: relative;
    display: block;
    /* Pas d'overflow:hidden ici → laisse passer la tooltip ; l'arrondi de l'image est porté
       par .ink-bento__media. */
    border-radius: var(--ink-bento-radius, 16px);
    color: #fff;
    background: var(--ink-bg-muted);
    box-shadow: var(--ink-shadow-xs);
    isolation: isolate;
    transition: box-shadow .28s ease, transform .28s ease;
}

.ink-bento__tile:hover {
    box-shadow: 0 18px 42px rgba(16, 32, 64, .18);
    transform: translateY(-3px);
    z-index: 6; /* la tuile survolée (et sa tooltip) passe au-dessus des voisines */
}

.ink-bento__tile.is-wide { grid-column: span 2; }
.ink-bento__tile.is-tall { grid-row: span 2; }
.ink-bento__tile.is-lg   { grid-column: span 2; grid-row: span 2; }

/* ── Image + dégradé ── */
.ink-bento__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;            /* arrondit l'image + le scrim (déplacé depuis la tuile) */
    border-radius: inherit;
}

.ink-bento__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .6s cubic-bezier(.2, .6, .2, 1);
}

.ink-bento__tile:hover .ink-bento__media img { transform: scale(1.05); }

.ink-bento__placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--ink-bg-subtle, #e9edf3), var(--ink-bg-muted, #f4f6f9));
}

.ink-bento__media::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: var(--ink-bento-overlay, 1);
    /* Scrim concentré en bas : texte lisible sur fond sombre net, image dégagée dans le haut. */
    background: linear-gradient(to top, rgba(10, 16, 34, .92) 0%, rgba(10, 16, 34, .72) 18%, rgba(10, 16, 34, .34) 40%, rgba(10, 16, 34, .08) 58%, transparent 72%);
}

/* ── Contenu ── */
.ink-bento__body {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 5px;
    padding: 15px 16px;
}

.ink-bento__kicker {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .82);
}

.ink-bento__name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 1px 10px rgba(0, 0, 0, .45);
    /* Tronque les noms produit longs avec « … » pour garder des tuiles propres. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.ink-bento__tile.is-wide .ink-bento__name,
.ink-bento__tile.is-lg .ink-bento__name { font-size: 17px; }

/* Les tuiles hautes/grandes ont plus de place verticale → 3 lignes. */
.ink-bento__tile.is-tall .ink-bento__name,
.ink-bento__tile.is-lg .ink-bento__name {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.ink-bento__price {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.ink-bento__price del { opacity: .6; font-weight: 400; margin-right: 4px; }

.ink-bento__cta {
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.ink-bento__cta svg {
    transition: transform .22s ease, color .22s ease;
}

.ink-bento__tile:hover .ink-bento__cta svg {
    transform: translateX(4px);
    color: var(--ink-accent, #36b37e);
}

/* ── Tooltip du titre complet (style fiche produit : dark, flèche, transition) ── */
.ink-bento__tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(.95) translateY(4px);
    z-index: 99999;
    width: max-content;
    max-width: min(260px, 86vw);
    padding: 9px 13px;
    background: var(--ink-dark, #1a2535);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    border-radius: var(--ink-radius-md, 10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .26);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}

.ink-bento__tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--ink-dark, #1a2535);
}

/* Tooltip affichée UNIQUEMENT si le titre est réellement tronqué (.is-clipped posé par bento.js). */
.ink-bento__tile.is-clipped:hover > .ink-bento__tip,
.ink-bento__tile.is-clipped:focus-visible > .ink-bento__tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1) translateY(0);
}

/* ── Éditeur : message vide ── */
.ink-bento__empty {
    padding: 32px;
    text-align: center;
    color: var(--ink-text-muted);
    background: var(--ink-bg-muted);
    border: 1px dashed var(--ink-border);
    border-radius: 14px;
}

/* ── Responsive (colonnes pilotées par le widget ; jamais de trous grâce à dense) ── */
@media (max-width: 1024px) {
    .ink-bento { grid-template-columns: repeat(var(--ink-bento-cols-t, 3), minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .ink-bento { grid-template-columns: repeat(var(--ink-bento-cols-m, 2), minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .ink-bento {
        grid-auto-rows: var(--ink-bento-row-mobile, 150px);
        gap: 10px;
    }
    .ink-bento__body { padding: 12px 13px; }
    .ink-bento__name { font-size: 13px; }
    .ink-bento__tile.is-wide .ink-bento__name,
    .ink-bento__tile.is-lg .ink-bento__name { font-size: 15px; }
}
