/* aieo-article-cards.css — shared article-card + vertical-layout rules.
 *
 * Registered as the style handle `aieo-article-cards` by AIEO_Blocks_Loader,
 * referenced as a `viewStyle` entry by both `aieo/brand-related` and
 * `aieo/taxonomy-related-articles` block.json files.
 *
 * WP conditionally enqueues this stylesheet only on the page render that
 * contains either of those blocks (per WP 5.9+ block asset handling, with
 * `wp_should_load_separate_core_block_assets()` true on block themes).
 * Sharing via handle dedupes — when both blocks happen to be on the same
 * page (rare), the file loads once.
 *
 * Companion brand-only rules (chips, other-brands strip, brand-vertical
 * tweaks) stay in `includes/dmm/blocks/brand-related/style.css` and load
 * via that block's own `viewStyle: file:./style.css`.
 */

.aieo-brand-related {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin: 32px 0;
}

.aieo-brand-related__row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aieo-brand-related__heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1f2937;
}

/* ── Article cards — Apple-glass overlay over the post image. ─── */

.aieo-brand-related__articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.aieo-article-card {
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #fcf0f1, #fff);
    transition: transform 180ms ease, box-shadow 180ms ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.aieo-article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(244, 103, 103, 0.18);
}
.aieo-article-card__link {
    position: relative;
    display: block;
    aspect-ratio: 16 / 11;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f3f4f6;
}
.aieo-article-card.has-no-thumb .aieo-article-card__link {
    background: linear-gradient(135deg, #fcf0f1 0%, #ffe9eb 100%);
    color: #1f2937;
}
/* Subtle dark veil so even bright images keep the text readable. */
.aieo-article-card__link::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.45) 100%);
    pointer-events: none;
}
.aieo-article-card.has-no-thumb .aieo-article-card__link::before { display: none; }

/* The Apple-glass plate at the bottom holding title + excerpt. */
.aieo-article-card__overlay {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    color: #1f2937;
}
.aieo-article-card__title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.aieo-article-card__excerpt {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Vertical layout — sidebar use. Articles collapse to a single
       column with a tighter aspect-ratio so the rail doesn't get too
       tall. ─────────────────────────────────────────────────────── */

.aieo-brand-related--vertical { gap: 24px; margin: 0 0 24px; }
.aieo-brand-related--vertical .aieo-brand-related__heading {
    font-size: 0.95rem;
}
.aieo-brand-related--vertical .aieo-brand-related__articles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.aieo-brand-related--vertical .aieo-article-card__link {
    aspect-ratio: 16 / 9;
}
.aieo-brand-related--vertical .aieo-article-card__overlay {
    padding: 8px 10px;
    gap: 2px;
}
.aieo-brand-related--vertical .aieo-article-card__title {
    font-size: 13px;
    -webkit-line-clamp: 2;
}
.aieo-brand-related--vertical .aieo-article-card__excerpt {
    -webkit-line-clamp: 2;
}

/* ── Mobile: force the sidebar's children to fill the full viewport
       width when the column has stacked below the products. ────── */

@media (max-width: 1024px) {
    .aieo-brand-related,
    .aieo-brand-related--vertical {
        width: 100%;
        max-width: 100%;
    }
    .aieo-brand-related__row,
    .aieo-brand-related__articles {
        width: 100%;
    }
    .aieo-brand-related--vertical .aieo-article-card,
    .aieo-brand-related--vertical .aieo-article-card__link {
        width: 100%;
        max-width: 100%;
        display: block;
    }
    .aieo-brand-related--vertical .aieo-article-card__link {
        aspect-ratio: 16 / 9;
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .aieo-brand-related--vertical .aieo-article-card__overlay {
        padding: 12px 14px;
    }
    .aieo-brand-related--vertical .aieo-article-card__title {
        font-size: 15px;
    }
}
