/*---*\
Homepage Service Areas V2
Dark navy band with state pills, desktop map hover swap, optional family photo.

KEY FEATURES:
- Hardcoded void navy background and triangle motif
- Desktop (1200+): content + map flex row; hover/focus swaps map layers
- Mid (1025-1199): family sits beside layout; map still hidden
- Mobile: stacked content; map hidden; family band (378px photo, 334px bottom pad)
- CTA uses .btn-solid--white

IMPLEMENTATION NOTES:
- Tokens from custom-properties.css
- section-padding on block root for vertical rhythm
- Triangle SVG is decorative (CSS background)
\*---*/

.services-areas-v2 {
    position: relative;
    overflow: hidden;
    background-color: var(--dark-blue);
    color: var(--text-inverse);
    isolation: isolate;
}

.services-areas-v2::before {
    content: "";
    position: absolute;
    right: -286px;
    bottom: 0;
    z-index: 1;
    width: 1451px;
    height: 241px;
    background: url("/wp-content/themes/fx/assets/img/homepage/services-areas/triangle-bg.svg") no-repeat right bottom / 1451px 241px;
    pointer-events: none;
}

.services-areas-v2__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding-left: 22px;
    padding-right: 22px;
}

.services-areas-v2--has-family {
    padding-bottom: 0;
}

.services-areas-v2--has-family .services-areas-v2__inner {
    padding-bottom: 334px;
}

.services-areas-v2__layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 100%;
}

.services-areas-v2__content {
    display: flex;
    flex-direction: column;
    gap: var(--section-content-gap);
    width: 100%;
}

.services-areas-v2__copy {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.services-areas-v2__heading {
    margin: 0;
    padding: 0;
    color: var(--text-inverse);
    font-family: var(--font-heading);
    font-size: var(--fs-h2);
    font-weight: var(--font-weight-bold);
    line-height: var(--lh-heading);
}

.services-areas-v2__intro {
    margin: 0;
    color: var(--text-paragraph-inverse);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--font-weight-regular);
    line-height: var(--lh-body);
}

.services-areas-v2__intro p {
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: inherit;
}

.services-areas-v2__intro p + p {
    margin-top: 12px;
}

.services-areas-v2__intro strong {
    color: var(--orange);
    font-weight: var(--font-weight-bold);
}

