/* How Investormap Works — panel steps with Back / Next navigation */

/* Sticky pin is no longer used; keep main from clipping tall mobile panels */
body:has(#how-investormap-works) main {
    overflow: visible;
}

#how-investormap-works.how-works {
    --hw-dawn: #8fd0dc;
    --hw-dawn-deep: #1f6f8b;
    --hw-dawn-sky: #2a9aad;
    --hw-day: #2a9aad;
    --hw-day-deep: #145168;
    --hw-day-warm: #e2eef2;
    --hw-dusk: #163247;
    --hw-dusk-deep: #0f2c3e;
    --hw-dusk-glow: #145168;
    --hw-ink: #163247;
    --hw-paper: rgba(247, 250, 251, 0.94);
    --hw-paper-edge: rgba(255, 255, 255, 0.55);
    --hw-section-accent: var(--hw-dawn-deep);
    --hw-section-background: var(--hw-dawn-deep);

    display: block;
    grid-column: 1 / -1;
    background: #1c1814;
    padding: 0;
    color: #f3ebe3;
    height: auto;
    max-height: none;
    overflow: visible;
}

#how-investormap-works.how-works[data-section="Assess"] {
    --hw-section-accent: var(--hw-dawn-deep);
    --hw-section-background: var(--hw-dawn-deep);
}
#how-investormap-works.how-works[data-section="Match & Approach"] {
    --hw-section-accent: var(--hw-day);
    --hw-section-background: var(--hw-day);
}
#how-investormap-works.how-works[data-section="Prepare & Pitch"] {
    --hw-section-accent: var(--hw-dusk-glow);
    --hw-section-background: var(--hw-dusk-glow);
}

/* —— Intro (stays pinned with sticky viewport) —— */
.how-works-intro {
    grid-column: 1 / -1;
    grid-row: 1;
    z-index: 2;
    max-width: none;
    width: 100%;
    min-width: 0;
    margin: 0;
    /* 4.2rem clears the sticky InvestorMap bar, which is shifted down over this block */
    padding: calc(1.35rem + 4.2rem) 1.5rem 2rem 4.5rem;
    text-align: left;
    position: relative;
    background:
        linear-gradient(
            90deg,
            rgba(8, 10, 14, 0.82) 0%,
            rgba(8, 10, 14, 0.55) 42%,
            rgba(8, 10, 14, 0.15) 72%,
            transparent 100%
        ),
        linear-gradient(
            180deg,
            rgba(8, 10, 14, 0.88) 0%,
            rgba(8, 10, 14, 0.62) 55%,
            rgba(8, 10, 14, 0.2) 85%,
            transparent 100%
        );
}

.how-works-eyebrow {
    margin: 0 0 0.4rem;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--hw-section-accent) 75%, #fff);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}

#how-investormap-works #step-title {
    display: block;
    position: relative;
    max-width: 40rem;
    margin: 0;
    width: 100%;
    z-index: 1;
}

#how-investormap-works #step-title::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: -0.65rem -1.5rem -0.9rem -1rem;
    border-radius: 18px;
    background: radial-gradient(
        ellipse 85% 90% at 18% 40%,
        rgba(0, 0, 0, 0.55) 0%,
        rgba(0, 0, 0, 0.28) 45%,
        transparent 72%
    );
    pointer-events: none;
}

#how-investormap-works #step-title h1,
#how-investormap-works #step-title h2 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 400;
    line-height: 1.3;
    color: #fff;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.85),
        0 2px 18px rgba(0, 0, 0, 0.7);
}

#how-investormap-works #step-title h1 .futuremap,
#how-investormap-works #step-title h2 .futuremap {
    color: #fff;
}

#how-investormap-works #step-title h3 {
    margin: 0;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.9),
        0 2px 16px rgba(0, 0, 0, 0.75);
}

/* —— Viewport shell (no scroll scrub) —— */
.how-works-scroll {
    width: 100%;
}

.how-works-track {
    /* JS sets --hw-header-offset from #compare-header */
    --hw-header-offset: 80px;
    position: relative;
}

