/**
 * CMG Content Gate — Front-end styles
 */

/* ── Preview Gate ── */
.cmg-cg-gate-wall {
    position: relative;
    margin: 2em 0;
    padding: 0;
}

.cmg-cg-gate-overlay {
    position: absolute;
    top: -80px;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    pointer-events: none;
}

.cmg-cg-gate-prompt {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1.5em 2em;
    margin: 0;
}

.cmg-cg-gate-intro {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 1.5em;
    line-height: 1.5;
}

/* Gated content — hidden by default, revealed by JS */
.cmg-cg-gated {
    display: none;
}

.cmg-cg-gated.cmg-cg-revealed {
    display: block;
    animation: cmgCgFadeIn 0.5s ease-in;
}

@keyframes cmgCgFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Featured image: 980x400 crop matching Drupal main_image style ── */
.single-sponsored_article .wp-block-post-featured-image {
    aspect-ratio: 980 / 400;
    overflow: hidden;
}

.single-sponsored_article .wp-block-post-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Sponsor badge (left-column shortcode) ── */
.cmg-cg-sponsor-badge-left {
    margin: 0.75em 0 1.25em;
}

.cmg-cg-sponsor-badge-left .cmg-cg-sponsor-label {
    display: inline;
    font-weight: 600;
    font-size: 0.9em;
}

.cmg-cg-sponsor-badge-left .cmg-cg-sponsor-logo-left {
    display: block;
    max-width: 180px;
    max-height: 70px;
    height: auto;
    margin-top: 0.5em;
}

/* ── Download Gate ── */
.cmg-cg-download-gate {
    margin: 0 0 2em 0;
    padding: 2em;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.cmg-cg-sponsor-badge {
    margin-bottom: 1.5em;
    text-align: center;
}

.cmg-cg-sponsor-label {
    display: block;
    font-size: 0.85em;
    color: #777;
    margin-bottom: 0.5em;
}

.cmg-cg-sponsor-logo {
    max-width: 200px;
    max-height: 80px;
    height: auto;
}

.cmg-cg-download-intro {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 1.5em;
}

.cmg-cg-download-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

/* ── No-form layout collapse ──
 * The sponsored single template puts [cmg_gate_form] in a dedicated sidebar
 * column. When no form renders (No Gate mode, preview mode, or an unassigned
 * form), the shortcode outputs a hidden .cmg-cg-empty-gate marker instead of
 * empty content. These rules detect that marker with :has() and collapse the
 * two-column Kadence row to a single full-width column, hiding the empty
 * sidebar. Scoped to the row/column that actually contains the marker, so it
 * never affects multi-column layouts inside the article body, and needs no
 * per-site Kadence uniqueID (ports as-is to every sibling site). */
.kt-row-column-wrap:has(> .wp-block-kadence-column .cmg-cg-empty-gate) {
    grid-template-columns: 1fr !important;
}

.kt-row-column-wrap > .wp-block-kadence-column:has(.cmg-cg-empty-gate) {
    display: none !important;
}

/* With the row collapsed to full width, the featured image (width:100% at the
 * forced 980x400 ratio) would otherwise stretch across the whole content area
 * and upscale past its native crop. Cap it at the 980px sponsored crop so the
 * hero keeps its intended size; the article text still runs full width. */
.kt-row-column-wrap:has(> .wp-block-kadence-column .cmg-cg-empty-gate) .wp-block-post-featured-image {
    max-width: 980px;
}
