#header {
    position: relative;
    width: 100%;
    height: 250px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    margin-top: 78px;
    background-color: #454565;
    box-shadow: 0 0 10px 5px var(--font-color);
}

#header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

#header .info {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--header-font-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 15px;
    border-radius: 5px;
}

#main {
    margin-top: 50px;
}

#main > .section {
    padding: 50px 0;
}

.section.benefits .container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.section .wrapper.benefits {
    margin-top: 20px;
    gap: 0;
}

.section .wrapper.benefits .wrapper-item {
    --benefit-item-border-radius: 10px;

    position: relative;
    max-width: 140px;
    min-width: 140px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    justify-content: flex-start;
    gap: 5px;
    padding: var(--benefit-item-border-radius);
    border-radius: 0;
    box-shadow: none;
    background-color: var(--section-bg-img-title-color);
}
.section .wrapper.benefits .wrapper-item:not(:last-of-type)::after {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
    width: 1px;
    height: 80%;
    background-color: var(--text-color);
}
.section .wrapper.benefits .wrapper-item:first-of-type {
    border-top-left-radius: var(--benefit-item-border-radius);
    border-bottom-left-radius: var(--benefit-item-border-radius);
}
.section .wrapper.benefits .wrapper-item:last-of-type {
    border-top-right-radius: var(--benefit-item-border-radius);
    border-bottom-right-radius: var(--benefit-item-border-radius);
}
.section .wrapper.benefits .wrapper-item:hover {
    transform: none;
}

.section.benefits .wrapper-item .icon {
    font-size: 38px;
    color: var(--icon-color);
}

.section.local .container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section.questions .contact {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 65px 0 0;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

.section.questions .contact .button.phone {
    background-color: var(--color-phone);
}
.section.questions .contact .button.whatsapp {
    background-color: var(--color-whatsapp);
}
.section.questions .contact .button.email {
    background-color: var(--color-email);
}

.section.questions .wrapper {
    width: 100%;
    justify-content: space-around;
}



/* ==================================================
   BENEFICIOS - SERVICIO
================================================== */

.section.benefits {
    display: block;
    width: 100%;
}

.section.benefits .section-title {
    width: 100%;
    margin: 0 0 25px;
    text-align: left;
}

.section.benefits .section-description {
    width: 100%;
    margin: 0 0 20px;
    text-align: justify;
}

.section.benefits .wrapper.benefits {
    width: 65%;
    max-width: 760px;
    margin: 40px auto 0;
    display: flex;
    justify-content: center;
}

.section.benefits .wrapper.benefits .wrapper-item {
    flex: 1;
    text-align: center;
}

/* ==================================================
   CTA FINAL - SERVICIO
================================================== */

.section.cta {
    position: relative;
    width: 100%;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 0;
    margin-bottom: 0;
    padding: 80px 0 110px;
    background-image:
        linear-gradient(rgba(0, 103, 180, 0.78), rgba(0, 103, 180, 0.78)),
        url("../img/services/fisioterapia/fisioterapia-con-expertos.jpg");
    background-size: cover;
    background-position: center;
    color: var(--header-font-color);
    text-align: center;
}

.section.cta::before {
    content: "";
    position: absolute;
    left: -5%;
    top: -65px;
    width: 110%;
    height: 100px;
    background-color: var(--section-bg-color);
    border-radius: 0 0 50% 50% / 0 0 100% 100%;
}

.section.cta .container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
}

.section.cta .section-title {
    width: 100%;
    margin: 0;
    color: var(--header-font-color);
    text-align: center;
}

.section.cta p {
    margin: 0;
    color: var(--header-font-color);
}

.section.cta .button {
    margin-top: 20px;
}

/* ==================================================
   IMÁGENES DE SERVICIOS
   Marco decorativo como en la web original
================================================== */

.section .item-image {
    position: relative;
    z-index: 1;
    overflow: visible;
}

