/* ===============================================================
   Page ad placements
   Rendered by App\Services\AdPlacementService via ad_slot('...').
   Visual language follows the site cards: white surface, 12px
   radius, soft border, subtle shadow.
   =============================================================== */

:root {
    --ad-surface: #ffffff;
    --ad-border: #e4eaf1;
    --ad-label: #94a3b8;
    /* Falls back to the literal if brand.css has not loaded yet. */
    --ad-brand: var(--gba-primary, #133B5C);
    --ad-radius: 12px;
}

.ad-slot {
    display: block;
    margin: 22px 0;
    padding: 10px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border);
    /* border-radius: var(--ad-radius); */
    /* box-shadow: 0 2px 10px rgba(19, 59, 92, .05); */
    text-align: center;
    overflow: hidden;
}

/* The service prints no wrapper at all for an empty slot, but guard anyway. */
.ad-slot:empty {
    display: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
}

/* Small, quiet disclosure label — standard practice and required by
   most ad networks. */
.ad-slot__label {
    display: block;
    margin-bottom: 6px;
    color: var(--ad-label);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .09em;
    line-height: 1;
    text-transform: uppercase;
    text-align: center;
    user-select: none;
}

.ad-slot__body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ad-unit {
    display: block;
    width: 100%;
    max-width: 100%;
    line-height: 0;
}

.ad-unit__link {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.ad-unit__link:hover,
.ad-unit__link:focus-visible {
    transform: translateY(-2px);
    /* box-shadow: 0 6px 18px rgba(19, 59, 92, .14); */
}

.ad-unit__img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 8px;
}

/* Ad networks inject their own iframe / ins elements — keep them contained. */
.ad-unit iframe,
.ad-unit ins,
.ad-unit img,
.ad-unit video {
    max-width: 100%;
    height: auto;
}

.ad-unit ins.adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* ---------------------------------------------------------------
   Per-slot sizing
   Caps each position at its standard creative width so a wrongly
   sized upload can never break the layout.
   --------------------------------------------------------------- */

/* Leaderboard positions */
.ad-slot--after_header,
.ad-slot--before_footer {
    max-width: 100%;
    margin-inline: auto;
}

.ad-slot--after_header {
    margin-top: 9px;
    margin-bottom: 9px;
}

.ad-slot--before_footer {
    margin-top: 9px;
    margin-bottom: 0;
}

.ad-slot--after_header .ad-unit,
.ad-slot--before_footer .ad-unit {
    max-width: 970px;
    margin-inline: auto;
}

/* In-article positions */
.ad-slot--content_top,
.ad-slot--content_bottom,
.ad-slot--in_content {
    max-width: 100%;
}

.ad-slot--content_top .ad-unit,
.ad-slot--content_bottom .ad-unit,
.ad-slot--in_content .ad-unit {
    max-width: 728px;
    margin-inline: auto;
}

.ad-slot--content_top {
    margin-top: 0;
    border-radius: 6px;
}

.ad-slot--in_content {
    margin: 26px auto;
}

/* Sidebar positions */
.ad-slot--sidebar_top,
.ad-slot--sidebar_bottom {
    margin: 0 0 18px;
    border-radius: 12px;    
}

.ad-slot--sidebar_bottom {
    margin: 18px 0 0;
}

.ad-slot--sidebar_top .ad-unit,
.ad-slot--sidebar_bottom .ad-unit {
    max-width: 300px;
    margin-inline: auto;
}

/* Stacked ads in one slot get a divider rather than crowding together. */
.ad-slot__body > .ad-unit + .ad-unit {
    padding-top: 12px;
    border-top: 1px dashed var(--ad-border);
}

/* ---------------------------------------------------------------
   Device targeting
   Done in CSS rather than PHP so it stays correct when a page is
   served from the full-page HTML cache (the cache key does not vary
   by device, so a server-side check would leak across breakpoints).
   --------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .ad-unit--desktop-only {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .ad-unit--mobile-only {
        display: none !important;
    }
}

/* Hide a slot whose only ad is filtered out at this breakpoint. */
@media (max-width: 991.98px) {
    .ad-slot:has(.ad-unit:only-child.ad-unit--desktop-only) {
        display: none;
    }
}

@media (min-width: 992px) {
    .ad-slot:has(.ad-unit:only-child.ad-unit--mobile-only) {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .ad-slot {
        margin: 16px 0;
        padding: 8px;
    }
}

/* ===============================================================
   Article → Product link card
   The mirror of the product page's "Read Product Article" link.
   =============================================================== */

.article-product-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border);
    border-left: 4px solid var(--ad-brand);
    border-radius: var(--ad-radius);
    box-shadow: 0 2px 10px rgba(19, 59, 92, .05);
    color: inherit;
    text-decoration: none;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.article-product-link:hover,
.article-product-link:focus-visible {
    transform: translateY(-2px);
    /* box-shadow: 0 8px 22px rgba(19, 59, 92, .14); */
    border-color: #cfdcea;
    border-left-color: var(--ad-brand);
    color: inherit;
    text-decoration: none;
}

.article-product-link__media {
    flex: 0 0 62px;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f8fb;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    overflow: hidden;
}

.article-product-link__media img {
    max-width: 100%;
    max-height: 56px;
    object-fit: contain;
}

.article-product-link__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.article-product-link__brand {
    color: var(--ad-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.article-product-link__name {
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-product-link__price {
    color: #166534;
    font-size: 13px;
    font-weight: 600;
}

.article-product-link__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: var(--ad-brand);
    font-size: 12.5px;
    font-weight: 600;
}

.article-product-link__arrow {
    flex: 0 0 auto;
    color: var(--ad-brand);
    font-size: 13px;
    opacity: .65;
    transition: opacity .18s ease, transform .18s ease;
}

.article-product-link:hover .article-product-link__arrow {
    opacity: 1;
    transform: translate(2px, -2px);
}

@media (max-width: 575.98px) {
    .article-product-link__media {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
    }

    .article-product-link__name {
        font-size: 14px;
    }
}
