.services_section {
    position: relative;
    padding: 80px 0;
    background: #ffffff;
    overflow: hidden;
}

/* =========================================================
   ANIMACIÓN DE FONDO & ORBES FLOTANTES
========================================================= */

/* Orbe luminoso superior derecho */
.services_section::before {
    content: '';
    position: absolute;
    top: -5%;
    right: -5%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--color-secundario) 12%, transparent) 0%, transparent 70%);
    pointer-events: none;
    animation: floatOrbServices 10s infinite ease-in-out alternate;
}

/* Orbe luminoso inferior izquierdo */
.services_section::after {
    content: '';
    position: absolute;
    bottom: -5%;
    left: -5%;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--color-primario) 10%, transparent) 0%, transparent 70%);
    pointer-events: none;
    animation: floatOrbServices 8s infinite ease-in-out alternate-reverse;
}

@keyframes floatOrbServices {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(35px) scale(1.1); }
}

/* =========================================================
   FONDO DECORATIVO CORPORATIVO (BLOBS ORGÁNICOS)
======================================================== */

.services_decor {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.services_section > .container {
    position: relative;
    z-index: 2;
}

.services_blob {
    position: absolute;
    display: block;
    border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
    filter: blur(70px);
    opacity: .45;
    will-change: transform, border-radius;
}

/* Blob 1 - azul (secundario), esquina superior izquierda */
.services_blob--1 {
    width: 460px;
    height: 460px;
    top: -150px;
    left: -140px;
    background: radial-gradient(circle at 35% 35%,
            color-mix(in srgb, var(--color-secundario) 60%, transparent),
            transparent 72%);
    animation: blobMorphServices 18s infinite ease-in-out alternate,
        floatOrbServices 12s infinite ease-in-out alternate;
}

/* Blob 2 - verde (primario), esquina inferior derecha */
.services_blob--2 {
    width: 500px;
    height: 500px;
    bottom: -170px;
    right: -160px;
    background: radial-gradient(circle at 60% 60%,
            color-mix(in srgb, var(--color-primario) 55%, transparent),
            transparent 72%);
    animation: blobMorphServices 22s infinite ease-in-out alternate-reverse,
        floatOrbServices 14s infinite ease-in-out alternate-reverse;
}

/* Blob 3 - mezcla verde/azul, centro inferior */
.services_blob--3 {
    width: 320px;
    height: 320px;
    bottom: 4%;
    left: 34%;
    opacity: .3;
    background: radial-gradient(circle at 50% 50%,
            color-mix(in srgb, var(--color-primario) 40%, var(--color-secundario)),
            transparent 70%);
    animation: blobMorphServices 26s infinite ease-in-out alternate,
        floatOrbServices 16s infinite ease-in-out alternate;
}

@keyframes blobMorphServices {
    0% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }
    50% { border-radius: 58% 42% 38% 62% / 56% 60% 40% 44%; }
    100% { border-radius: 45% 55% 52% 48% / 60% 38% 62% 40%; }
}

/* Modo oscuro: blobs más tenues */
html[data-theme="dark"] .services_blob {
    opacity: .22;
}

html[data-theme="dark"] .services_blob--3 {
    opacity: .16;
}

.section_heading_description {
    position: relative;
    z-index: 2;
    font-size: 15px;
    line-height: 1.8;
    color: #64748b;
    max-width: 620px;
    margin: 0 auto;
}

.service_group {
    position: relative;
    z-index: 2;
}

.service_group + .service_group {
    margin-top: 24px;
}

.service_group_title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 18px;
    color: var(--color-texto);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.service_group_title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--color-secundario) 25%, transparent);
}


/* =========================================================
   TARJETA DE SERVICIO (SERVICE CARD)
========================================================= */

.service_card {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    height: 100%;
    transition: transform .45s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow .45s ease, border-color .45s ease;
    border: 1px solid #eef2f7;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.service_card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
    border-color: color-mix(in srgb, var(--color-secundario) 40%, transparent);
}


/* =========================================================
   PORTADA Y OVERLAY CON ANIMACIONES
========================================================= */

.service_cover {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.service_cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s cubic-bezier(0.25, 1, 0.5, 1);
}

