/*
 * Storefront styling for the attachments section.
 *
 * Deliberately plain CSS with its own class names rather than Tailwind utilities: the module
 * ships to Luma and Hyva projects alike, and utilities would only resolve where a Tailwind
 * build is configured to scan this file.
 */

/*
 * Two per row once there is room for them, one below 640px. auto-fit rather than a fixed
 * two-column track, so a single attachment does not sit in a half-width box.
 */
.product-attachments__list {
    display: grid;
    gap: .75rem;
    /* 20rem = 320px at the storefront's 16px root, so two tracks fit a 720px panel. */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.product-attachments__link {
    align-items: stretch;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 6px;
    column-gap: 1rem;
    display: flex;
    padding: .9rem 1.1rem;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}

.product-attachments__link:hover,
.product-attachments__link:focus-visible {
    background-color: rgba(0, 0, 0, .03);
    border-color: rgba(0, 0, 0, .3);
}

/* --- Media column: thumbnail for pictures, type badge for the rest ------------------- */

/* stretch, so the visual fills whatever height the text beside it needs. */
.product-attachments__media {
    align-items: stretch;
    display: flex;
    flex: 0 0 auto;
    line-height: 0;
    width: 7.5rem;
}

.product-attachments__thumb {
    border-radius: 4px;
    display: block;
    height: 100%;
    min-height: 7.5rem;
    object-fit: cover;
    width: 100%;
}

.product-attachments__badge {
    align-items: center;
    background: #6c757d;
    border-radius: 4px;
    color: #fff;
    display: flex;
    font-size: 1rem;
    font-weight: 700;
    justify-content: center;
    letter-spacing: .04em;
    line-height: 1;
    min-height: 7.5rem;
    width: 100%;
}

/* Same colour language as the admin uploader, so a document reads the same on both sides. */
.product-attachments__badge[data-ext="PDF"] { background: #c0392b; }
.product-attachments__badge[data-ext="DOC"],
.product-attachments__badge[data-ext="DOCX"] { background: #2b5797; }
.product-attachments__badge[data-ext="XLS"],
.product-attachments__badge[data-ext="XLSX"] { background: #1e7145; }
.product-attachments__badge[data-ext="CSV"] { background: #2d8659; }
.product-attachments__badge[data-ext="ZIP"] { background: #8e44ad; }
.product-attachments__badge[data-ext="TXT"] { background: #495057; }

/* --- Text column -------------------------------------------------------------------- */

.product-attachments__body {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column !important;
    justify-content: center;
    min-width: 0;
    row-gap: .15rem;
}

.product-attachments__title,
.product-attachments__description,
.product-attachments__meta {
    display: block;
    width: 100%;
}

.product-attachments__title {
    font-weight: 600;
}

.product-attachments__description {
    font-size: .9em;
    opacity: .8;
}

.product-attachments__meta {
    font-size: .8em;
    letter-spacing: .03em;
    opacity: .6;
    text-transform: uppercase;
}
