.aae-a-posts {
    width: 100%;
}

// Visually hidden, still in the accessibility tree AND still part of the
// element's text content — which is what separates it from `display: none`
// (removed from both) and from aria-label (replaces the name, and Lighthouse's
// link-text audit never sees it). Used by the Read More link to name its post.
//
// `clip-path` plus the legacy `clip` for older engines; `white-space: nowrap`
// stops a long title wrapping into layout before it is clipped.
.aae-a-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

// ── Grid ───────────────────────────────────────────────────────────
.aae-a-posts-grid {
    --aae-posts-gap:              24px;
    --aae-post-bg:                var(--e-global-color-text-inverse, #ffffff);
    --aae-post-border-radius:     8px;
    --aae-post-shadow:            0 2px 8px rgba(0, 0, 0, .08);
    --aae-post-shadow-hover:      0 6px 20px rgba(0, 0, 0, .14);
    --aae-post-image-height:      220px;
    --aae-post-title-color:       var(--e-global-color-primary, #333);
    --aae-post-title-color-hover: var(--e-global-color-accent, #4d5bff);
    --aae-post-excerpt-color:     var(--e-global-color-text, #666);
    --aae-post-date-color:        var(--e-global-color-text, #999);
    --aae-post-readmore-color:    var(--e-global-color-accent, #4d5bff);

    display: grid;
    gap: var(--aae-posts-gap);
    grid-template-columns: repeat(var(--aae-posts-columns, 3), 1fr);
    width: 100%;

    &.layout-list {
        grid-template-columns: 1fr;
    }
}

// ── Post Card ──────────────────────────────────────────────────────
.aae-a-post-card {
    display: flex;
    flex-direction: column;
    background: var(--aae-post-bg);
    border-radius: var(--aae-post-border-radius);
    overflow: hidden;
    box-shadow: var(--aae-post-shadow);
    transition: transform .3s ease, box-shadow .3s ease;

    &:hover {
        transform: translateY(-4px);
        box-shadow: var(--aae-post-shadow-hover);
    }
}

// ── Thumbnail ──────────────────────────────────────────────────────
.aae-a-post-thumb-link {
    display: block;
    overflow: hidden;
    flex-shrink: 0;
}

.aae-a-post-thumb {
    width: 100%;
    height: var(--aae-post-image-height);
    object-fit: cover;
    display: block;
    transition: transform .4s ease;

    .aae-a-post-card:hover & {
        transform: scale(1.04);
    }
}

// ── Content area ───────────────────────────────────────────────────
.aae-a-post-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

// ── Title wrapper ──────────────────────────────────────────────────
.aae-a-post-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    line-height: 1.35;
}

// ── Date ───────────────────────────────────────────────────────────
.aae-a-post-date {
    font-size: 12px;
    color: var(--aae-post-date-color);
    letter-spacing: .5px;
    display: block;
}

// ── Title (applied via Elementor heading slot link) ────────────────
.aae-a-post-title-link {
    color: var(--aae-post-title-color);
    text-decoration: none;
    transition: color .2s ease;

    &:hover {
        color: var(--aae-post-title-color-hover);
    }
}

// ── Excerpt ────────────────────────────────────────────────────────
.aae-a-post-excerpt {
    color: var(--aae-post-excerpt-color);
    font-size: .95em;
    line-height: 1.6;
    margin: 0 0 12px;
    flex-grow: 1;
}

// ── Read More ──────────────────────────────────────────────────────
.aae-a-post-read-more-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--aae-post-readmore-color);
    text-decoration: none;
    margin-top: auto;
    padding-top: 8px;
    transition: gap .2s ease;

    &:hover {
        gap: 8px;
    }
}

// ── List Layout ────────────────────────────────────────────────────
.layout-list {
    .aae-a-post-card {
        flex-direction: row;
    }

    .aae-a-post-thumb-link {
        width: 240px;
    }

    .aae-a-post-thumb {
        height: 100%;
        min-height: 160px;
    }
}

// ── Responsive ─────────────────────────────────────────────────────
@media (max-width: 1024px) {
    .aae-a-posts-grid {
        grid-template-columns: repeat(min(var(--aae-posts-columns, 3), 2), 1fr);
    }
}

@media (max-width: 767px) {
    .aae-a-posts-grid {
        grid-template-columns: 1fr;
    }

    .layout-list .aae-a-post-card  { flex-direction: column; }
    .layout-list .aae-a-post-thumb-link { width: 100%; }
}