/* Marco verde desplazado */
.section .item-image::before {
    content: "";
    position: absolute;
    top: 22px;
    left: 22px;
    width: 100%;
    height: 100%;
    background: #557f7f;
    border-radius: 10px;
    z-index: -1;
}

/* Imagen */
.section .item-image img {
    display: block;
    position: relative;
    z-index: 2;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

/* Dos imágenes de ¿Tienes dudas? */
.section.questions .wrapper .item-image {
    width: 40%;
    min-width: 300px;
}

/* Imagen de instalaciones */
.section.local .item-image {
    width: 60%;
    max-width: 700px;
    min-width: 300px;
    margin: 35px auto 0;
}



.section p {
    line-height: 1.7;
    margin-top: 0;
    margin-bottom: 18px;
    text-align: justify;
}

.section.section-background.section-cta {
    margin-bottom: 0;
    clip-path: ellipse(110% 120% at 50% 120%);
}

@media (max-width: 800px) {

    /* Encabezado de las páginas de servicio */
    #header .info {
        align-items: center;
        text-align: center;
    }

    #header .info h1,
    #header .info p {
        text-align: center;
    }

    /* Beneficios: 2 x 2 en móvil */
    .section.benefits .wrapper.benefits {
        width: 280px;
        max-width: 280px;
        margin: 40px auto 0;
        display: grid;
        grid-template-columns: repeat(2, 140px);
        gap: 0;
    }

    .section.benefits .wrapper.benefits .wrapper-item {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
        box-sizing: border-box;
        border-radius: 0 !important;
    }

    /* Las líneas se dibujan solo con bordes */
    .section.benefits .wrapper.benefits .wrapper-item::before,
    .section.benefits .wrapper.benefits .wrapper-item::after {
        display: none !important;
        content: none !important;
    }

    /* Línea vertical central */
    .section.benefits .wrapper.benefits .wrapper-item:nth-child(odd) {
        border-right: 1px solid var(--text-color);
    }

    /* Línea horizontal entre las dos filas */
    .section.benefits .wrapper.benefits .wrapper-item:nth-child(1),
    .section.benefits .wrapper.benefits .wrapper-item:nth-child(2) {
        border-bottom: 1px solid var(--text-color);
    }

    /* Esquinas para 4 beneficios */
    .section.benefits .wrapper.benefits .wrapper-item:nth-child(1) {
        border-top-left-radius: 10px !important;
    }

    .section.benefits .wrapper.benefits .wrapper-item:nth-child(2) {
        border-top-right-radius: 10px !important;
    }

    .section.benefits .wrapper.benefits .wrapper-item:nth-child(3) {
        border-bottom-left-radius: 10px !important;
    }

    .section.benefits .wrapper.benefits .wrapper-item:nth-child(4) {
        border-bottom-right-radius: 10px !important;
    }

    /* Servicios con 3 beneficios: tercer bloque centrado */
    .section.benefits .wrapper.benefits:has(> :nth-child(3):last-child) .wrapper-item:nth-child(3) {
        grid-column: 1 / -1;
        justify-self: center;
        border-right: none !important;
        border-bottom-left-radius: 10px !important;
        border-bottom-right-radius: 10px !important;
    }

    /* Separación antes del footer */
    #main:has(.section.cta) {
        padding-bottom: 50px;
    }

    /* Encabezado de servicios en móvil */
    #header .info {
        top: 50%;
        left: 50%;
        width: 90%;
        max-width: 90%;
        box-sizing: border-box;
        align-items: center;
        text-align: center;
        transform: translate(-50%, -50%);
    }

    #header .info h1 {
        width: 100%;
        margin: 0;
        text-align: center;
    }

    /* Títulos de las secciones centrados en móvil */
    .section.benefits .section-title,
    .section.questions .section-title,
    .section.local .section-title {
        text-align: center;
    }

    #main > .section.questions {
        padding-bottom: 10px !important;
    }
}
