/*
 * NewsFactory homepage styles.
 * Loaded only on front page / custom NewsFactory home template.
 */

.newsfactory-home {
    margin-top: 0;
    margin-bottom: 40px;
}

/* ===============================================
   Hero Section (50% / 25% / 25% Grid)
   =============================================== */

.nf-hero {
    padding: 20px 0 30px;
    background: var(--nf-surface-primary);
}

.nf-hero__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}

.nf-hero__slider {
    /* 50% - Featured slider */
}

.nf-hero__cards {
    /* 25% - Two stacked post cards */
}

.nf-hero__tabs {
    /* 25% - Latest/Popular tabs */
}

/* Responsive */
@media (max-width: 1199px) {
    .nf-hero__grid {
        grid-template-columns: 1fr 1fr;
    }

    .nf-hero__slider {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .nf-hero {
        padding: 0 0 20px;
    }

    .nf-hero__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .nf-hero__slider {
        grid-column: auto;
    }
}

/* ===============================================
   Hero Ad Banner
   =============================================== */

.nf-hero__ad {
    text-align: center;
}

.nf-hero__ad a {
    display: block;
}

.nf-hero__ad-img {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 3 / 1;
    object-fit: fill;
    border-radius: 4px;
    display: block;
}

.nf-hero__ad-video {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 3 / 1;
    object-fit: fill;
    border-radius: 4px;
    display: block;
    background: #05070d;
}

/* ===============================================
   Latest Stories Feed
   =============================================== */

.newsfactory-feed {
    padding-top: 30px;
}

.newsfactory-feed-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.newsfactory-feed-head h2 {
    margin: 0;
}

.newsfactory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

/* Important: override parent theme post sizing/floats that squash cards. */
.newsfactory-grid > .newsfactory-card,
.newsfactory-grid > article.post {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    float: none !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

.newsfactory-card {
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.newsfactory-card-link {
    display: block;
    outline: none !important;
}

.newsfactory-media {
    position: relative;
    background: #f8fafc;
    height: 220px;
    min-height: 220px;
    overflow: hidden;
}

.newsfactory-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.newsfactory-media .original-image {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.newsfactory-card:hover .newsfactory-media .original-image,
.newsfactory-card:focus-within .newsfactory-media .original-image {
    opacity: 1;
}

.newsfactory-card-body {
    padding: 16px;
}

.newsfactory-meta {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 8px;
}

.newsfactory-card-body h3 {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.2;
    word-break: break-word;
}

.newsfactory-card-body p {
    margin: 0;
    line-height: 1.55;
}

.newsfactory-no-image,
.newsfactory-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 600;
    min-height: 180px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    padding: 14px;
    text-align: center;
}

.newsfactory-empty {
    min-height: 120px;
}

@media (max-width: 991px) {
    .newsfactory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .newsfactory-hero h1 {
        font-size: 42px;
    }
}

@media (max-width: 640px) {
    .newsfactory-grid {
        grid-template-columns: 1fr;
    }

    .newsfactory-feed-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .newsfactory-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 767px) {
	.nf-hero__ad-img,
	.nf-hero__ad-video,
	.nf-fullwidth-ad__img {
		aspect-ratio: 4 / 1;
		height: auto !important;
	}
}


/* ===============================================
   Ad Creator Badge
   =============================================== */

.nf-ad-creator {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    background: #6366f1; /* fallback if inline style missing */
    border-radius: 16px;
    z-index: 10;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nf-ad-creator.nf-agent-pill-link {
    cursor: pointer;
}

.nf-ad-creator.nf-agent-pill-link::after {
    content: "↗";
    margin-left: 6px;
    font-size: 0.78em;
    line-height: 1;
    opacity: 0.95;
}

.nf-ad-creator.nf-agent-pill-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.95);
    outline-offset: 2px;
}

.nf-ad-creator__icon {
    font-size: 10px;
    opacity: 0.9;
}

/* Top-left variant for product ads */
.nf-ad-creator--top {
    top: 8px;
    bottom: auto;
}

/* Make sure parent containers are positioned for badge */
.nf-hero__ad,
.nf-fullwidth-ad .container,
.nf-sidebar-ad,
.nf-sidebar-ad__image-wrap {
    position: relative;
}

.nf-fullwidth-ad .container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.nf-fullwidth-ad__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 1;
    object-fit: cover;
}

.nf-fullwidth-ad__video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 1;
    object-fit: cover;
    background: #05070d;
}

/* ===============================================
   Sidebar Product Ad (WooCommerce Style)
   =============================================== */

.nf-sidebar-ad--product {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.nf-sidebar-ad--product .nf-sidebar-ad__link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.nf-sidebar-ad--product .nf-sidebar-ad__image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8fafc;
}

.nf-sidebar-ad--product .nf-sidebar-ad__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.nf-sidebar-ad--product .nf-sidebar-ad__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #05070d;
}

.nf-sidebar-ad--product:hover .nf-sidebar-ad__img {
    transform: scale(1.05);
}

.nf-sidebar-ad--product .nf-sidebar-ad__content {
    padding: 16px;
    text-align: left;
}

.nf-sidebar-ad--product .nf-sidebar-ad__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    color: #1e293b;
}

.nf-sidebar-ad__price {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 8px;
}

.nf-sidebar-ad--product .nf-sidebar-ad__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
}
