/* Download center (vue com_telebib « downloads »).
   Objectif : une page dense. Les rubriques se rangent en colonnes qui se
   remplissent de haut en bas (pas de trous sous les rubriques courtes), et
   chaque fichier tient sur une ligne. Reprend les tokens du template. */

.tb2-dl {
    padding: .5rem 0 1.5rem;
}

.tb2-dl-dump {
    margin-bottom: 1rem;
}

/* Cartes du dump et des schémas JSON (rendues par plg_content_telebibdownload) :
   version compacte, propre à cette page. Le bouton remonte à côté du titre, les
   caractéristiques se suivent sur une ligne, l'empreinte tient sur une ligne.
   Les !important neutralisent les utilitaires Bootstrap et le max-width en
   ligne posés par le plugin, qui garde son rendu d'origine ailleurs. */
.tb2-dl-dump .row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.tb2-dl-dump .tb2-download-card {
    max-width: none !important;
}

.tb2-dl-dump .card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem 1rem;
    padding: .8rem .95rem;
}

.tb2-dl-dump .card-body > .d-flex {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0 !important;
}

.tb2-dl-dump .card-body > .d-flex .fs-5 {
    font-size: 1.05rem !important;
    line-height: 1.25;
}

.tb2-dl-dump .card-body > a.btn {
    grid-column: 2;
    grid-row: 1;
    padding: .4rem .85rem;
    font-size: .85rem;
    white-space: nowrap;
}

.tb2-dl-dump .card-body > dl {
    grid-column: 1 / -1;
    display: grid;
    /* Deux caractéristiques par ligne (libellé, valeur, libellé, valeur) :
       une grille garde chaque libellé à côté de sa valeur. */
    grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1.4fr);
    gap: .15rem .75rem;
    margin: 0 !important;
}

.tb2-dl-dump .card-body > dl > dt,
.tb2-dl-dump .card-body > dl > dd {
    width: auto;
    max-width: none;
    padding: 0;
    margin: 0 !important;
}

.tb2-dl-dump .card-body > .mt-3 {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .15rem .5rem;
    margin-top: 0 !important;
}

.tb2-dl-dump .card-body > .mt-3 > .d-block {
    display: inline !important;
    margin: 0 !important;
    white-space: nowrap;
}

.tb2-dl-dump .card-body > .mt-3 > code {
    font-size: .72rem;
}

/* Colonnes : les cartes s'empilent sans laisser de vide entre elles. */
.tb2-dl-grid {
    columns: 2;
    column-gap: 1rem;
}

.tb2-dl-card {
    break-inside: avoid;
    margin: 0 0 1rem;
    background: var(--tb2-white, #fff);
    border: 1px solid var(--tb2-border, #E5E7EB);
    border-radius: var(--tb2-radius, 8px);
    overflow: hidden;
}

.tb2-dl-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .85rem;
    background: var(--tb2-light-grey, #F3F4F6);
    border-bottom: 1px solid var(--tb2-border, #E5E7EB);
}

.tb2-dl-card-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--tb2-dark, #1A1D29);
}

.tb2-dl-count {
    flex: none;
    font-size: .75rem;
    color: var(--tb2-grey, #6B7280);
    white-space: nowrap;
}

.tb2-dl-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tb2-dl-item + .tb2-dl-item {
    border-top: 1px solid var(--tb2-border, #E5E7EB);
}

/* La ligne entière est le lien. */
.tb2-dl-link {
    display: grid;
    grid-template-columns: 2.9rem minmax(0, 1fr) auto 1rem;
    align-items: center;
    gap: .65rem;
    padding: .42rem .85rem;
    color: var(--tb2-dark, #1A1D29);
    font-size: .9rem;
    line-height: 1.35;
    text-decoration: none;
}

.tb2-dl-link:hover,
.tb2-dl-link:focus-visible {
    background: var(--tb2-row-hover, #F8FAFC);
    color: var(--tb2-primary, #0047AB);
    text-decoration: none;
}

.tb2-dl-link:focus-visible {
    outline: 2px solid var(--tb2-primary, #0047AB);
    outline-offset: -2px;
}

/* Pastille du type de fichier. */
.tb2-dl-type {
    display: inline-block;
    padding: .1rem 0;
    border-radius: var(--tb2-radius-sm, 4px);
    background: #E5E7EB;
    color: #374151;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-align: center;
}

.tb2-dl-type--zip,
.tb2-dl-type--7z,
.tb2-dl-type--gz   { background: #DBEAFE; color: #1E40AF; }
.tb2-dl-type--pdf  { background: #FEE2E2; color: #991B1B; }
.tb2-dl-type--xlsx,
.tb2-dl-type--xls,
.tb2-dl-type--csv,
.tb2-dl-type--ods  { background: #DCFCE7; color: #166534; }
.tb2-dl-type--web  { background: #FFEDD5; color: #9A3412; }

.tb2-dl-label {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 500;
}

.tb2-dl-release {
    display: inline-block;
    margin-left: .25rem;
    padding: 0 .4rem;
    border: 1px solid var(--tb2-border, #E5E7EB);
    border-radius: 999px;
    color: var(--tb2-grey, #6B7280);
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: 1px;
}

.tb2-dl-meta {
    color: var(--tb2-grey, #6B7280);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tb2-dl-action {
    color: var(--tb2-primary, #0047AB);
    font-size: .8rem;
    text-align: right;
}

/* Versions précédentes d'une série, repliées. */
.tb2-dl-older {
    margin: 0;
    border-top: 1px dashed var(--tb2-border, #E5E7EB);
    background: #FAFAFB;
}

.tb2-dl-older > summary {
    margin: 0;
    padding: .25rem .85rem .25rem 4.4rem;
    color: var(--tb2-grey, #6B7280);
    font-size: .76rem;
    cursor: pointer;
}

.tb2-dl-older > summary:hover {
    color: var(--tb2-primary, #0047AB);
}

.tb2-dl-older .tb2-dl-link {
    padding-top: .3rem;
    padding-bottom: .3rem;
    font-size: .84rem;
}

.tb2-dl-older .tb2-dl-item {
    border-top: 1px solid var(--tb2-border, #E5E7EB);
}

@media (max-width: 991.98px) {
    .tb2-dl-grid {
        columns: 1;
    }
}

/* Petits écrans : la date et la taille passent sous le libellé. */
@media (max-width: 575.98px) {
    .tb2-dl-link {
        grid-template-columns: 2.9rem minmax(0, 1fr) 1rem;
        row-gap: .1rem;
    }

    .tb2-dl-meta {
        grid-column: 2;
        grid-row: 2;
        white-space: normal;
    }

    .tb2-dl-action {
        grid-column: 3;
        grid-row: 1;
    }

    .tb2-dl-older > summary {
        padding-left: .85rem;
    }

    .tb2-dl-dump .card-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .tb2-dl-dump .card-body > dl {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .tb2-dl-dump .card-body > a.btn {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }
}
