/**
 * ForgR Homepage Layout: HERO
 * Premier article en bannière pleine largeur, reste en grille
 */

/* Container */
body.layout-hero .wp-block-latest-posts,
.forgr-hero-layout {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    list-style: none !important;
}

/* All cards base */
body.layout-hero .wp-block-latest-posts li,
.forgr-hero-layout li {
    background: var(--card-bg, #fff);
    border-radius: var(--card-border-radius, 12px);
    box-shadow: var(--card-shadow, 0 2px 8px rgba(0,0,0,0.06));
    border: var(--card-border, none);
    overflow: hidden;
    transition: var(--card-transition, all 0.3s ease);
    display: flex;
    flex-direction: column;
}

body.layout-hero .wp-block-latest-posts li:hover,
.forgr-hero-layout li:hover {
    transform: var(--card-hover-transform, translateY(-3px));
    box-shadow: var(--card-hover-shadow, 0 8px 24px rgba(0,0,0,0.12));
}

/* === FIRST ARTICLE: full-width hero banner === */
body.layout-hero .wp-block-latest-posts li:first-child,
.forgr-hero-layout li:first-child {
    grid-column: 1 / -1;
    min-height: 460px;
    position: relative;
    background: #000;
    display: block;
    border-radius: var(--card-border-radius, 12px);
    overflow: hidden;
}

/* Hero image fills the entire card */
body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__featured-image,
.forgr-hero-layout li:first-child .wp-block-latest-posts__featured-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__featured-image img,
.forgr-hero-layout li:first-child .wp-block-latest-posts__featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    display: block;
}

body.layout-hero .wp-block-latest-posts li:first-child:hover .wp-block-latest-posts__featured-image img,
.forgr-hero-layout li:first-child:hover .wp-block-latest-posts__featured-image img {
    transform: scale(1.04);
}

/* Gradient overlay */
body.layout-hero .wp-block-latest-posts li:first-child::after,
.forgr-hero-layout li:first-child::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* Hero title - bottom left overlay */
body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-title,
.forgr-hero-layout li:first-child .wp-block-latest-posts__post-title {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    color: #fff !important;
    font-size: 2.2rem;
    line-height: 1.2;
    font-weight: 700;
    z-index: 2;
    text-decoration: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-title:hover,
.forgr-hero-layout li:first-child .wp-block-latest-posts__post-title:hover {
    text-decoration: underline;
}

/* Hero excerpt - visible below title */
body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-excerpt,
.forgr-hero-layout li:first-child .wp-block-latest-posts__post-excerpt {
    position: absolute;
    bottom: 5.5rem;
    left: 2rem;
    right: 2rem;
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    line-height: 1.5;
    z-index: 2;
    margin: 0;
}

/* Hero date */
body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-date,
.forgr-hero-layout li:first-child .wp-block-latest-posts__post-date {
    position: absolute;
    top: 1.5rem;
    left: 2rem;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    z-index: 2;
    background: var(--secondary-color, #208bfe);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
}

/* === REGULAR CARDS (articles 2+) === */
body.layout-hero .wp-block-latest-posts li:not(:first-child) .wp-block-latest-posts__featured-image,
.forgr-hero-layout li:not(:first-child) .wp-block-latest-posts__featured-image {
    aspect-ratio: 16/10;
    overflow: hidden;
}

body.layout-hero .wp-block-latest-posts li:not(:first-child) .wp-block-latest-posts__featured-image img,
.forgr-hero-layout li:not(:first-child) .wp-block-latest-posts__featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

body.layout-hero .wp-block-latest-posts li:not(:first-child):hover .wp-block-latest-posts__featured-image img,
.forgr-hero-layout li:not(:first-child):hover .wp-block-latest-posts__featured-image img {
    transform: scale(1.05);
}

body.layout-hero .wp-block-latest-posts li:not(:first-child) .wp-block-latest-posts__post-title,
.forgr-hero-layout li:not(:first-child) .wp-block-latest-posts__post-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1rem 1.2rem 0.5rem;
    color: var(--card-title-color, #000);
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

body.layout-hero .wp-block-latest-posts li:not(:first-child) .wp-block-latest-posts__post-excerpt,
.forgr-hero-layout li:not(:first-child) .wp-block-latest-posts__post-excerpt {
    font-size: 0.95rem;
    color: var(--text-muted, #666);
    margin: 0 1.2rem 1rem;
    line-height: 1.6;
}

body.layout-hero .wp-block-latest-posts li:not(:first-child) .wp-block-latest-posts__post-date,
.forgr-hero-layout li:not(:first-child) .wp-block-latest-posts__post-date {
    font-size: 0.8rem;
    color: var(--card-meta-color, #888);
    margin: 0 1.2rem 1rem;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    body.layout-hero .wp-block-latest-posts li:first-child,
    .forgr-hero-layout li:first-child {
        min-height: 360px;
    }

    body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-title,
    .forgr-hero-layout li:first-child .wp-block-latest-posts__post-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 767px) {
    body.layout-hero .wp-block-latest-posts,
    .forgr-hero-layout {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    body.layout-hero .wp-block-latest-posts li:first-child,
    .forgr-hero-layout li:first-child {
        min-height: 280px;
    }

    body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-title,
    .forgr-hero-layout li:first-child .wp-block-latest-posts__post-title {
        font-size: 1.5rem;
        bottom: 1.5rem;
        left: 1.5rem;
        right: 1.5rem;
    }

    body.layout-hero .wp-block-latest-posts li:first-child .wp-block-latest-posts__post-excerpt,
    .forgr-hero-layout li:first-child .wp-block-latest-posts__post-excerpt {
        display: none;
    }
}
