/*
 * APS Products — Brand Archive Styles
 * File: css/aps-brand-archive.css
 *
 * Design: Minimal White + Gray
 * Scope: All selectors are prefixed with .aps-ba- to avoid conflicts
 *        with existing plugin styles.
 *
 * Breakpoints:
 *   Desktop  ≥ 1024px  →  6 cards per row
 *   Tablet   768–1023  →  4 cards per row
 *   Tablet S 480–767   →  3 cards per row
 *   Mobile   < 480px   →  2 cards per row
 */

/* ═══════════════════════════════════════════════════════════════
   RESET / BASE
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-wrapper *,
.aps-ba-wrapper *::before,
.aps-ba-wrapper *::after {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   BRAND TITLE
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-main-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.aps-ba-brand-logo {
    display: inline-block;
    max-height: 52px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════════
   BRAND DESCRIPTION
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-brand-desc {
    color: #666666;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ═══════════════════════════════════════════════════════════════
   BRAND SWITCHER ROW
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-brand-switcher-row {
    margin-bottom: 28px;
}

/* ═══════════════════════════════════════════════════════════════
   OUTER WRAPPER
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-wrapper {
    width: 100%;
    background: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════
   CATEGORY SECTION  (H2 level)
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-category-section {
    margin-bottom: 36px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    background: #ffffff;
}

/* Category heading bar */
.aps-ba-cat-heading {
    margin: 0;
    padding: 16px 24px;
    font-size: 1.15em;
    font-weight: 700;
    color: #111111;
    background: #f5f5f5;
    border-bottom: 1px solid #e5e5e5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.aps-ba-cat-separator {
    color: #aaaaaa;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════
   YEAR BLOCK  (H3 level)
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-year-block {
    padding: 20px 24px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.aps-ba-year-block:last-child {
    border-bottom: none;
}

/* Year heading */
.aps-ba-year-heading {
    margin: 0 0 16px 0;
    font-size: 0.88em;
    font-weight: 600;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Year pill/badge — visually distinct; the text itself is screen-reader text */
.aps-ba-year-badge {
    display: none; /* badge is decorative; year text follows inline for SEO */
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCT GRID
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCT CARD
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    cursor: pointer;
}

.aps-ba-card:hover,
.aps-ba-card:focus {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.09);
    transform: scale(1.02);
    outline: none;
    text-decoration: none;
    color: inherit;
}

/* Card image container — fixed-ratio box */
.aps-ba-card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #f0f0f0;
}

.aps-ba-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    display: block;
}

/* Card label */
.aps-ba-card-meta {
    padding: 8px 10px 10px;
    flex: 1;
    display: flex;
    align-items: flex-start;
}

.aps-ba-card-title {
    font-size: 0.78em;
    font-weight: 500;
    color: #111111;
    line-height: 1.35;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;

    /* Clamp to 3 lines to keep cards uniform height */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.aps-ba-empty {
    color: #666666;
    font-size: 0.95em;
    padding: 24px 0;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════ */

/* Large tablets: 4 per row */
@media (max-width: 1200px) {
    .aps-ba-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Tablets landscape: 4 per row */
@media (max-width: 1023px) {
    .aps-ba-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .aps-ba-year-block {
        padding: 16px 18px 20px;
    }

    .aps-ba-cat-heading {
        padding: 14px 18px;
        font-size: 1.05em;
    }
}

/* Tablets portrait: 3 per row */
@media (max-width: 767px) {
    .aps-ba-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .aps-ba-year-block {
        padding: 14px 14px 18px;
    }

    .aps-ba-cat-heading {
        padding: 12px 14px;
        font-size: 1em;
    }

    .aps-ba-year-heading {
        font-size: 0.82em;
    }

    .aps-ba-card-title {
        font-size: 0.75em;
    }
}

/* Mobile: 2 per row */
@media (max-width: 479px) {
    .aps-ba-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .aps-ba-year-block {
        padding: 12px 10px 14px;
    }

    .aps-ba-cat-heading {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .aps-ba-card-title {
        font-size: 0.72em;
    }

    .aps-ba-category-section {
        border-radius: 8px;
        margin-bottom: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RTL SUPPORT
   ═══════════════════════════════════════════════════════════════ */
.rtl .aps-ba-cat-heading,
.rtl .aps-ba-year-heading {
    direction: rtl;
}

.rtl .aps-ba-card-title {
    text-align: right;
}
