/* ===================================================
   Benefits Section
   =================================================== */

body {
    font-family: polymath-display, sans-serif;
}

.benefits {
    background-color: #FAFAFA;
    padding: 40px 0;
    overflow: hidden;
}

/* ===================================================
   Eyebrow, Title & Description
   =================================================== */
.benefits__eyebrow {
    font-size: 0.85rem;
    color: var(--color-secondary, #7a4a3a);
    margin-bottom: 8px;
    font-weight: 400;
}

.benefits__title {
    font-family: polymath-display, sans-serif;
    font-weight: 300;
    font-size: 2.2rem;
    color: #2d2d2d;
    line-height: 1.2;
    margin-bottom: 16px;
}

.benefits__description {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 540px;
}

/* ===================================================
   Image Column (Desktop only)
   =================================================== */
.benefits__image-col {
    display: flex;
    align-items: stretch;
}

.benefits__image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
}

.benefits__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.benefits__image--active {
    opacity: 1;
}

/* ===================================================
   Benefits Items List
   =================================================== */
.benefits__list {
    margin-bottom: 32px;
}

.benefits__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Number */
.benefits__item-number {
    font-size: 1.3rem;
    font-weight: 400;
    color: #999;
    min-width: 32px;
    padding-top: 2px;
    transition: color 0.3s ease;
    line-height: 1;
}

/* Title */
.benefits__item-title {
    font-family: polymath-display, sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: #999;
    margin-bottom: 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

/* Description text */
.benefits__item-text {
    font-size: 0.85rem;
    color: #888;
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    display: none;
}

/* Reduce-motion: skip the accordion animation entirely */
@media (prefers-reduced-motion: reduce) {
    .benefits__item-text {
        transition: none;
    }
}

/* Active state (desktop accordion) */
.benefits__item--active .benefits__item-number {
    color: var(--color-primary, #5c2a2a);
}

.benefits__item--active .benefits__item-title {
    color: var(--color-primary, #5c2a2a);
}

.benefits__item--active .benefits__item-text {
    max-height: 120px;
    opacity: 1;
    margin-top: 6px;
}

/* Mobile: all items look active */
@media (max-width: 991.98px) {
    .benefits__list {
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .benefits__item {
        flex-direction: column;
        gap: 4px;
        align-items: flex-end;
    }

    .benefits__item-content,
    .benefits__item-number {
        width: 70vw;
        text-align: left;
    }

    .benefits__item-number,
    .benefits__item--active .benefits__item-number {
        color: #999;
    }

    .benefits__item-title,
    .benefits__item--active .benefits__item-title {
        color: var(--color-primary, #5c2a2a);
    }

    .benefits__ctas {
        flex-direction: column;
    }

    .benefits__ctas .dv-cta {
        display: flex;
        width: 100%;
        justify-content: center;
    }

    .benefits__ctas .dv-cta .dv-cta__label {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile item image */
.benefits__item-image {
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
}

.benefits__item-image img {
    width: 80vw;
    height: 50vw;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* ===================================================
   CTA Buttons
   =================================================== */
.benefits__ctas {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.benefits__btn {
    display: inline-block;
    padding: 12px 32px;
    border-radius: 29px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: center;
}

/* Outline style (Descargar brochure) */
.benefits__btn--outline {
    background: transparent;
    border: 1.5px solid var(--color-primary-dark, #3d1a1a);
    color: var(--color-primary-dark, #3d1a1a);
}

.benefits__btn--outline:hover {
    background: var(--color-primary-dark, #3d1a1a);
    color: #ffffff;
    text-decoration: none;
}

/* Solid style (Habla con un asesor) */
.benefits__btn--solid {
    background: var(--color-primary, #5c2a2a);
    border: 1.5px solid var(--color-primary, #5c2a2a);
    color: #ffffff;
}

.benefits__btn--solid:hover {
    background: var(--color-primary-dark, #3d1a1a);
    border-color: var(--color-primary-dark, #3d1a1a);
    color: #ffffff;
    text-decoration: none;
}

/* ===================================================
   Responsive - Tablet (768px and up)
   =================================================== */
@media (min-width: 768px) {
    .benefits__title {
        font-size: 2.4rem;
    }

    .benefits__item-image img {
        height: 280px;
        object-fit: cover;
    }
}

/* ===================================================
   Responsive - Desktop (992px and up)
   =================================================== */
@media (min-width: 992px) {
    .benefits {
        padding: 80px 0;
        /* Fill the viewport so the section can be "pinned" while the
           scroll-capture (script.js) steps through the items. Centering
           keeps the content in view during the pin. */
        min-height: 100vh;
        display: flex;
        align-items: center;
    }

    /* The Bootstrap container inside should span the full width while the
       section is a flex container. */
    .benefits > .container-fluid {
        width: 100%;
    }

    .benefits__title {
        font-size: 2.8rem;
    }

    /* Exact 50/50 split: image (left) 50%, content (right) 50%,
       overriding the Bootstrap col-lg fractions. */
    .benefits__image-col {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .benefits__content-col {
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 48px;
    }

    /* Left border indicator on list */
    .benefits__list {
        border-left: 1px solid #e8e0dc;
        padding-left: 24px;
    }

    .benefits__item {
        padding: 20px 0;
        border-left: 3px solid transparent;
        margin-left: -27px;
        padding-left: 24px;
        transition: all 0.3s ease, border-color 0.3s ease;
    }

    .benefits__item--active {
        border-left-color: var(--color-primary, #5c2a2a);
    }

    .benefits__item-title {
        font-size: 1.3rem;
    }

    /* Desktop accordion: animate the text open/closed with a grid row that
       goes 0fr -> 1fr. This animates to the content's NATURAL height, so
       items of different text lengths expand/collapse smoothly instead of
       snapping against a fixed max-height (the old cause of the jump). */
    .benefits__item-text {
        display: grid;
        grid-template-rows: 0fr;
        /* max-height no longer drives the collapse on desktop */
        max-height: none;
        font-size: 0.88rem;
        /* Keep the closed state fully collapsed. */
        margin-top: 0;
        transition: grid-template-rows 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    }

    /* Inner wrapper is the row that collapses; overflow:hidden clips it and
       min-height:0 lets it shrink all the way to 0. */
    .benefits__item-text-inner {
        min-height: 0;
        overflow: hidden;
    }

    .benefits__item--active .benefits__item-text {
        grid-template-rows: 1fr;
        /* Override the shared (non-desktop) 120px rule from earlier in the file. */
        max-height: none;
    }

    .benefits__item-number {
        font-size: 2rem;
        min-width: 64px;
    }
}

/* ===================================================
   Responsive - Large Desktop (1200px and up)
   =================================================== */
@media (min-width: 1200px) {
    .benefits__title {
        font-size: 3rem;
    }


}