.service_card:hover .service_cover img {
    transform: scale(1.09);
}

.service_cover_overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.10) 0%,
        rgba(0, 0, 0, 0.75) 100%
    );
    transition: opacity .4s ease;
}

.service_card:hover .service_cover_overlay {
    opacity: 0.9;
}

.service_cover_text {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 22px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 1;
    transition: transform .4s ease;
}

.service_card:hover .service_cover_text {
    transform: translateY(-2px);
}


/* =========================================================
   CONTENIDO INTERNO Y TÍTULO ANIMADO
========================================================= */

.service_content {
    position: relative;
    padding: 24px 24px 28px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.service_content h3 {
    color: var(--color-texto);
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 14px;
}

/* Línea decorativa bajo el título que se expande al hacer hover */
.service_content h3::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    border-radius: 20px;
    background: linear-gradient(to right,
            var(--color-primario),
            var(--color-secundario));
    transition: width .4s ease;
}

.service_card:hover .service_content h3::after {
    width: 85px;
}

.service_content p {
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.7;
    margin-bottom: 22px;
}


/* =========================================================
   BOTÓN CON DESTELLO AUTOMÁTICO
========================================================= */

.service_btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 10px;
    margin-top: auto;
    padding: 11px 24px;
    border-radius: 50px;
    background: linear-gradient(135deg,
            var(--color-primario),
            var(--color-secundario));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    transition: all .35s ease;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--color-primario) 30%, transparent);
}

/* Brillo automático animado para destacar la llamada a la acción */
.service_btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 30%;
    height: 200%;
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(30deg);
    animation: btnShine 4.5s infinite ease-in-out;
}

@keyframes btnShine {
    0% { left: -60%; }
    20% { left: 130%; }
    100% { left: 130%; }
}

.service_btn:hover {
    transform: translateY(-3px);
    color: #fff;
    box-shadow: 0 14px 28px color-mix(in srgb, var(--color-primario) 45%, transparent);
}

.service_btn i {
    transition: transform .3s ease;
    font-size: 12px;
}

