/* ============================================
   U.S. PORTFOLIO MIX — Two-segment bar with tabs
   Mirrors the Summit "Your portfolio's secret
   ingredient" layout: title+intro on left,
   pill-tab group on right, legend dots above a
   single 2-segment bar with labels inside.
   ============================================ */

.usa-mix {
    --usa-mix-segment-a: #313B58;
    --usa-mix-segment-b: #B4ACBB;
    --usa-mix-segment-c: #F6E7F8;
    --usa-mix-segment-d: #7C6F8E;

    background: var(--color-pure-white);
    border-top: 1px solid var(--color-border);
    padding: var(--section-padding) 0;
}

.usa-mix__inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ---- Header row: text left, tabs right ---- */
.usa-mix__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-10);
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.usa-mix__intro-block {
    flex: 1 1 auto;
    max-width: 720px;
}

.usa-mix__title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3.75vw, 3.25rem);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
    letter-spacing: -1px;
    color: var(--color-text-primary);
    margin: 0 0 var(--space-5);
}

.usa-mix__intro {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    margin: 0;
    max-width: 64ch;
}

/* ---- Pill-tab group ---- */
.usa-mix__tabs {
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px;
    background: var(--color-pure-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
}

.usa-mix__tab-indicator {
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 0;
    background: var(--color-text-primary);
    border-radius: var(--radius-pill);
    transform: translateX(0);
    transition: transform 520ms cubic-bezier(0.4, 0, 0.1, 1),
                width 520ms cubic-bezier(0.4, 0, 0.1, 1);
    pointer-events: none;
    z-index: 0;
}

.usa-mix__tab {
    appearance: none;
    position: relative;
    z-index: 1;
    border: 0;
    background: transparent;
    padding: 11px 18px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text-primary);
    border-radius: var(--radius-pill);
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--duration-base) var(--ease-out);
}

.usa-mix__tab:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 3px;
}

.usa-mix__tab--active {
    color: var(--color-pure-white);
}

/* ---- Legend row above the bar ---- */
.usa-mix__legend {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-5);
}

.usa-mix__legend-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}

.usa-mix__legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.usa-mix__legend-dot--a { background: var(--usa-mix-segment-a); }
.usa-mix__legend-dot--b { background: var(--usa-mix-segment-b); }
.usa-mix__legend-dot--c { background: var(--usa-mix-segment-c); }
.usa-mix__legend-dot--d { background: var(--usa-mix-segment-d); }

.usa-mix__legend-text {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-regular);
    color: var(--color-text-primary);
}

.usa-mix__legend-info {
    font-size: 1rem;
    color: var(--color-gray-300);
    line-height: 1;
    cursor: help;
}

/* ---- Two-segment bar ---- */
.usa-mix__bar {
    display: flex;
    width: 100%;
    /* min-height, not height — the bar grows taller when a narrow
       segment's label wraps to multiple lines */
    min-height: 84px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--color-border);
}

.usa-mix__segment {
    flex-basis: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: flex-grow var(--duration-slow) var(--ease-out-expo);
    min-width: 0;
}

.usa-mix__segment--a { background: var(--usa-mix-segment-a); }
.usa-mix__segment--b { background: var(--usa-mix-segment-b); }
.usa-mix__segment--c { background: var(--usa-mix-segment-c); }
.usa-mix__segment--d { background: var(--usa-mix-segment-d); }

.usa-mix__segment-label {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: var(--font-regular);
    letter-spacing: -0.2px;
    /* wrap to fit the segment width instead of clipping; the bar's
       min-height lets it grow taller when a narrow segment wraps */
    white-space: normal;
    overflow-wrap: break-word;
    text-align: center;
    line-height: 1.25;
    padding: 0 var(--space-2);
}

.usa-mix__segment--a .usa-mix__segment-label { color: var(--color-pure-white); }
.usa-mix__segment--b .usa-mix__segment-label { color: var(--color-pure-white); }
.usa-mix__segment--c .usa-mix__segment-label { color: var(--color-text-primary); }
.usa-mix__segment--d .usa-mix__segment-label { color: var(--color-pure-white); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .usa-mix__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-6);
    }

    .usa-mix__tabs {
        align-self: flex-start;
    }
}

@media (max-width: 900px) {
    /* Stack the bar vertically below 900px — with four segments a
       row-based bar collapses the small ones below the width their
       labels need ("15% Southeast & Midwest" clips). Stacked, each
       segment gets full row width and a proportional height instead. */
    .usa-mix__bar {
        flex-direction: column;
        min-height: 280px;
    }

    .usa-mix__segment {
        width: 100%;
        height: auto;
        min-height: 0;
    }

    .usa-mix__segment-label {
        font-size: 0.95rem;
        padding: 0 var(--space-3);
        white-space: normal;
        text-align: center;
        line-height: 1.2;
    }

    .usa-mix__legend {
        flex-wrap: wrap;
        gap: var(--space-5);
    }

    .usa-mix__tab {
        padding: 9px 18px;
        font-size: 13px;
    }
}