.how-works-sticky {
    position: relative;
    /* min-height fills the viewport; height grows with panel copy so nothing clips */
    min-height: calc(100dvh - var(--hw-header-offset));
    height: auto;
    width: 100%;
    overflow: hidden;
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    grid-template-rows: auto 1fr auto;
    align-items: stretch;
}

/* —— Backgrounds (dawn / day / dusk town renders) —— */
.how-works-bgs {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.how-works-bg {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.55s ease;
    background-size: cover;
    background-position: center;
}

.how-works-bg.is-active {
    opacity: 1;
}

.how-works-bg[data-theme="dawn"] {
    background-color: #4a5a68;
    background-image:
        linear-gradient(160deg, rgba(20, 24, 28, 0.2) 0%, rgba(20, 24, 28, 0.35) 100%),
        url(../img/Town_Render_001-DAWN.jpg);
}

.how-works-bg[data-theme="day"] {
    background-color: #6a9fd4;
    background-image:
        linear-gradient(160deg, rgba(20, 32, 48, 0.15) 0%, rgba(20, 32, 48, 0.3) 100%),
        url(../img/Town_Render_001-DAY.jpg);
}

.how-works-bg[data-theme="dusk"] {
    background-color: #5a3a6a;
    background-image:
        linear-gradient(160deg, rgba(20, 14, 32, 0.2) 0%, rgba(20, 14, 32, 0.38) 100%),
        url(../img/Town_Render_001-DUSK.jpg);
}

.how-works-bg-label {
    display: none;
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(0, 0, 0, 0.35);
    border: 1px dashed rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    font-family: var(--font);
}

/* —— Dot nav (desktop) —— */
.how-works-dots {
    grid-column: 1;
    grid-row: 2 / -1;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.55rem;
    padding: 1rem 0;
    position: relative;
}

.how-works-dot {
    appearance: none;
    border: 0;
    padding: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.how-works-dot[data-section="Assess"] {
    background: color-mix(in srgb, var(--hw-dawn) 55%, transparent);
}
.how-works-dot[data-section="Match & Approach"] {
    background: color-mix(in srgb, var(--hw-day) 55%, transparent);
}
.how-works-dot[data-section="Prepare & Pitch"] {
    background: color-mix(in srgb, var(--hw-dusk) 55%, transparent);
}

.how-works-dot.is-active {
    transform: scale(1.45);
    background: var(--hw-section-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hw-section-accent) 35%, transparent);
}

.how-works-dot:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.how-works-dot[aria-current="true"]::after {
    content: attr(data-part);
    position: absolute;
    left: 1.35rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    pointer-events: none;
}

/* —— Stage card: chrome + step panel —— */
.how-works-stage {
    grid-column: 2;
    grid-row: 2;
    z-index: 2;
    align-self: center;
    width: min(36rem, calc(100% - 2.5rem));
    margin: 0 2rem 0 0.5rem;
    padding: 2rem 2.25rem 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    background: color-mix(in srgb, var(--hw-section-accent) 28%, rgba(16, 18, 22, 0.55));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* box-shadow (not filter) — filter drop-shadow expands scrollable overflow and causes x-scroll */
    box-shadow: 0 0 100px 40px rgba(0, 0, 0, 0.85);
    transition: border-color 0.45s ease, background 0.45s ease;
}

/* —— Chrome: section label + part index —— */
.how-works-chrome {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0;
    pointer-events: none;
}

.how-works-section-label {
    margin: 0;
    font-family: "Fraunces", "Roboto Slab", Georgia, serif;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.how-works-part-index {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.55);
    font-variant-numeric: tabular-nums;
}

.how-works-part-index span {
    color: #fff;
    font-size: 1rem;
}

/* —— Panel content —— */
.how-works-panel {
    width: 100%;
    margin: 0;
    padding: 1.75rem 1.85rem 1.85rem;
    background: var(--hw-paper);
    color: var(--hw-ink);
    border-radius: 2px;
    border: 1px solid var(--hw-paper-edge);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.how-works-panel-title {
    margin: 0 0 1rem;
    font-family: "Fraunces", "Roboto Slab", Georgia, serif;
    font-size: clamp(1.25rem, 2.4vw, 1.55rem);
    font-weight: 550;
    line-height: 1.2;
    color: var(--hw-ink);
    transition: color 0.45s ease;
}

.how-works-panel-body p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #3d5263;
    font-weight: 300;
}

.how-works-panel-body p + p {
    margin-top: 0.85rem;
}

/* —— Panel Back / Next —— */
.how-works-panel-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.35rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(26, 26, 28, 0.12);
}

