/* Life Stage Roadmap Section Styles - Version 4.0 */
/* Based on Figma node-id: 939-7076 and 939-6265 */

/* ==================== MAIN SECTION ==================== */
.lifestage-roadmap-section {
    position: relative;
    background: #fdf5f1;
    padding: 0;
    overflow: visible;
    /* Allow content to extend naturally - horizontal overflow prevented by wrapper */
    overscroll-behavior: none;
    /* Prevent elastic/rubber-band scrolling */
}

/* ==================== TEXT SECTION ==================== */
.lifestage-text-section {
    position: relative;
    padding: 0 120px;
    overflow: hidden;
    overflow-y: hidden;
    /* Explicitly prevent vertical scrollbar */
    overflow-x: hidden;
    /* Explicitly prevent horizontal scrollbar */
    min-height: 600px;
    z-index: 1;
}

.lifestage-text-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    object-fit: cover;
    object-position: top center;
}

.lifestage-text-container {
    position: relative;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 0 280px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.lifestage-text-title {
    font-family: 'IvyOra Display', serif;
    font-size: 32px;
    font-weight: 500;
    line-height: normal;
    color: #005b68;
    margin: 0;
    max-width: 477px;
}

.lifestage-text-title .title-bold {
    font-weight: 700;
    font-style: normal;
}

.lifestage-text-title em,
.lifestage-text-title .title-italic {
    font-weight: 500;
    font-style: italic;
}

.lifestage-text-description {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: normal;
    color: #403936;
    width: 100%;
}

.lifestage-text-description p {
    margin: 0 0 16px;
}

.lifestage-text-description p:last-child {
    margin-bottom: 0;
}

.lifestage-text-description strong {
    font-weight: 700;
}

/* ==================== ROADMAP WRAPPER ==================== */
.lifestage-roadmap-wrapper {
    position: relative;
    width: 100%;
    max-width: 1440px;
    height: 666px;
    margin: 0 auto;
    overflow: visible;
    /* Allow cards to extend above wrapper */
    overscroll-behavior: none;
    /* Prevent elastic/rubber-band scrolling */
    touch-action: pan-y;
    /* Allow vertical scrolling only, prevent horizontal */
    z-index: 2;
    /* Previously hidden during development; now visible */
}

/* Picture element wrapper for responsive road images */
.roadmap-path-picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.roadmap-path-image {
    position: absolute;
    top: -94px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 758px;
    /* Fixed height to maintain vertical positions (728px natural + adjustments) */
    object-fit: cover;
    /* Crop horizontally, maintain vertical dimensions */
    object-position: center top;
    z-index: 0;
    pointer-events: none;
}

/* Cards Container */
.roadmap-cards-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ==================== INDIVIDUAL ROADMAP CARD ==================== */
.roadmap-card {
    position: absolute;
    width: fit-content;
    max-width: 600px;
    z-index: 2;
    transition:
        left 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: left, top, opacity;
}

/* ACTIVE POSITION - Where expanded card shows (bottom right of road curve) */
/* From Figma node-id: 939-7076 - Active card position */
/* Position uses calc() for responsive centering: 50% - 55px (offset from center at 1440px: 665 - 720 = -55) */

/* All cards start hidden except card 1 */
.roadmap-card[data-stage='1'] {
    left: calc(50% - 55px);
    top: 285px;
    opacity: 1;
}

.roadmap-card[data-stage='2'],
.roadmap-card[data-stage='3'],
.roadmap-card[data-stage='4'],
.roadmap-card[data-stage='5'],
.roadmap-card[data-stage='6'] {
    left: calc(50% - 55px);
    top: 285px;
    opacity: 0;
}

/* ==================== PIN/STEM CONNECTORS ==================== */
/* Pin is attached to the card - card positioning controls where pin lands on road */
.roadmap-pin {
    position: absolute;
    background: url('../icons/roadmap-pin.svg') no-repeat center top;
    background-size: contain;
    z-index: -1;
    width: 54px;
    height: 252px;
    left: -53px;
    /* Pin center aligned with card left edge */
    top: 50%;
    /* Pin TOP at card vertical center - stem extends down to road */
    transition:
        background-image 0.3s ease,
        width 0.4s ease,
        height 0.4s ease,
        left 0.4s ease,
        top 0.4s ease;
}

/* Grey pin for collapsed cards - smaller size */
.roadmap-card.collapsed .roadmap-pin {
    background-image: url('../icons/roadmap-pin-grey.svg');
    background-position: center top;
    width: 30px;
    height: 140px;
    left: -30px;
    /* Pin center aligned with card left edge */
    top: 50%;
    /* Pin TOP at card vertical center */
}

/* ==================== CARD CONTENT STYLES ==================== */
/* Expanded state (full content visible) */
.roadmap-card-content {
    background: #ffffff;
    border: 1px solid #005b68;
    border-radius: 13px 150px 13px 13px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px 80px 16px 24px;
    /* margin-left: 5px; */
    /* Shift right to avoid overlap with pin top edge */
    transition:
        border-radius 0.4s ease,
        padding 0.4s ease,
        gap 0.4s ease,
        border-width 0.4s ease,
        margin 0.4s ease;
}

/* ==================== COLLAPSED STATE STYLES ==================== */
/* Collapsed cards are pill-shaped with only title visible */
/* Size varies by position - cards higher up the road are smaller */

.roadmap-card.collapsed .roadmap-card-content {
    gap: 0;
    margin-left: 0;
    /* Remove margin when collapsed - pin is smaller */
}

/* Card 1 collapsed - smallest (top of road) */
.roadmap-card[data-stage='1'].collapsed .roadmap-card-content {
    border-width: 0.447px;
    border-radius: 5.8px;
    padding: 7px 11px;
}

/* Card 2 collapsed */
.roadmap-card[data-stage='2'].collapsed .roadmap-card-content {
    border-width: 0.555px;
    border-radius: 7.2px;
    padding: 9px 13px;
}

/* Card 3 collapsed */
.roadmap-card[data-stage='3'].collapsed .roadmap-card-content {
    border-width: 0.722px;
    border-radius: 9.4px;
    padding: 12px 17px;
}

/* Card 4 collapsed */
.roadmap-card[data-stage='4'].collapsed .roadmap-card-content {
    border-width: 0.844px;
    border-radius: 11px;
    padding: 13.5px 20px;
}

/* Card 5 collapsed */
.roadmap-card[data-stage='5'].collapsed .roadmap-card-content {
    border-width: 0.844px;
    border-radius: 11px;
    padding: 13.5px 20px;
}

/* ==================== TITLE STYLES ==================== */
.roadmap-card-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    line-height: normal;
    margin: 0;
    transition:
        font-size 0.4s ease,
        color 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    word-wrap: break-word;
}