.services-areas-v2__states {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.services-areas-v2__states-heading {
    margin: 0;
    padding: 0;
    color: var(--text-inverse);
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    text-transform: capitalize;
}

.services-areas-v2__states .services-areas-v2__states-list {
    display: flex;
    flex-wrap: wrap;
    gap: 11px 10px;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.services-areas-v2__states-item {
    margin: 0;
    padding: 0;
}

.services-areas-v2__states-item::before {
    display: none;
}

.services-areas-v2__state-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    border-radius: 18px;
    background-color: rgba(243, 244, 246, 0.24);
    color: var(--text-inverse);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    line-height: 36px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.services-areas-v2__state-link:hover,
.services-areas-v2__state-link:focus-visible,
.services-areas-v2__state-link.is-active {
    background-color: rgba(243, 244, 246, 0.36);
    color: var(--text-inverse);
    text-decoration: none;
    outline: none;
}

.services-areas-v2__state-link:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

.services-areas-v2__state-arrow {
    display: block;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.services-areas-v2__cta {
    display: flex;
}

.services-areas-v2__map-wrap {
    display: none;
    position: relative;
    width: 100%;
    max-width: 616px;
    flex-shrink: 0;
}

.services-areas-v2__map-loader {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(11, 31, 59, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.services-areas-v2__map-loader.is-active,
.services-areas-v2__map-wrap.is-loading .services-areas-v2__map-loader {
    opacity: 1;
    visibility: visible;
}

.services-areas-v2__map-loader::after {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: servicesAreasMapSpin 0.75s linear infinite;
}

.services-areas-v2__map-image {
    display: none;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.services-areas-v2__map-image.is-active {
    display: block;
}

/* Off-layout paint so lazy state maps begin fetching while the loader shows. */
.services-areas-v2__map-image.is-prefetching {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

@keyframes servicesAreasMapSpin {
    to {
        transform: rotate(360deg);
    }
}

.services-areas-v2__family {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 378px;
    max-width: none;
    transform: translateX(-50%);
    pointer-events: none;
}

.services-areas-v2__family-caption {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: flex-end;
    width: max-content;
    max-width: calc(100vw - 40px);
    margin-bottom: 37px;
    margin-right: 14px;
}

.services-areas-v2__family-arrow {
    position: absolute;
    left: -46px;
    top: 50%;
    transform: translateY(-50%);
    display: block;
    width: 36px;
    height: 31px;
    color: var(--text-inverse);
    overflow: visible;
}

.services-areas-v2__family-eyebrow {
    margin: 0;
    padding: 0;
    color: var(--text-inverse);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--font-weight-regular);
    line-height: var(--lh-body);
}

.services-areas-v2__family-names {
    margin: 0;
    padding: 0;
    color: var(--text-inverse);
    font-family: var(--font-heading);
    font-size: var(--fs-subheading);
    font-weight: var(--font-weight-bold);
    line-height: var(--lh-heading);
    white-space: nowrap;
}

.services-areas-v2__family-media {
    position: relative;
    z-index: 1;
    width: 100%;
    line-height: 0;
}

.services-areas-v2__family-image {
    display: block;
    width: 100%;
    height: 224px;
    object-fit: cover;
}

@media (min-width: 768px) {
    .services-areas-v2__inner {
        padding-left: 40px;
        padding-right: 40px;
    }

    .services-areas-v2__state-link {
        padding: 0 23px;
        font-size: 18px;
    }

    .services-areas-v2--has-family .services-areas-v2__inner {
        padding-bottom: 340px;
    }

    .services-areas-v2__family {
        width: 420px;
    }

    .services-areas-v2__family-caption {
        width: 278px;
        max-width: calc(100% - 60px);
        margin-right: 20px;
    }

    .services-areas-v2__family-names {
        white-space: normal;
    }
}

/* Mid desktop: family sits beside layout (map still hidden until 1200px). */
@media (min-width: 1025px) and (max-width: 1199px) {

    .services-areas-v2--has-family .services-areas-v2__inner {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 24px;
        padding-bottom: 0;
    }

    .services-areas-v2--has-family .services-areas-v2__layout {
        flex: 1 1 auto;
        min-width: 0;
        /* Keep copy clear of the bottom-flush family column. */
        padding-bottom: 24px;
    }

    .services-areas-v2--has-family .services-areas-v2__content {
        max-width: 560px;
        padding-bottom: 50px;
    }

    .services-areas-v2__family {
        position: relative;
        left: auto;
        bottom: 0;
        flex: 0 1 840px;
        width: 840px;
        max-width: min(840px, 46%);
        transform: none;
        align-self: flex-end;
    }

    .services-areas-v2__family-caption {
        width: auto;
        max-width: calc(100% - 40px);
        margin-bottom: 24px;
        margin-right: 0;
    }

    .services-areas-v2__family-arrow {
        left: -40px;
    }

    .services-areas-v2__family-image {
        height: auto;
        object-fit: contain;
        object-position: bottom center;
    }
}

@media (min-width: 1200px) {
    .services-areas-v2::before {
        right: 21px;
    }

    .services-areas-v2__inner {
        gap: 0;
    }

    .services-areas-v2--has-family .services-areas-v2__inner {
        padding-bottom: 145px;
        min-height: 620px;
    }

    .services-areas-v2__layout {
        flex-direction: row;
        align-items: center;
        gap: 30px;
    }

    .services-areas-v2__content {
        max-width: 617px;
        flex: 0 1 617px;
        gap: 32px;
    }

    .services-areas-v2__map-wrap {
        display: block;
        flex: 0 0 616px;
        height: 384px;
    }

    .services-areas-v2__map-image.is-active {
        height: 100%;
        object-fit: contain;
    }

    .services-areas-v2__family {
        left: calc(50% - 41.5px);
        width: 465px;
        max-width: none;
        transform: translateX(-50%);
    }

    .services-areas-v2__family-caption {
        position: absolute;
        left: calc(100% + 22px);
        bottom: 28px;
        align-self: auto;
        width: 278px;
        max-width: none;
        margin: 0;
    }

    .services-areas-v2__family-arrow {
        left: -5px;
        top: -43px;
        transform: rotate(77.65deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .services-areas-v2__state-link {
        transition: none;
    }

    .services-areas-v2__map-loader {
        transition: none;
    }

    .services-areas-v2__map-loader::after {
        animation: none;
        border-color: rgba(255, 255, 255, 0.55);
        border-top-color: var(--orange);
    }
}
