/*-- -------------------------- -->
<---         Why us           -->
<--- -------------------------- -*/

/* Mobile */
@media only screen and (min-width: 0rem) {
    /* Background styles */
    #services-218 {
        position: relative;
        overflow: hidden;
        padding: var(--sectionPadding);
    }

    .section-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        z-index: 0;
        /* Subtle effects for better readability */
        filter: brightness(0.85) contrast(1.1);
        opacity: 0.9;
        /* Optional subtle animation */
        animation: pan-image 30s linear infinite alternate;
    }

    @keyframes pan-image {
        0% { background-position: 30% 50%; }
        100% { background-position: 70% 50%; }
    }

    /* Adjust card transparency for better readability */
    .flip-card-front,
    .flip-card-back {
        background-color: rgba(250, 251, 252, 0.88); /* Semi-transparent white */
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    /* Dark mode adjustments */
    body.dark-mode .flip-card-front,
    body.dark-mode .flip-card-back {
        background-color: rgba(30, 30, 40, 0.88); /* Semi-transparent dark */
    }

    /* Ensure content stays above background */
    .cs-container {
        position: relative;
        z-index: 1;
    }

    /* Orange accent adjustment */
    .flip-card::before {
        background-color: rgba(242, 141, 121, 0.9); /* Your orange color with slight transparency */
    }

    #services-218 .cs-container {
        width: 100%;
        /* changes to 1280px at tablet */
        max-width: 34.375rem;
        margin: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        /* 48px - 64px */
        gap: clamp(3rem, 6vw, 4rem);
    }
    #services-218 .cs-content {
        /* set text align to left if content needs to be left aligned */
        text-align: left;
        width: 100%;
        max-width: 32.625rem;
        margin-right: auto;
        display: flex;
        flex-direction: column;
        /* centers content horizontally, set to flex-start to left align */
        align-items: flex-start;
    }

    #services-218 .cs-text {
        margin-bottom: 1rem;
    }
    #services-218 .cs-text:last-of-type {
        margin-bottom: 2rem;
    }
    #services-218 .cs-button-solid {
        font-size: 1rem;
        /* 46px - 56px */
        line-height: clamp(2.875rem, 5.5vw, 3.5rem);
        text-decoration: none;
        font-weight: 700;
        text-align: center;
        margin: 0;
        color: #fff;
        min-width: 9.375rem;
        padding: 0 1.5rem;
        background-color: var(--primary);
        border-radius: 0.25rem;
        display: inline-block;
        position: relative;
        z-index: 1;
        /* prevents padding from adding to the width */
        box-sizing: border-box;
    }
    #services-218 .cs-button-solid:before {
        content: "";
        position: absolute;
        height: 100%;
        width: 0%;
        background: #000;
        opacity: 1;
        top: 0;
        left: 0;
        z-index: -1;
        border-radius: 0.25rem;
        transition: width 0.3s;
    }
    #services-218 .cs-button-solid:hover:before {
        width: 100%;
    }
    #services-218 .cs-card-group {
        width: 100%;
        margin: 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(3, 1fr);  /* 3 cards per row for large screens */
        justify-content: center;
        align-items: center;
        flex-direction: column;
        gap: 2rem;
    }

    /* Grid Layout - Large Screens (3 per row) */
    #services-218 .cs-card-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);  /* 3 cards per row */
        gap: 2rem;
    }

    /* Intermediate Screens - 2 per row */
    @media (max-width: 992px) and (min-width: 601px) {
        #services-218 .cs-card-group {
            grid-template-columns: repeat(2, 1fr);  /* 2 cards per row */
        }

        .cs-h3 {
            font-size: clamp(1rem, 1.3vw, 1.4rem);  /* Reduce font size for smaller boxes */
        }

        .cs-item-text {
            font-size: clamp(1rem, 1.5vw, 1.5rem);;  /* Smaller font to fit content */
            line-height: 1.4;
        }

        .flip-card {
            height: auto;  /* Allow the card to expand */
            min-height: 250px;  /* Minimum height to avoid squishing */
        }

        .flip-card-front,
        .flip-card-back {
            padding: 1.25rem;  /* Adjust padding to fit better */
        }
    }

    /* Mobile View - 1 per row */
    @media (max-width: 600px) {
        #services-218 .cs-card-group {
            grid-template-columns: 1fr;  /* 1 card per row for mobile */
        }
    }
    #services-218 .cs-item {
        list-style: none;
        width: 100%;
        margin: 0; /* Remove margins */
        padding: 0; /* Remove padding to fit perfectly */
        box-sizing: border-box;
        background-color: #fafbfc;  /* Keep background if needed */
        border: 1px solid #dad9e3;  /* Outer border */
        border-radius: 0.3125rem;
        position: relative;
    }
    #services-218 .cs-item:hover:before {
        content: ""; /* Ensure it appears */
        position: absolute;
        top: -10px;
        left: -10px;
        width: 20%;
        height: 20%;
        background-color: #F28D79; /* Match your orange accent */
        border-radius: 0.3125rem;
        z-index: -1;
        box-shadow: none;
        opacity: 1; /* Ensure it's visible */
        transition: opacity 0.3s ease, transform 0.3s ease; /* Optional animation */
    }    
    #services-218 .cs-icon {
        /* 60px - 77px */
        width: clamp(3.75rem, 7.6vw, 4.8125rem);
        height: auto;
        margin-bottom: 2.5rem;
        display: block;
    }
    #services-218 .cs-item-text {
        color: var(--bodyTextColor);
        font-size: clamp(1rem, 1.5vw, 1.5rem);  /* Text scales within limits */
        line-height: 1.5;
        text-align: center;
        margin: 0;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    #services-218 .cs-watermark {
        display: none;
    }
    
    /* Cross-Browser Flip Card Styles */
    .flip-card {
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 4/3;
        perspective: 1000px;
        -webkit-perspective: 1000px; /* Safari */
    }

    .flip-card-inner {
        position: relative;
        width: 100%;
        height: 100%;
        transition: transform 0.8s;
        transform-style: preserve-3d;
        -webkit-transform-style: preserve-3d; /* Safari */
        border: 1px solid #dad9e3;
        border-radius: 0.3125rem;
        box-sizing: border-box;
    }

    .flip-card:hover .flip-card-inner,
    .flip-card:focus .flip-card-inner,
    .flip-card.hover .flip-card-inner {
        transform: rotateY(180deg);
        -webkit-transform: rotateY(180deg); /* Safari */
    }

    .flip-card-front,
    .flip-card-back {
        position: absolute;
        width: 100%;
        height: 100%;
        -webkit-backface-visibility: hidden; /* Safari */
        backface-visibility: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        box-sizing: border-box;
        border-radius: 0.3125rem;
        padding: clamp(1.5rem, 3vw, 2rem);
    }

    .flip-card-front {
        background-color: #fafbfc;
        z-index: 2;
    }

    .flip-card-back {
        transform: rotateY(180deg);
        -webkit-transform: rotateY(180deg); /* Safari */
        background-color: #fafbfc;
        color: #333;
    }

    .flip-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #fafbfc;
        border-radius: inherit;
        z-index: -1;
    }

    /* Firefox Specific Fix */
    @-moz-document url-prefix() {
        .flip-card {
            overflow: hidden;
        }
        .flip-card-inner {
            transform-style: flat;
        }
    }

    /* Safari Specific Fix */
    @media not all and (min-resolution:.001dpcm) { 
        @supports (-webkit-appearance:none) {
            .flip-card-inner {
                transform-style: preserve-3d;
                -webkit-transform-style: preserve-3d;
            }
        }
    }
}
/* Tablet */
@media only screen and (min-width: 48rem) {
    #services-218 .cs-container {
        max-width: 80rem;
        position: relative;
    }
    #services-218 .cs-content {
        width: 50%;
    }
    #services-218 .cs-card-group {
        display: grid;
        grid-template-columns: repeat(12, 2fr);  /* 2 cards per row */
    }
    #services-218 .cs-item {
        grid-column: span 4;
        grid-row: span 1;
        margin: 0;
        align-self: stretch;
    }
    #services-218 .cs-watermark {
        width: 30%;
        max-width: 14rem;
        height: auto;
        position: absolute;
        top: 0;
        right: 0;
        display: block;
    }
}

/* Responsive Font Scaling for Card Titles */
#services-218 .cs-h3 {
    font-size: clamp(1.25rem, 1.5vw, 1.75rem);
    font-weight: bold;
    text-align: center;
    margin: 0;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--headerColor);
    white-space: normal;
    word-wrap: break-word;
}

/* Dark Mode */
@media only screen and (min-width: 0rem) {
    body.dark-mode #services-218 .cs-title,
    body.dark-mode #services-218 .cs-text,
    body.dark-mode #services-218 .cs-h3,
    body.dark-mode #services-218 .cs-item-text {
        color: var(--bodyTextColorWhite);
    }
    body.dark-mode #services-218 .cs-item {
        background-color: var(--medium);
        border: none;
    }
    body.dark-mode #services-218 .cs-item:before {
        background: var(--accent);
    }
    body.dark-mode #services-218 .cs-icon {
        filter: brightness(3000%);
    }
}