.how-works-nav-link {
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--hw-section-accent);
    transition: color 0.2s ease, opacity 0.2s ease, background 0.45s ease, border-color 0.45s ease;
}

.how-works-nav-link:hover {
    color: var(--hw-ink);
}

.how-works-nav-link[data-dir="next"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.15rem;
    border-radius: 0;
    background: #1f6f8b;
    color: #fff;
    border: 1px solid var(--hw-section-background);
}

.how-works-nav-link[data-dir="next"]:hover {
    color: var(--hw-paper);
    filter: brightness(1.08);
}

.how-works-nav-link.is-disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
}

.how-works-nav-link:focus-visible {
    outline: 2px solid var(--hw-section-accent);
    outline-offset: 3px;
}

/* —— Mobile progress (replaces dots) —— */
.how-works-mobile-progress {
    display: none;
    grid-column: 1 / -1;
    grid-row: 3;
    z-index: 2;
    padding: 0 1.25rem 1.35rem;
}

.how-works-mobile-bar {
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.how-works-mobile-fill {
    height: 100%;
    width: 0%;
    background: var(--hw-section-accent);
    border-radius: inherit;
}

.how-works-mobile-meta {
    margin: 0.55rem 0 0;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

/* —— Mobile —— */
@media screen and (max-width: 900px) {
    #how-investormap-works.how-works,
    #how-investormap-works .how-works-scroll,
    #how-investormap-works .how-works-track {
        height: auto;
        max-height: none;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
    }

    .how-works-intro {
        padding: calc(0.75rem + 4.2rem) 1rem 1rem;
        max-width: 100%;
    }

    #how-investormap-works #step-title h1,
    #how-investormap-works #step-title h2 {
        font-size: 1.05rem;
    }

    #how-investormap-works #step-title h3 {
        font-size: 0.75rem;
    }

    #how-investormap-works #step-title::before {
        inset: -0.4rem -0.75rem -0.65rem -0.5rem;
    }

    #how-investormap-works .how-works-sticky {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        grid-template-rows: none;
        /* Natural document height — do not lock to the viewport */
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        overflow: visible !important;
        padding-bottom: 1.25rem;
    }

    #how-investormap-works #step-title,
    .how-works-stage,
    .how-works-panel,
    .how-works-panel-body {
        min-width: 0;
        max-width: 100%;
    }

    #how-investormap-works #step-title {
        width: auto;
    }

    #how-investormap-works #step-title h1,
    #how-investormap-works #step-title h3,
    .how-works-panel-body p {
        overflow-wrap: break-word;
    }

    .how-works-bgs {
        /* Flex item would otherwise affect flow; keep as backdrop only */
        position: absolute;
        inset: 0;
    }

    .how-works-dots {
        display: none;
    }

    .how-works-stage {
        position: relative;
        z-index: 2;
        width: auto;
        margin: 0 1rem 0.85rem;
        padding: 1.15rem 1.1rem 1.2rem;
        align-self: stretch;
        flex: 0 0 auto;
        border-radius: 2px;
        gap: 0.85rem;
        box-shadow: 0 12px 40px 8px rgba(0, 0, 0, 0.45);
    }

    .how-works-section-label {
        font-size: 1.35rem;
    }

    .how-works-panel {
        padding: 1.15rem 1.05rem 1.2rem;
        border-radius: 2px;
        overflow: visible;
    }

    .how-works-panel-title {
        font-size: 1.15rem;
    }

    .how-works-panel-body p {
        font-size: 0.88rem;
    }

    .how-works-mobile-progress {
        display: block;
        position: relative;
        z-index: 2;
        flex: 0 0 auto;
        padding: 0 1.25rem 0.25rem;
    }

    .how-works-bg-label {
        display: none;
    }
}

@media screen and (min-width: 901px) and (max-width: 1100px) {
    .how-works-stage {
        width: min(32rem, calc(100% - 2rem));
    }
}
