/* Service Modal Content Styling for Featherlight */

.service-modal {
    padding: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    color: #333;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.service-modal h2 {
    color: #40491d;
    margin: 0;
    padding: 15px 15px 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    font-family: "Noto Sans Thai", sans-serif;
}

.service-modal h2::before {
    content: '';
    position: absolute;
    left: 15px;
    bottom: -10px;
    width: 50px;
    height: 3px;
    background: #cef441;
    border-radius: 2px;
}

.service-modal img {
    width: 100%;
    margin: 15px 0 15px 0;
    border-radius: 8px;
    max-height: 450px;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    border: none;
}

.service-modal img:hover {
    transform: scale(1.02);
}

.service-modal p {
    font-size: 16px;
    line-height: 1.7;
    color: #000000;
    font-weight: 500;
    margin: 0;
    padding: 0 15px;
    letter-spacing: 0.3px;
    font-family: "Noto Sans Thai", sans-serif;
}

.service-modal p:first-of-type {
    padding-top: 10px;
}

.service-modal p:last-of-type {
    padding-bottom: 15px;
}

.service-modal p + p {
    margin-top: 12px;
}

/* Hide scrollbar */
.service-modal-container::-webkit-scrollbar {
    display: none;
}

.service-modal-container {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Featherlight overlay customization */
.featherlight {
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

/* Service Modal Overlay — panel only (backdrops are siblings on body for working blur) */
.service-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    z-index: 10002 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    pointer-events: none !important;
    visibility: hidden;
    opacity: 1 !important;
}

/* Blur-only layer: direct child of body — not under an opacity-animated parent */
.service-modal-backdrop-blur {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
    background-color: rgba(255, 255, 255, 0.02);
    -webkit-backdrop-filter: blur(28px) saturate(1.15);
    backdrop-filter: blur(28px) saturate(1.15);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    opacity: 0;
    transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.service-modal-backdrop-blur.is-open {
    opacity: 1;
}

.service-modal-backdrop-blur.is-closing {
    opacity: 0;
    transition-duration: 480ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark veil above blur */
.service-modal-backdrop-dim {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    pointer-events: auto;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.service-modal-backdrop-dim.is-open {
    opacity: 1;
}

.service-modal-backdrop-dim.is-closing {
    opacity: 0;
    transition-duration: 480ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .service-modal-backdrop-blur {
        display: none;
    }

    .service-modal-backdrop-dim {
        background-color: rgba(0, 0, 0, 0.72);
    }
}

/* Service Modal Container — slide on translateY (interpolates reliably vs mixed calc(-50%+…) ) */
.service-modal-container {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    --service-modal-slide-y: min(58vh, 520px);
    transform: translate(-50%, -50%) translateY(var(--service-modal-slide-y)) scale(0.96) !important;
    width: 90% !important;
    max-width: 850px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%) !important;
    border-radius: 12px !important;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
    animation: none !important;
    padding: 0 !important;
    z-index: 1 !important;
    pointer-events: auto !important;
    border: none !important;
    opacity: 0;
    will-change: transform, opacity;
    transition: transform 720ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Open: slide from bottom into center */
.service-modal-overlay.is-open {
    visibility: visible;
}

.service-modal-overlay.is-open .service-modal-container {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0) scale(1) !important;
    transition-delay: 56ms, 40ms;
}

.service-modal-overlay.is-closing {
    pointer-events: none !important;
}

/*
 * Close: same geometry as “rest”; keep opacity in sync with transform so the panel
 * stays visible while it moves (fast opacity was hiding the slide).
 */
.service-modal-overlay.is-closing .service-modal-container {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(var(--service-modal-slide-y)) scale(0.96) !important;
    transition-property: transform, opacity;
    transition-delay: 0ms, 0ms;
    transition-duration: 700ms, 700ms;
    transition-timing-function: cubic-bezier(0.32, 0, 0.67, 0.36),
                                cubic-bezier(0.4, 0, 0.2, 1);
}

.service-modal-overlay.is-closing .service-modal-close-btn {
    opacity: 0 !important;
    transform: scale(0.85) translateY(10px) !important;
    transition: opacity 320ms ease, transform 380ms cubic-bezier(0.4, 0, 0.2, 1) !important;
    pointer-events: none !important;
}

.service-modal-container .modal-content-wrapper {
    opacity: 0;
    transform: translateY(0);
    transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.service-modal-overlay.is-open .service-modal-container .modal-content-wrapper {
    opacity: 1;
    transition-delay: 140ms;
}

.service-modal-overlay.is-closing .service-modal-container .modal-content-wrapper {
    opacity: 1;
    transition: none;
}

/* Disable legacy slide animation inside JS modal to avoid conflicts */
.service-modal-container .service-modal {
    animation: none !important;
}

/* Prevent body and html scroll when modal is open */
body.modal-open,
html.modal-open {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* Scrollbar styling for modal container */
.service-modal-container::-webkit-scrollbar {
    width: 8px;
}



@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.featherlight:last-of-type {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.6);
}

.featherlight .featherlight-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    max-width: 850px;
    width: 90%;
    padding: 0;
    overflow: auto;
    transform: translateY(0);
    border: none;
}

/* Close button styling */
.featherlight .featherlight-close-icon {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    line-height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    z-index: 10000;
    border: none;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.featherlight .featherlight-close-icon:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: #fff;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.6);
}

.featherlight .featherlight-close-icon::before {
    content: '×';
    display: block;
}

/* Responsive adjustments */
@media only screen and (max-width: 768px) {
    .featherlight .featherlight-content {
        width: 95%;
        max-width: none;
    }

    .service-modal {
        border-radius: 12px;
    }

    .service-modal-container {
        width: 95% !important;
        max-height: 85vh !important;
    }

    .service-modal h2 {
        font-size: 24px;
        padding: 12px 12px 0;
    }

    .service-modal h2::before {
        left: 12px;
        width: 40px;
    }

    .service-modal img {
        max-height: 300px;
        margin: 12px 0 12px 0;
    }

    .service-modal p {
        font-size: 14px;
        padding: 0 12px;
    }

    .service-modal p:first-of-type {
        padding-top: 8px;
    }

    .service-modal p:last-of-type {
        padding-bottom: 12px;
    }

    .featherlight .featherlight-close-icon {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 22px;
    }
}

@media only screen and (max-width: 480px) {
    .service-modal-container {
        width: 95% !important;
        max-height: 80vh !important;
    }

    .service-modal h2 {
        font-size: 20px;
        padding: 10px 10px 0;
    }

    .service-modal img {
        max-height: 250px;
        margin: 10px 0 10px 0;
    }

    .service-modal p {
        font-size: 13px;
        padding: 0 10px;
        line-height: 1.6;
    }

    .service-modal p:first-of-type {
        padding-top: 8px;
    }

    .service-modal p:last-of-type {
        padding-bottom: 10px;
    }
}
