/* --- CONTENT SECTIONS (J, E, S) --- */
.content-section {
    background: #fff;
    color: #000;
    overflow: hidden;
}

/* BIG BACKGROUND LETTERS */
.bg-letter {
    position: absolute;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 30vw;
    color: rgba(0, 0, 0, 0.03);
    z-index: 0;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.letter-j {
    top: 10%;
    left: -5%;
}

.letter-e {
    top: 10%;
    right: -5%;
}

.letter-s {
    bottom: -10%;
    left: 10%;
}

/* IMAGE CROPS */
.img-crop {
    width: 100%;
    height: 600px;
    background-color: #f0f0f0;
    overflow: hidden;
    position: relative;
}

.img-crop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease-out;
}

.img-crop:hover img {
    transform: scale(1.1);
}

/* Crop Positions from Main Image */
.crop-1 img {
    object-position: 20% 30%;
}

.crop-2 img {
    object-position: 80% 40%;
    filter: grayscale(100%);
}

.crop-3 img {
    object-position: 50% 80%;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* SHARED GRID BACKGROUND (FORMULA + J/E/S) */
/* Use a fixed pseudo element on the body or a container if possible, but here we use fixed attachment on sections */
.content-section,
.section-formula {
    position: relative;
    /* Ensure no background color blocks the fixed grid if we move it to body, but here we apply to each */
}

.grid-background-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Behind content */
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center top;
    /* Center grid to align with centered running lines */
    /* Side blur mask */
    /* Side blur mask */
    /* Grid Visibility Fix - Simplified */
    opacity: 0;
    /* Hidden by default, shown via JS class */
    /* Slightly higher for visibility check */
    /* Removed mask for now to ensure it renders, can add back if too harsh */
    /* mask-image: linear-gradient(to right, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%); */
    /* -webkit-mask-image: linear-gradient(to right, transparent 0px, black 40px, black calc(100% - 40px), transparent 100%); */
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 1;
    /* Raised to be ABOVE section backgrounds */
}

/* Show grid only when these sections are in view - Controlled by JS or simply active when specific class is present */
body.show-grid .grid-background-fixed {
    opacity: 0.4;
    /* Ensure visibility when class is added */
}

/* RUNNING LINE ANIMATION */
.grid-running-line {
    position: absolute;
    top: 0;
    left: 20%;
    width: 1px;
    height: 100%;
    background: rgba(0, 0, 0, 0.02);
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.grid-running-line::after {
    content: '';
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to bottom, transparent, var(--c-accent), transparent);
    animation: runningLineDrop 4s infinite cubic-bezier(0.4, 0.26, 0, 0.97);
}

@keyframes runningLineDrop {
    0% {
        top: -50%;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        top: 120%;
        opacity: 0;
    }
}

/* Specific positions for different sections to vary it */
/* Specific positions for different sections to vary it */
/* Grid is 50px, centered. 50% is center line. Offsets must be multiples of 50px. */
.content-section:nth-of-type(1) .grid-running-line {
    left: calc(50% - 250px);
    /* -5 cols */
}

.content-section:nth-of-type(2) .grid-running-line {
    left: calc(50% + 250px);
    /* +5 cols */
}

.content-section:nth-of-type(3) .grid-running-line {
    left: 50%;
    /* Center col */
}

.content-wrapper {
    position: relative;
    z-index: 2;
    /* Raised to be ABOVE the grid */
}

@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .img-crop {
        height: 300px;
        order: -1;
        /* Image first on mobile */
    }

    .content-section:nth-of-type(even) .img-crop {
        order: -1;
        /* Ensure image is first even for alternating sections */
    }

    .bg-letter {
        font-size: 50vw;
        top: 5%;
    }
}