/* Expanded title */
.roadmap-card:not(.collapsed) .roadmap-card-title {
    font-size: 28px;
    color: #005b68;
    text-wrap: wrap;
    white-space: normal;
}

/* Collapsed title - constrain width and add ellipsis */
.roadmap-card.collapsed .roadmap-card-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed titles - size varies by card position */
/* Smaller cards higher up the road have smaller text */

.roadmap-card[data-stage='1'].collapsed .roadmap-card-title {
    font-size: 12px;
    color: #ed6a59;
    line-height: 14.7px;
}

.roadmap-card[data-stage='2'].collapsed .roadmap-card-title {
    font-size: 16px;
    color: #ed6a59;
    line-height: 18.3px;
}

.roadmap-card[data-stage='3'].collapsed .roadmap-card-title {
    font-size: 20px;
    color: #ed6a59;
    line-height: 23.8px;
}

.roadmap-card[data-stage='4'].collapsed .roadmap-card-title {
    font-size: 24px;
    color: #ed6a59;
    line-height: 27.8px;
}

.roadmap-card[data-stage='5'].collapsed .roadmap-card-title {
    font-size: 26px;
    color: #ed6a59;
    line-height: 27.8px;
}

/* ==================== LIST STYLES ==================== */
.roadmap-card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: #403936;
    max-height: 200px;
    overflow: hidden;
    transition:
        max-height 0.4s ease,
        opacity 0.3s ease,
        margin 0.4s ease;
}

