/* Main Container */
.agh-container {
    display: grid;
    gap: 24px;
    margin: 24px 0;
    width: 100%;
}

/* Grid Columns Defaults */
.agh-cols-1 {
    grid-template-columns: 1fr;
}

.agh-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.agh-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.agh-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Item Styling */
.agh-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Thumbnail */
.agh-thumb {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 */
    overflow: hidden;
    background: #f0f0f0;
    width: 100%;
}

.agh-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.agh-item:hover .agh-thumb img {
    transform: scale(1.05);
}

/* Content */
.agh-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Meta Data */
.agh-meta {
    font-size: 0.8em;
    margin-bottom: 6px;
}

.agh-cat {
    color: #444;
    /* Dark grey for standard */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    padding: 2px 6px;
    background: #ecf6ff;
    /* Light tag bg */
    border-radius: 3px;
    display: inline-block;
}

.agh-meta-date {
    font-size: 0.85em;
    color: #888;
    margin-top: 4px;
}

/* Title */
.agh-title {
    margin: 0 0 4px 0;
    font-size: 1.1em;
    line-height: 1.35;
    font-weight: 700;
}

.agh-title a {
    text-decoration: none;
    color: #111;
}

.agh-title a:hover {
    color: #0073aa;
}

/* Excerpt */
.agh-excerpt {
    font-size: 0.95em;
    color: #555;
    margin-top: 8px;
    line-height: 1.5;
}

/* Separation */
.agh-sep {
    margin: 0 4px;
    color: #ccc;
}

/* =========================================
   HERO LAYOUT (OVERLAY STYLE)
   ========================================= */

/* Hero items have 100% height content area overlaid */
.agh-item-overlay {
    border: none;
    background: #000;
}

.agh-item-overlay .agh-thumb {
    padding-top: 0;
    height: 100%;
    /* Fill container */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.agh-item-overlay .agh-thumb::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75%;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.85) 100%);
    z-index: 1;
}

.agh-item-overlay .agh-content {
    position: relative;
    z-index: 2;
    justify-content: flex-end;
    /* Push to bottom */
    padding: 20px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    min-height: 250px;
    /* Ensure generic height if grid fails */
}

/* Hero Typography */
.agh-item-overlay .agh-title a {
    color: #fff;
}

.agh-item-overlay .agh-cat {
    background: #0073aa;
    color: #fff;
}

.agh-item-overlay .agh-meta-date {
    color: rgba(255, 255, 255, 0.8);
}

.agh-item-overlay .agh-excerpt {
    color: rgba(255, 255, 255, 0.9);
}

/* 
   MAGAZINE GRID TEMPLATES (3 and 4 items)
   We use the .agh-hero-count-X classes provided by PHP
*/

@media (min-width: 768px) {

    /* === 3 POST LAYOUT === */
    /* Left: 1 Main (Big). Right: 2 Stacked. */
    .agh-hero-count-3 {
        grid-template-columns: 1.5fr 1fr;
        /* Left wider */
        grid-template-rows: 1fr 1fr;
        height: 500px;
        /* Fixed height for the hero block */
    }

    .agh-hero-count-3 .agh-item:nth-child(1) {
        grid-column: 1;
        grid-row: 1 / span 2;
        /* Full Height */
    }

    .agh-hero-count-3 .agh-item:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .agh-hero-count-3 .agh-item:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }

    /* === 4 POST LAYOUT === */
    /* Left: 1 Main. Right: 3 Stacked. */
    .agh-hero-count-4 {
        grid-template-columns: 1.5fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        height: 600px;
    }

    .agh-hero-count-4 .agh-item:nth-child(1) {
        grid-column: 1;
        grid-row: 1 / span 3;
    }

    /* Others flow naturally into col 2 rows 1,2,3 */

    /* Typography Adjustments */
    .agh-hero-main .agh-title {
        font-size: 2em;
        margin-bottom: 10px;
    }

    .agh-hero-main .agh-content {
        min-height: auto;
    }

    /* Let grid handle height */
}

/* =========================================
   SIDEBAR LAYOUT
   ========================================= */
.agh-layout-sidebar .agh-sidebar-main {
    margin-bottom: 20px;
}

.agh-layout-sidebar .agh-sidebar-list {
    flex-direction: row;
    margin-bottom: 12px;
    border: none;
    box-shadow: none;
}

.agh-layout-sidebar .agh-sidebar-list .agh-thumb {
    width: 100px;
    height: 75px;
    padding-top: 0;
    flex-shrink: 0;
    margin-right: 12px;
}

.agh-layout-sidebar .agh-sidebar-list .agh-content {
    padding: 0;
    justify-content: center;
}

.agh-layout-sidebar .agh-sidebar-list .agh-title {
    font-size: 0.95em;
}

/* =========================================
   LOAD MORE
   ========================================= */
.agh-load-more-container {
    text-align: center;
    margin-top: 30px;
}

.agh-load-more {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 767px) {
    .agh-container {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .agh-item-overlay .agh-content {
        min-height: 200px;
    }
}