.service_btn:hover i {
    transform: translateX(6px);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media(max-width:768px) {
    .services_section {
        padding: 50px 0;
    }

    .service_cover {
        height: 200px;
    }

    .service_content {
        padding: 20px 20px 24px;
    }

    .service_content h3 {
        font-size: 20px;
    }

    .service_content p {
        font-size: 14px;
    }

    .service_cover_text {
        font-size: 18px;
    }

    .services_blob--1 {
        width: 320px;
        height: 320px;
        top: -110px;
        left: -110px;
    }

    .services_blob--2 {
        width: 340px;
        height: 340px;
        bottom: -120px;
        right: -120px;
    }

    .services_blob--3 {
        display: none;
    }
}

/* Tarjetas que se expanden al pasar el cursor */
.services_section--expandable {
    background: #ffffff;
}

.services_section--expandable::before,
.services_section--expandable::after,
.services_section--expandable .services_decor {
    display: none;
}

.service-expand-list {
    position: relative;
    z-index: 2;
    display: flex;
    min-width: 0;
    gap: 14px;
}

.service-expand-card {
    position: relative;
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    height: 460px;
    overflow: hidden;
    align-items: flex-end;
    border-radius: 28px;
    background-color: #123845;
    box-shadow: 0 12px 30px rgba(16, 40, 50, .12);
    transition: flex .65s cubic-bezier(.2, .75, .25, 1), box-shadow .35s ease;
}

.service-expand-card::before {
    position: absolute;
    inset: 0;
    background-image: var(--service-expand-cover);
    background-position: center;
    background-size: cover;
    content: "";
    transition: transform .75s cubic-bezier(.2, .75, .25, 1);
}

.service-expand-card.is-expanded::before {
    transform: scale(1.045);
}

.service-expand-overlay {
    position: absolute;
    z-index: 1;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            transparent 55%,
            rgba(0, 0, 0, .24) 64%,
            color-mix(in srgb, var(--color-primario, #21c36c) 28%, rgba(0, 0, 0, .78)) 82%,
            color-mix(in srgb, var(--color-primario, #21c36c) 38%, rgba(0, 0, 0, .92)) 100%
        ),
        linear-gradient(
            90deg,
            rgba(var(--service-vignette-rgb, 0, 0, 0), .25) 0%,
            transparent 20%,
            transparent 80%,
            rgba(var(--service-vignette-rgb, 0, 0, 0), .25) 100%
        );
}

.service-expand-collapsed-title {
    position: absolute;
    z-index: 2;
    bottom: 26px;
    left: 18px;
    margin: 0;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 2px 6px rgba(0, 0, 0, .9), 0 0 14px rgba(0, 0, 0, .45);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    transition: opacity .25s ease, transform .35s ease;
}

.service-expand-content {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 38px 54px 40px 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease .12s, visibility .3s ease .12s;
}

.service-expand-copy {
    width: 100%;
    max-width: 680px;
    color: #fff;
}

.service-expand-copy p {
    max-width: 620px;
    margin: 0 0 22px;
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
}

.service-expand-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 20px;
    color: #fff;
    border: 1px solid currentColor;
    border-radius: 28px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.service-expand-link:hover {
    color: #fff;
    background: var(--color-primario, #ce0b2b);
    border-color: var(--color-primario, #ce0b2b);
}

.service-expand-toggle {
    position: absolute;
    z-index: 3;
    right: 18px;
    bottom: 18px;
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(10, 40, 50, .28);
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    transition: opacity .25s ease, transform .3s ease, background-color .25s ease;
}

.service-expand-toggle:hover {
    background: var(--color-primario, #ce0b2b);
    border-color: var(--color-primario, #ce0b2b);
}

.service-expand-close-icon {
    display: none;
}

.service-expand-card.is-expanded .service-expand-open-icon {
    display: none;
}

.service-expand-card.is-expanded .service-expand-close-icon {
    display: inline-block;
}

.service-expand-card.is-expanded {
    flex: 4 1 0;
    box-shadow: 0 18px 42px rgba(16, 40, 50, .2);
}

.service-expand-card.is-expanded .service-expand-content {
    opacity: 1;
    visibility: visible;
}

.service-expand-card.is-expanded .service-expand-collapsed-title {
    opacity: 0;
    transform: rotate(180deg) translateY(-10px);
}

.service-expand-card.is-expanded .service-expand-toggle {
    color: #fff;
    background: rgba(10, 40, 50, .72);
}

@media (max-width: 991px) {
    .service-expand-card {
        height: 410px;
    }

    .service-expand-content {
        padding: 28px 66px 78px 28px;
    }

    .service-expand-copy {
        max-width: 100%;
    }

    .service-expand-copy p {
        font-size: 14px;
    }

}

@media (max-width: 767px) {
    .services_section--expandable {
        overflow: hidden;
    }

    .service-expand-list {
        overflow-x: auto;
        padding: 0 0 12px;
        scroll-snap-type: x mandatory;
        scrollbar-width: thin;
    }

    .service-expand-card {
        flex: 0 0 82%;
        height: 430px;
        scroll-snap-align: center;
    }

    .service-expand-card.is-expanded {
        flex: 0 0 92%;
    }

    .service-expand-content {
        padding: 24px 62px 72px 24px;
    }

    .service-expand-copy {
        max-width: 100%;
    }

    .service-expand-copy p {
        font-size: 14px;
    }

}

@media (hover: hover) and (pointer: fine) {
    .service-expand-card {
        cursor: default;
    }

    .service-expand-card:hover::before {
        transform: scale(1.045);
    }

    .service-expand-card:hover {
        flex: 4 1 0;
        box-shadow: 0 18px 42px rgba(16, 40, 50, .2);
    }

    .service-expand-card:hover .service-expand-content {
        opacity: 1;
        visibility: visible;
    }

    .service-expand-card:hover .service-expand-collapsed-title {
        opacity: 0;
        transform: rotate(180deg) translateY(-10px);
    }

}

@media (prefers-reduced-motion: reduce) {
    .service-expand-card,
    .service-expand-card::before,
    .service-expand-content,
    .service-expand-collapsed-title,
    .service-expand-toggle {
        transition-duration: .01ms;
    }
}