/* Hide list when collapsed */
.roadmap-card.collapsed .roadmap-card-list {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.roadmap-card-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 16px;
}

.roadmap-card-list li:before {
    content: '•';
    position: absolute;
    left: 5px;
    color: #005b68;
}

/* ==================== CTA BUTTON ==================== */
.roadmap-cta-button {
    position: absolute;
    top: 565px;
    right: 0;
    z-index: 10;
}

.lifestage-text-cta {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Roadmap button now uses centralized button component (type: teal-primary) */

/* ==================== LARGE DESKTOP (1200px - 1440px) ==================== */
@media (max-width: 1440px) and (min-width: 1200px) {
    /* Road image uses object-fit: cover - no width adjustments needed */
}

/* ==================== MEDIUM DESKTOP (1024px - 1200px) ==================== */
@media (max-width: 1200px) and (min-width: 1025px) {
    .roadmap-path-image {
        top: -100px;
        height: 767px;
    }

    .roadmap-cta-button {
        right: 50px;
    }
}

/* ==================== TABLET STYLES (1001px - 1024px) ==================== */
@media (max-width: 1024px) and (min-width: 1001px) {
    .lifestage-text-section {
        padding: 60px 0 0;
        min-height: 400px;
    }

    .lifestage-text-bg-image {
        bottom: 0;
        height: 100%;
        max-height: 100%;
    }

    .lifestage-text-container {
        padding: 0 32px 110px;
    }

    .lifestage-text-title {
        font-size: 28px;
    }

    .lifestage-text-description {
        font-size: 15px;
    }

    .lifestage-roadmap-section {
        padding: 0;
    }

    .lifestage-roadmap-wrapper {
        position: relative;
        width: 100%;
        max-width: 100%;
        height: 500px;
        margin: 0 auto;
        overflow: visible;
        /* Prevent horizontal scroll */
        z-index: 2;
    }

    .roadmap-path-image {
        display: block;
        width: 100%;
        height: 650px;
        /* Fixed height for tablet */
        object-fit: cover;
        object-position: center top;
        top: -70px;
        left: 50%;
        transform: translateX(-50%);
    }

    .roadmap-cards-container {
        position: relative;
        width: 100%;
        height: 100%;
        z-index: 1;
        overflow: visible;
    }

    .roadmap-card {
        position: absolute;
        /* max-width: 400px; */
    }

    .roadmap-card.collapsed .roadmap-card-content {
        padding: 12px 16px;
        gap: 8px;
    }

    .roadmap-card.collapsed .roadmap-card-title {
        font-size: 14px;
    }

    .roadmap-card:not(.collapsed) .roadmap-card-content {
        padding: 20px;
        padding-right: 83px;
        gap: 12px;
    }

    .roadmap-card:not(.collapsed) .roadmap-card-title {
        font-size: 18px;
    }

    .roadmap-card-list {
        grid-template-columns: 1fr;
        font-size: 13px;
    }

    .roadmap-pin {
        display: block;
        width: 40px;
        height: 180px;
        left: -20px;
        /* Pin center aligned with card left edge */
        top: 50%;
        /* Pin TOP at card vertical center */
    }

    .roadmap-card.collapsed .roadmap-pin {
        width: 24px;
        height: 110px;
        left: -12px;
        /* Pin center aligned with card left edge */
        top: 50%;
        /* Pin TOP at card vertical center */
    }

    .roadmap-cta-button {
        position: absolute;
        top: 420px;
        right: 50px;
    }
}

/* ==================== MOBILE STYLES (below 900px) ==================== */
@media (max-width: 1000px) {
    .lifestage-roadmap-section {
        overflow: visible;
        /* Allow natural content flow */
    }

    .lifestage-text-section {
        padding: 40px 0 0;
        min-height: 300px;
    }

    .lifestage-text-cta {
        flex-direction: column;
        gap: 12px;
    }

    .lifestage-text-bg-image {
        bottom: 0;
        height: 100%;
        max-height: 100%;
    }

    .lifestage-text-bg-image {
        object-position: bottom center;
    }

    .lifestage-text-container {
        padding: 0 16px 110px;
    }

    .lifestage-text-title {
        font-size: 24px;
        text-align: left;
        width: 100%;
        max-width: none;
    }

    .lifestage-text-description {
        font-size: 16px;
        text-align: left;
    }

    .lifestage-roadmap-section {
        padding: 0;
    }

    .lifestage-roadmap-wrapper {
        position: relative;
        width: 100%;
        height: 620px;
        margin: 0 auto;
        overflow: visible !important;
        overflow-x: hidden;
        overflow-y: visible !important;
        z-index: 2;
    }

    .roadmap-path-picture {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .roadmap-path-image {
        display: block;
        /* Mobile image is sized to fit the wrapper */
        min-width: auto;
        max-width: none;
        width: 100%;
        height: 100%;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    .roadmap-cards-container {
        position: relative;
        width: 100%;
        height: 100%;
        z-index: 1;
        overflow: visible;
    }

    .roadmap-card {
        position: absolute;
        /* max-width: 280px; */
    }

    /* Mobile: Only first card visible initially, others hidden until JS animates them */
    .roadmap-card[data-stage='1'] {
        opacity: 1;
    }

    .roadmap-card[data-stage='2'],
    .roadmap-card[data-stage='3'],
    .roadmap-card[data-stage='4'],
    .roadmap-card[data-stage='5'],
    .roadmap-card[data-stage='6'] {
        opacity: 0;
    }

    .roadmap-card.collapsed .roadmap-card-content {
        padding: 8px 12px;
        gap: 4px;
        margin-left: 18px;
    }

    .roadmap-card.collapsed .roadmap-card-title {
        font-size: 11px;
        text-wrap: wrap;
    }

    .roadmap-card:not(.collapsed) .roadmap-card-content {
        padding: 16px;
        padding-right: 83px;
        gap: 10px;
    }

    .roadmap-card:not(.collapsed) .roadmap-card-title {
        font-size: 16px;
    }

    .roadmap-card-list {
        grid-template-columns: 1fr;
        font-size: 12px;
    }

    /* Mobile pins: horizontal lines extending LEFT from card to road */
    .roadmap-pin {
        display: block;
        width: 30px;
        height: 130px;
        left: -30px;
        top: 50%;
        /* Pin TOP at card vertical center */
        background-position: right center !important;
        /* Pin icon at right edge (card end), stem extends left to road */
    }

    .roadmap-card.collapsed .roadmap-pin {
        width: 18px;
        height: 80px;
        left: -18px;
        top: 50%;
        /* Pin TOP at card vertical center */
        background-position: right center !important;
    }

    .roadmap-cta-button {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        right: auto;
    }

    /* Roadmap button uses centralized component - responsive styles in button.css */
}

/* ==================== VERY NARROW MOBILE (below 480px) ==================== */
@media (max-width: 480px) {
    .roadmap-card:not(.collapsed) .roadmap-card-content {
        padding: 14px;
        padding-right: 85px;
    }

    .roadmap-card:not(.collapsed) .roadmap-card-title {
        font-size: 14px;
    }

    .roadmap-card-list {
        font-size: 11px;
    }

    .roadmap-card-list li {
        margin-bottom: 12px;
    }
}
