/* ============================================================
   Content & Media of a product (D-026, D-051): the grid of files on
   /projects/{KEY}/products/{PKEY}/media/. The upload form, the notes blocks and
   the danger buttons reuse tools.css (.tls-*); only what is new
   lives here.
   Only theme variables: both themes come from vars.css / app.css.
   ============================================================ */

.md-head {
    display:         flex;
    flex-wrap:       wrap;
    align-items:     baseline;
    justify-content: space-between;
    gap:             var(--space-2) var(--space-3);
}
.md-usage { margin: 0; }

/* ── The grid of files ────────────────────────────────────── */
.md-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap:                   var(--space-4);
    margin:                0;
    padding:               0;
    list-style:            none;
}
.md-item {
    display:       flex;
    flex-direction: column;
    gap:           var(--space-2);
    padding:       var(--space-3);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-md);
    background:    var(--color-bg-card);
}

/* The thumbnail box keeps one height whatever the image is, so a
   tall screenshot and a wide logo do not make the grid jump. */
.md-item__thumb {
    display:         flex;
    align-items:     center;
    justify-content: center;
    height:          9rem;
    overflow:        hidden;
    border-radius:   var(--radius-sm);
    background:      var(--color-bg-muted);
}
.md-item__img {
    max-width:  100%;
    max-height: 100%;
    width:      auto;
    height:     auto;
    object-fit: contain;
}
.md-item__icon { font-size: 3rem; color: var(--color-text-muted); }

.md-item__body  { flex: 1 1 auto; }
.md-item__title {
    margin:        0 0 var(--space-1);
    font-size:     var(--font-size-base);
    overflow-wrap: anywhere;
}
.md-item__meta {
    display:   flex;
    flex-wrap: wrap;
    gap:       var(--space-2);
    margin:    0 0 var(--space-1);
    color:     var(--color-text-muted);
    font-size: var(--font-size-xs);
}
.md-item__original,
.md-item__by {
    margin:        0 0 var(--space-1);
    color:         var(--color-text-muted);
    font-size:     var(--font-size-xs);
    overflow-wrap: anywhere;
}
.md-item__sha {
    font-size:     var(--font-size-xs);
    overflow-wrap: anywhere;
}
.md-item__actions { margin-top: auto; }

/* ── The edit form, folded away until it is wanted ────────── */
.md-edit > summary {
    cursor:    pointer;
    color:     var(--color-text-muted);
    font-size: var(--font-size-sm);
}
.md-edit__form { margin-top: var(--space-2); }

/* ── Upload form and the two notes under it ───────────────── */
.md-upload .md-upload__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.md-note { margin: var(--space-2) 0 0; }

@media (max-width: 599.98px) {
    .md-upload .md-upload__row { grid-template-columns: 1fr; }
    .md-grid { grid-template-columns: 1fr; }
}

/* ── Retention notices (D-029) ────────────────────────────── */
.md-notices {
    display:        flex;
    flex-direction: column;
    gap:            var(--space-2);
    padding-bottom: 0;
}
.md-notice {
    display:       flex;
    align-items:   center;
    gap:           var(--space-2);
    margin:        0;
    padding:       var(--space-2) var(--space-3);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background:    var(--color-bg-muted);
    font-size:     var(--font-size-sm);
}
.md-notice--warn {
    border-color: var(--color-warning);
    color:        var(--color-warning-text);
}
.md-item__retention {
    display:   flex;
    align-items: center;
    gap:       var(--space-1);
    margin:    0 0 var(--space-1);
    color:     var(--color-text-muted);
    font-size: var(--font-size-xs);
}
.md-item__retention--soon { color: var(--color-warning-text); }
.md-item--expiring { border-color: var(--color-warning); }
.md-item__actions .btn.is-active { color: var(--color-success-text); }
