/* ===============================
 ESSAY BANNER
=============================== */

.essay-banner {
    height: 320px;
    background: url('../img/banner.jpg') center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.essay-banner h1 {
    color: #fff;
    font-size: 44px;
    font-weight: 800;
    background: rgba(0,0,0,0.6);
    padding: 15px 40px;
}

/* ===============================
 ESSAY SECTION
=============================== */

.essay-section {
    padding: 120px 0;
    background: #fff;
    font-family: "Segoe UI", system-ui, sans-serif;
}

.container {
    max-width: 1400px;
    margin: auto;
    padding: 0 20px;
}

/* ===============================
 VARIABLES
=============================== */

:root {
    --green: #1f5e25;

    /* desktop sizes */
    --content-w: 720px;
    --content-h: 440px;
    --img-w: 420px;
    --img-h: 630px;

    /* how much the green block slides behind the image */
    --overlap-x: 320px;

    /* mobile vertical overlap */
    --overlap-y-mobile: 140px;

    /* base padding */
    --pad-y: 70px;
    --pad-x: 60px;

    /* safe space so text never enters overlap area */
    --text-safe: 260px;
}

/* ===============================
 ESSAY ITEM (BASE)
=============================== */

.essay-item {
    position: relative;
    min-height: 600px;
    margin-bottom: 180px;
    overflow: visible;
}

/* =======================================================
 DESKTOP GREEN BLOCK AS BACKGROUND ONLY
======================================================= */

.essay-item::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;

    width: var(--content-w);
    height: var(--content-h);
    background: var(--green);

    transform: translateY(-50%) translateX(calc(-1 * var(--overlap-x)));
    z-index: 1;
}

.essay-item.right::before {
    left: 0;
    right: auto;
    transform: translateY(-50%) translateX(var(--overlap-x));
}

/* ===============================
 IMAGE (MIDDLE LAYER)
=============================== */

.essay-image {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 2;
}

.essay-item.right .essay-image {
    right: 0;
    left: auto;
}

.essay-image img {
    width: var(--img-w);
    height: var(--img-h);
    object-fit: cover;
    display: block;
    background: #fff;
    box-shadow: 0 35px 70px rgba(0,0,0,0.35);
}

/* ===============================
 TEXT BLOCK (TOP LAYER) — NO BACKGROUND
=============================== */

.essay-content {
    position: absolute;
    top: 50%;
    right: 0;

    width: var(--content-w);
    height: var(--content-h);

    transform: translateY(-50%) translateX(calc(-1 * var(--overlap-x)));

    /* push text away from overlap zone (left image) */
    padding: var(--pad-y) var(--pad-x) var(--pad-y) calc(var(--pad-x) + var(--text-safe));
    box-sizing: border-box;

    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;

    z-index: 3;
    background: transparent;
}

.essay-item.right .essay-content {
    left: 0;
    right: auto;
    transform: translateY(-50%) translateX(var(--overlap-x));

    /* push text away from overlap zone (right image) */
    padding: var(--pad-y) calc(var(--pad-x) + var(--text-safe)) var(--pad-y) var(--pad-x);
}

/* ===============================
 TEXT STYLES
=============================== */

.essay-content h3 {
    font-size: 28px;
    margin-bottom: 18px;
}

.essay-content p {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 28px;
    max-width: 100%;
}

/* ===============================
 BUTTON
=============================== */

.essay-btn {
    align-self: flex-start;
    border: 2px solid #fff;
    padding: 10px 24px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}

.essay-btn:hover {
    background: #fff;
    color: var(--green);
}

/* ===============================
 PAGINATION
=============================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 80px;
}

.pagination button {
    background: #000;
    color: #fff;
    padding: 10px 18px;
    border: none;
    cursor: pointer;
}

/* =====================================================
 FIX FOR YOUR 1085px SCREENSHOT (MEDIUM SCREENS)
===================================================== */

@media (max-width: 1200px) {
    :root {
        --content-w: 640px;
        --content-h: 420px;
        --img-w: 380px;
        --img-h: 520px;
        --overlap-x: 200px;
        --text-safe: 220px;
        --pad-y: 60px;
        --pad-x: 50px;
    }
}

/* =====================================================
 MOBILE — IMAGE TOP, TEXT BELOW, STILL OVERLAP
===================================================== */

@media (max-width: 992px) {

    /* ✅ make the overlap visible on mobile */
    :root {
        --overlap-y-mobile: 200px; /* was 140px */
    }

    .essay-item {
        min-height: auto;
        margin-bottom: 120px;

        isolation: isolate;

        /* reserve space for negative overlap so next card won't collide */
        padding-bottom: var(--overlap-y-mobile);
    }

    .essay-item::before {
        content: none;
    }

    .essay-image {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        text-align: center;
        z-index: 3;
    }

    .essay-item.right .essay-image {
        left: 0;
        right: 0;
    }

    /* ✅ REALLY increase image height on mobile */
    .essay-image img {
        width: 90%;
        height: clamp(680px, 90vh, 980px); /* ✅ increased height */
        max-height: none;
        object-fit: cover;                 /* ✅ fills the frame */
        margin: 0 auto;
        background: #fff;
    }

    /* ✅ overlap stays, BUT text will NOT go under the image */
    .essay-content {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        transform: none;

        width: 100%;
        height: auto;

        margin-top: calc(-1 * var(--overlap-y-mobile));

        /* IMPORTANT: push content down inside green box
           so heading/text never sits under the image */
        padding: calc(60px + var(--overlap-y-mobile)) 40px 60px;

        background: var(--green);
        z-index: 2;
    }

    .essay-item.right .essay-content {
        left: 0;
        right: 0;
        transform: none;
        padding: calc(60px + var(--overlap-y-mobile)) 40px 60px;
    }
}

@media (max-width: 576px) {

    :root {
        --overlap-y-mobile: 170px;
    }

    .essay-image img {
        height: clamp(560px, 85vh, 820px); /* ✅ increased height for small phones */
        max-height: none;
    }

    .essay-content {
        padding: calc(40px + var(--overlap-y-mobile)) 30px 40px;
    }

    .essay-item.right .essay-content {
        padding: calc(40px + var(--overlap-y-mobile)) 30px 40px;
    }

    .essay-content h3 {
        font-size: 22px;
    }
}
