:root {
    --d: 700ms;
    --e: cubic-bezier(0.19, 1, 0.22, 1);
}

/* --- Layout Container (Kept for grid structure) --- */
.page-content {
    display: grid;
    grid-gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .page-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .page-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- Job Card Styles --- */
.job-card-new {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: 1rem;
    width: 100%;
    max-height: 350px;
    color: whitesmoke;
    background-color: whitesmoke;
    border-radius: 12px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1), 0 2px 2px rgba(0, 0, 0, 0.1), 0 4px 4px rgba(0, 0, 0, 0.1), 0 8px 8px rgba(0, 0, 0, 0.1);
    /* HEIGHT FIX: Reduced min-height */
    min-height: 420px;
}

.job-card-new:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 110%;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    transition: transform calc(var(--d) * 1.5) var(--e);
    pointer-events: none;
}

.job-card-new:after {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.79) 100%);
    transform: translateY(-50%);
    transition: transform calc(var(--d) * 2) var(--e);
}

/* --- Content Wrapper (Updated Class Name) --- */
.card-content-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Default: Left alignment */
    width: 100%;
    padding: 0;
    transition: transform var(--d) var(--e);
    z-index: 1;
}

.card-content-inner > * + * {
    margin-top: 0.5rem;
}

/* Ensure these are scoped to the job card */
.job-card-new .title {
    line-height: 1.2;
    margin-bottom: 0;
    color: inherit;
    text-align: left;
}

.job-card-new .copy {
    line-height: 1.35;
    margin-bottom: 0.5rem;
    align-self: flex-start;
    text-align: left;
}

.job-card-new .copy i {
    margin-right: 0.25rem;
}

/* Apply Now Link - Explicitly ensure visibility */
.job-card-new .btn { /* Scoped to job-card-new */
    cursor: pointer;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    letter-spacing: 0.025rem;
    text-transform: uppercase;
    color: white;
    background-color: transparent;
    border: 1px solid white;
    text-decoration: none;
    transition: background-color 0.3s;
    align-self: flex-start;
    opacity: 1;
}

.job-card-new .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/*below 2 are new*/
.job-card-new:hover {
    background-color: #00843D; /* your site green */
    transition: background-color 0.4s ease;
}

.job-card-new:hover:before,
.job-card-new:hover:after {
    opacity: 0; /* hide image and gradient overlay completely */
    transition: opacity 0.4s ease;
}


.job-card-new .btn:focus {
    outline: 1px dashed yellow;
    outline-offset: 3px;
}

/* --- Hover/Focus Effects (Desktop Only) --- */
@media (hover: hover) and (min-width: 992px) {
    .job-card-new:after {
        transform: translateY(0);
    }

    /* OFFSET FIX: Reduced offset to keep Title, Location, and Link visible on the shorter card. */
    .card-content-inner {
        transform: translateY(calc(100% - -7rem));
        align-items: flex-start;
    }

    /* Hover State - Content is fully revealed and REMAINS LEFT-ALIGNED */
    .job-card-new:hover,
    .job-card-new:focus-within {
        /* FIX: Ensure the main flex container aligns content to the start (top/left) */
        align-items: flex-start;
    }

    .job-card-new:hover .card-content-inner,
    .job-card-new:focus-within .card-content-inner {
        transform: translateY(0);
    }

    /* On hover, all content elements REMAINS LEFT-ALIGNED */
    .job-card-new:hover .card-content-inner > *,
    .job-card-new:focus-within .card-content-inner > * {
        /* FIX: Explicitly set alignment to start/left */
        align-self: flex-start !important;
        text-align: left !important;
    }

    /* Reveal the description on hover */
    .job-card-new:hover .job-description,
    .job-card-new:focus-within .job-description {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        transition-delay: calc(var(--d) / 8);
        transition: visibility 0s linear 0s, opacity var(--d) var(--e), transform var(--d) var(--e);
    }

    .job-card-new:hover:before {
        transform: translateY(-4%);
    }

    .job-card-new:hover:after {
        transform: translateY(-50%);
    }

    /* Instant transition for specific elements when focusing for accessibility */
    .job-card-new:focus-within:before,
    .job-card-new:focus-within:after,
    .job-card-new:focus-within .card-content-inner,
    .job-card-new:focus-within .job-description {
        transition-duration: 0s;
    }

    .copy .job-card-new {
        display: block;
    }
}

/* --- Mobile View (No Change) --- */
@media (max-width: 991px) {
    .job-card-new {
        align-items: center;
    }

    .card-content-inner {
        transform: translateY(0);
        align-items: center;
    }

    .card-content-inner > * {
        align-self: center !important;
        text-align: center !important;
    }

    .job-card-new .job-description {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    .job-card-new:after {
        transform: translateY(-50%);
    }
}
