/* ============================================================
   BacHO — /fiche : mise en page de l'espace « Mes fiches »
   ------------------------------------------------------------
   Chargé après carousel.css, uniquement sur cette page.

   Règle de la charte (bacho-app.css) : le BLANC est réservé aux
   documents. Les fiches étaient posées sur un fond presque blanc et
   s'y fondaient. Chaque rangée est désormais posée sur l'établi —
   la même surface que dans l'éditeur (edit-ok.css, .canvas-area) :
   gris-bleu, grain de points, lueur douce sous la feuille.
   ============================================================ */

/* ────────────────────────────────────────────────────────
   1. BANDEAU D'AIDE — présent, mais à voix basse
   ──────────────────────────────────────────────────────── */
.helpline--top {
    flex-wrap: nowrap;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.55rem 0.5rem 0.85rem;
    border: 1px solid var(--bh-ink-line);
    border-left: 4px solid #25d366;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bh-white) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: var(--app-t-sm);
    line-height: 1.35;
}

.helpline--top span {
    flex: 1 1 auto;
    min-width: 0;
}

.helpline--top a {
    padding: 0.4rem 0.85rem;
    font-size: var(--app-t-sm);
    white-space: nowrap;
}

/* ────────────────────────────────────────────────────────
   2. EN-TÊTE
   ──────────────────────────────────────────────────────── */
.head {
    padding-top: clamp(1rem, 3vw, 1.75rem);
}

.head h1 {
    margin-top: 0.5rem;
}

/* Recherche : même hauteur, même bordure que les onglets. */
.head__actions--stack .search input {
    min-height: 3.1rem;
    border: 2px solid #cbd5e1;
    border-radius: 0.95rem;
    font-size: 0.975rem;
}

.head__actions--stack .search input:hover {
    border-color: var(--bh-ink-4);
}

.head__actions--stack .search iconify-icon {
    left: 14px;
}

/* Desktop : onglets et recherche sur une seule ligne. */
@media (min-width: 900px) {
    /* Spécificité renforcée : le <style> de la page déclare ce bloc en flex. */
    .head .head__actions.head__actions--stack {
        display: grid;
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .head__actions--stack .search {
        min-width: 0;
    }

    .head__actions--stack .search input {
        height: 100%;
    }
}

/* ────────────────────────────────────────────────────────
   3. SECTIONS
   ──────────────────────────────────────────────────────── */
#compartment-fiches .sec {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

#compartment-fiches .sec__head {
    align-items: center;
    margin-bottom: 0.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bh-ink-line);
}

#compartment-fiches .sec__head h2 {
    font-size: clamp(1.2rem, 2.4vw, 1.4rem);
}

#compartment-fiches .sec__head p {
    font-size: var(--app-t-sm);
    color: var(--bh-ink-3);
}

/* ────────────────────────────────────────────────────────
   4. NIVEAUX — chaque rangée posée sur l'établi
   ──────────────────────────────────────────────────────── */
#compartment-fiches .level {
    position: relative;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border: 1px solid var(--app-bench-deep, #cbd5e1);
    border-radius: var(--app-r-sheet, 20px);
    background-color: var(--app-bench, #e2e8f0);
    background-image:
        radial-gradient(ellipse 50% 55% at 50% 42%, rgba(255, 255, 255, 0.6), transparent 72%),
        radial-gradient(rgba(15, 23, 42, 0.07) 1px, transparent 1px);
    background-size: 100% 100%, 20px 20px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -14px 28px -22px rgba(15, 23, 42, 0.3);
    /* Les cartes s'arrêtent net au bord du plan de travail. */
    overflow: hidden;
}

#compartment-fiches .level.is-empty {
    display: none;
}

#compartment-fiches .level__head {
    gap: 0.6rem;
    margin: 0;
    padding: 0 1.1rem;
}

#compartment-fiches .level__dot {
    width: 10px;
    height: 10px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
}

#compartment-fiches .level__head h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--bh-ink);
}

/* Compteur « 3 fiches » / catégories : pastille blanche. */
#compartment-fiches .level__head span:not(.level__dot) {
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--app-bench-deep, #cbd5e1);
    border-radius: 999px;
    background: var(--bh-white);
    color: var(--bh-ink-3);
    font-size: 0.625rem;
}

/* Squelettes de chargement : posés sur l'établi eux aussi. */
#compartment-fiches .level .skeleton {
    padding: 1rem 1.1rem 1.25rem;
}

#compartment-fiches .level .skeleton__page {
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 14px 30px -14px rgba(15, 23, 42, 0.3);
}

/* ────────────────────────────────────────────────────────
   5. CARROUSEL SUR L'ÉTABLI
   ──────────────────────────────────────────────────────── */
