/* ================================
   BUYOUT SECTION — HORIZONTAL FLOW
   Big screen: 1 column, text on top, horizontal flow below
   Small screen: vertical flow
   ================================ */

.buyout-content {
    grid-template-columns: 1fr;
    gap: 32px;
}

.buyout-text {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

@media (min-width: 1025px) {
    .buyout-section .section-title {
        white-space: nowrap;
    }
}

.buyout-benefits {
    display: inline-flex;
    text-align: left;
}

.buyout-demo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.buyout-story-flow {
    flex-direction: row;
    max-width: none;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
}

.flow-step {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}

/*
 * Card = grid with 2 rows:
 *   Row 1 (fixed 160px): graphic area, centered
 *   Row 2 (auto): label, pushed to bottom by the fixed row above
 */
.flow-step-card {
    display: grid;
    grid-template-rows: 160px auto;
    align-items: start;
    gap: 0;
}

/* All children except label go in row 1, centered */
.flow-step-card > *:not(.flow-step-label) {
    grid-row: 1;
    align-self: center;
    justify-self: center;
}

/* Label always in row 2 */
.flow-step-label {
    grid-row: 2;
    margin-top: 16px;
    justify-self: center;
}

/* Connector at half of 160px = center of graphic row */
.flow-connector {
    flex-direction: row;
    width: 60px;
    height: 2px;
    flex-shrink: 0;
    margin: 80px -10px 0;
    z-index: 1;
}

/* First connector (phone → viral) needs more reach since phone is narrower */
.buyout-story-flow > :nth-child(2) {
    width: 80px;
    margin-left: -25px;
}

.flow-connector-line {
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(
        to right,
        var(--gray-300) 0px,
        var(--gray-300) 4px,
        transparent 4px,
        transparent 8px
    );
}

@keyframes connectorDotMoveH {
    0% { left: 0; opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { left: calc(100% - 6px); opacity: 0; }
}

@media (min-width: 1025px) {
    .buyout-story-flow.animate-in > :nth-child(2) .flow-connector-dot,
    .buyout-story-flow.animate-in > :nth-child(4) .flow-connector-dot,
    .buyout-story-flow.animate-in > :nth-child(6) .flow-connector-dot {
        animation-name: connectorDotMoveH;
    }
}

/* Mobile: revert to vertical flow */
@media (max-width: 1024px) {
    .buyout-story-flow {
        flex-direction: column;
        align-items: center;
        max-width: 340px;
        margin: 0 auto;
    }

    .flow-step-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .flow-step-card > *:not(.flow-step-label) {
        align-self: auto;
        justify-self: auto;
    }

    .flow-step-label {
        margin-top: 0;
    }

    .flow-connector {
        flex-direction: column;
        width: 2px;
        height: 36px;
        margin: 0;
        align-items: center;
    }

    .buyout-story-flow > :nth-child(2) {
        width: 2px;
        margin-left: 0;
    }

    .flow-connector-line {
        width: 2px;
        height: 100%;
        background: repeating-linear-gradient(
            to bottom,
            var(--gray-300) 0px,
            var(--gray-300) 4px,
            transparent 4px,
            transparent 8px
        );
    }
}
