.facility-main-container {
    max-width: 100%;
    margin: 0 auto;
    display: block;
    /* Revert to block */
    padding: 0;
}

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes */
.facility-section {
    opacity: 0;
}

.facility-section.animate {
    animation: fadeInUp 0.8s ease-out forwards;
}

.facility-item-wrapper {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.facility-item-wrapper.animate {
    opacity: 1;
    transform: translateY(0);
}

.facility-item-wrapper:nth-child(odd) .facility-image-box {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}

.facility-item-wrapper:nth-child(odd) .facility-image-box.animate {
    opacity: 1;
    transform: translateX(0);
}

.facility-item-wrapper:nth-child(odd) .facility-text-content {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease-out 0.4s, transform 0.8s ease-out 0.4s;
}

.facility-item-wrapper:nth-child(odd) .facility-text-content.animate {
    opacity: 1;
    transform: translateX(0);
}

.facility-item-wrapper:nth-child(even) .facility-image-box {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}

.facility-item-wrapper:nth-child(even) .facility-image-box.animate {
    opacity: 1;
    transform: translateX(0);
}

.facility-item-wrapper:nth-child(even) .facility-text-content {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease-out 0.4s, transform 0.8s ease-out 0.4s;
}

.facility-item-wrapper:nth-child(even) .facility-text-content.animate {
    opacity: 1;
    transform: translateX(0);
}

.facility-header-section {
    background: white;
    padding: 80px 40px 40px;
    text-align: right;
}

.facility-header-section h1 {
    font-size: 52px;
    margin-bottom: 0;
    font-weight: 400;
    color: #2c3e50;
    letter-spacing: -1px;
}

.facility-section {
    background: white;
    padding: 10px 40px;
    margin-top: 40px;
}

.facility-section:first-of-type {
    margin-top: 0;
}

.facility-section-title {
    text-align: center;
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.facility-section-title.animate {
    opacity: 1;
    transform: translateY(0);
}

.facility-section-title h2 {
    font-size: 42px;
    color: #2c3e50;
    margin-bottom: 0;
    font-weight: 400;
    position: relative;
    display: inline-block;
}

.facility-section-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #5a67d8;
    transition: width 0.8s ease-out 0.5s;
}

.facility-section-title.animate h2::after {
    width: 80px;
}

.facility-item-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 20px;
    width: 100%;
    margin-bottom: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.facility-item-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.facility-section:nth-child(even) .facility-item-wrapper {
    flex-direction: row-reverse;
}

.facility-section:nth-child(even) .facility-image-box {
    padding-left: 40px;
    padding-right: 0;
}

.facility-section:nth-child(even) .facility-text-content {
    padding-right: 40px;
    padding-left: 0;
}



.facility-image-box {
    width: 40%;
    padding-right: 40px;
    height: auto;
    display: flex;
    justify-content: center;
}

.facility-image-box img {
    width: 100%;
    height: auto;
    /* max-height: 300px; Removed to let image define height */
    display: block;
    border-radius: 8px;
    object-fit: contain;
    transition: transform 0.5s ease, filter 0.5s ease;
}

.facility-image-box:hover img {
    /* Removed scaling to prevent blur */
    filter: brightness(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.facility-text-content {
    padding-left: 40px;
    width: 60%;
}

.facility-text-content h3 {
    font-size: 32px;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 500;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

.facility-item-wrapper:hover .facility-text-content h3 {
    color: #5a67d8;
}

.facility-text-content h3::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: #5a67d8;
    transition: height 0.4s ease;
}

.facility-item-wrapper:hover .facility-text-content h3::before {
    height: 80%;
}

.facility-text-content p {
    font-size: 18px;
    line-height: 1.8;
    color: #4a4a4a;
    text-align: justify;
    margin: 0;
}

.facility-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.facility-grid-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.facility-grid-item.animate {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.facility-grid-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.facility-grid-image-container {
    width: 100%;
    height: 220px;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.facility-grid-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Changed to contain */
    transition: transform 0.5s ease, filter 0.5s ease;
}

.facility-grid-item:hover .facility-grid-image-container img {
    /* Removed scaling to prevent blur */
    filter: brightness(1.1);
}

.facility-grid-text-box {
    padding: 30px;
    background: white;
}

.facility-grid-text-box h3 {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 500;
}

.facility-grid-text-box p {
    font-size: 15px;
    color: #666;
    line-height: 1.7;
    text-align: justify;
}

@media (max-width: 968px) {
    .facility-item-wrapper {
        flex-direction: column;
        gap: 30px;
    }

    /* Reset the row-reverse for even items so they stack consistently (Image then Text) */
    .facility-section:nth-child(even) .facility-item-wrapper {
        flex-direction: column;
    }

    .facility-image-box,
    .facility-text-content {
        width: 100%;
        padding: 0;
    }

    .facility-image-box {
        margin-bottom: 20px;
        justify-content: center;
        /* Center image if it's smaller */
    }

    .facility-image-box img {
        max-height: none;
        /* Allow full height based on aspect ratio */
    }

    /* Reset padding overrides from nth-child(even) rules */
    .facility-section:nth-child(even) .facility-image-box,
    .facility-section:nth-child(even) .facility-text-content {
        padding: 0;
    }

    .facility-section:nth-child(even) .facility-image-box {
        order: 0;
        /* Ensure normal order */
    }

    .facility-section:nth-child(even) .facility-text-content {
        order: 0;
        /* Ensure normal order */
    }

    .facility-header-section h1 {
        font-size: 38px;
        text-align: center;
    }

    .facility-section-title h2 {
        font-size: 32px;
    }

    .facility-header-section,
    .facility-section,
    .facility-item-wrapper {
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {
    .facility-text-content h3 {
        font-size: 24px;
    }

    .facility-text-content p {
        font-size: 15px;
        text-align: left;
        /* Often better for reading on mobile */
    }
}