#compartment-fiches .level [data-carousel] {
    /* Le panneau porte déjà la largeur : plus de débord bord à bord. */
    margin-inline: 0;
    padding-bottom: 0.85rem;

    /* Ombre de feuille de l'éditeur : franche, proche, puis halo bleu. */
    --bc-shadow:
        0 1px 2px rgba(15, 23, 42, 0.14),
        0 14px 30px -14px rgba(15, 23, 42, 0.36);
    --bc-shadow-active:
        0 1px 2px rgba(15, 23, 42, 0.16),
        0 22px 48px -16px rgba(15, 23, 42, 0.42),
        0 0 90px -24px rgba(37, 99, 235, 0.3);
    --bc-shadow-hover:
        0 2px 4px rgba(15, 23, 42, 0.16),
        0 30px 60px -18px rgba(15, 23, 42, 0.46),
        0 0 100px -20px rgba(37, 99, 235, 0.36);
}

#compartment-fiches .level [data-carousel]:focus-visible {
    box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--bc-focus-ring) 45%, transparent);
    border-radius: 0 0 var(--app-r-sheet, 20px) var(--app-r-sheet, 20px);
}

/* Fondu aux deux bords : les cartes entrent et sortent de l'établi
   au lieu d'être tranchées. */
#compartment-fiches .level [data-carousel]::before,
#compartment-fiches .level [data-carousel]::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 4;
    width: clamp(1.5rem, 6%, 4.5rem);
    pointer-events: none;
}

#compartment-fiches .level [data-carousel]::before {
    left: 0;
    background: linear-gradient(90deg, var(--app-bench, #e2e8f0), transparent);
}

#compartment-fiches .level [data-carousel]::after {
    right: 0;
    background: linear-gradient(270deg, var(--app-bench, #e2e8f0), transparent);
}

#compartment-fiches .level .carousel-item > .doc__page {
    border-color: rgba(15, 23, 42, 0.08);
}

/* Textes sous la carte : plus lisibles. */
#compartment-fiches .level .carousel-title {
    color: var(--bh-ink-2);
}

#compartment-fiches .level .carousel-item.is-active .carousel-title {
    font-size: var(--app-t-body);
    font-weight: 700;
    color: var(--bh-ink);
}

#compartment-fiches .level .carousel-category {
    border-color: var(--app-bench-deep, #cbd5e1);
    background: var(--bh-white);
    color: var(--bh-ink-2);
}

/* Navigation : flèches nettes, points visibles sur le gris. */
#compartment-fiches .level .bc-arrow {
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15), 0 10px 22px -10px rgba(15, 23, 42, 0.5);
}

#compartment-fiches .level .bc-arrow--prev {
    left: 0.75rem;
}

#compartment-fiches .level .bc-arrow--next {
    right: 0.75rem;
}

#compartment-fiches .level .bc-dots {
    margin-top: 0.5rem;
}

#compartment-fiches .level .bc-dot {
    background: var(--bh-ink-3);
    opacity: 0.35;
}

#compartment-fiches .level .bc-dot.is-active {
    background: var(--bc-accent);
    opacity: 1;
}

#compartment-fiches .level .bc-counter {
    color: var(--bh-ink-3);
}

/* ────────────────────────────────────────────────────────
   6. MOBILE
   Les flèches ne recouvrent plus la fiche : elles descendent
   aux deux coins bas, de part et d'autre des points. Le
   glissement au doigt reste le geste principal.
   ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    #compartment-fiches .level {
        margin-top: 1rem;
        /* Le panneau va de bord à bord de l'écran : plus de place
           pour la fiche, la voisine dépasse pour inviter à glisser. */
        margin-inline: calc(var(--app-gut, 1rem) * -1);
        border-inline: 0;
        border-radius: 0;
    }

    #compartment-fiches .level__head {
        padding-inline: var(--app-gut, 1rem);
    }

    #compartment-fiches .level [data-carousel] {
        padding-bottom: 0.75rem;
    }

    #compartment-fiches .level .bc-arrow {
        top: auto !important; /* carousel.js pose top en ligne */
        bottom: 0.7rem;
        transform: none;
        width: 38px;
        height: 38px;
    }

    #compartment-fiches .level .bc-arrow:hover {
        transform: none;
    }

    #compartment-fiches .level .bc-arrow:active {
        transform: scale(0.92);
    }

    #compartment-fiches .level .bc-arrow--prev {
        left: var(--app-gut, 1rem);
    }

    #compartment-fiches .level .bc-arrow--next {
        right: var(--app-gut, 1rem);
    }

    /* Points + compteur : un bloc de la hauteur des flèches. */
    #compartment-fiches .level .bc-dots {
        min-height: 22px;
        margin-top: 0.25rem;
    }

    .helpline--top {
        font-size: 0.8125rem;
    }
}
