.chapter-title {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: calc(var(--header-height) + 48px) 24px 48px;
    color: #fff;
    background: #2a2b5f;
}

.chapter-title__content {
    width: min(760px, calc(100% - 48px));
    margin-inline: auto;
    text-align: left;
}

.chapter-title__heading {
    display: inline-flex;
    align-items: center;
    gap: 18px;
}

.chapter-title__mark {
    width: 67px;
    height: 66px;
}

.chapter-title h1 {
    margin: 0;
    color: var(--mint);
    font-family: var(--font-main);
    font-size: 48px;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
}

.scroll-scene {
    position: relative;
    height: calc(
        (var(--scene-steps) + 1) * var(--scene-scroll-unit)
        + var(--scene-hold-height, 0px)
        - var(--scene-start-trim-height, 0px)
    );
}

.sticky-stage {
    position: sticky;
    top: var(--header-height);
    min-height: calc(100svh - var(--header-height));
    display: grid;
    place-items: center;
    padding: clamp(24px, 4vw, 64px);
    overflow: hidden;
    background: var(--background);
}

[data-enter-step] {
    opacity: 0;
    transform: translateY(70px) scale(0.94);
    transition: opacity 520ms var(--motion-ease), transform 620ms var(--motion-ease);
}

[data-enter-step].is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

[data-scroll-enter] {
    --enter-y: 110svh;
    opacity: 1;
    transform: translateY(var(--enter-y));
    will-change: transform;
}

[data-scroll-enter][data-enter-fade] {
    opacity: var(--enter-opacity, 0);
    will-change: opacity, transform;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 28px);
}

.device-grid--large {
    width: min(947px, calc(100vw - 64px));
    height: auto;
    aspect-ratio: 947 / 609;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    column-gap: 54px;
    row-gap: 51px;
}

.device-grid--large .device-card {
    min-width: 0;
    min-height: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.device-grid--large .device-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.device-card {
    position: relative;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 7px 25px rgb(42 40 95 / 0.06);
}

.device-card img {
    width: 100%;
    height: auto;
    border-radius: inherit;
}

.device-reveal .sticky-stage {
    padding: 24px;
}
.device-reveal__content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 28px;
    width: min(947px, 100%);
    height: min(760px, calc(100svh - var(--header-height) - 48px));
}
.device-reveal__lead {
    width: min(798px, 100%);
    justify-self: center;
}
.device-reveal__lead p {
    margin: 0;
    color: #000;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
}

.device-reveal .device-grid--large {
    width: 100%;
    height: 100%;
    max-height: 609px;
    aspect-ratio: auto;
}

.challenge-stage {
    align-items: center;
}

.challenge-content {
    /* Negative values move the Slide 2 paragraph higher. */
    --challenge-copy-offset-y: -24px;
    width: min(996px, calc(100% - 48px));
    display: grid;
    grid-template-columns: 465px minmax(0, 465px);
    align-items: center;
    gap: 66px;
}

.challenge-visual {
    position: relative;
    width: 465px;
    height: 330px;
    margin: 0;
}

.monitor-screen-window {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1;
    width: 435px;
    height: 224px;
    overflow: hidden;
    border-radius: 5px;
    background: #111;
}

.monitor-screen-image {
    /* Fallback before JavaScript reads the data-zoom attributes in index.html. */
    --scroll-zoom: 4;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 434px;
    max-width: none;
    height: 244px;
    object-fit: cover;
    transform: translate(-50%, -50%) scale(var(--scroll-zoom));
    transform-origin: center;
    will-change: transform;
}

.monitor-frame-image {
    position: relative;
    z-index: 2;
    width: 465px;
    height: 330px;
    pointer-events: none;
}

.challenge-copy {
    max-width: 465px;
    transform: translateY(var(--challenge-copy-offset-y));
}

.challenge-copy p {
    margin: 0;
    color: #373737;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
}

.map-stage {
    width: 100%;
    padding: clamp(18px, 3vw, 42px);
}

.map-layout {
    position: relative;
    width: min(946px, calc(100vw - 48px));
    height: auto;
    aspect-ratio: 946 / 709;
}

.map-copy {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: min(350px, 37%);
}

.map-copy p {
    margin: 0;
    color: #373737;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
}

.map-visual {
    position: absolute;
    top: 0;
    right: 0;
    width: 777px;
    height: 706px;
    margin: 0;
}

.map-layer {
    position: absolute;
    top: 0;
    right: 0;
    width: 539px;
    max-width: none;
    height: auto;
    opacity: 0;
    transition: opacity 500ms var(--motion-ease);
}

.map-layer.is-active {
    opacity: 1;
}

.device-detail-stage {
    --device-detail-height: 583px;
    width: min(1040px, 100%);
    grid-template-columns: 380px minmax(0, 560px);
    gap: clamp(48px, 7vw, 100px);
    margin-inline: auto;
    align-content: center;
}

.device-detail-grid {
    display: grid;
    width: 380px;
    height: 583px;
    grid-template-columns: repeat(2, 173px);
    grid-template-rows: repeat(3, 173px);
    column-gap: 34px;
    row-gap: 32px;
}

.device-card--small {
    width: 173px;
    height: 173px;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
    background: #fff;
    box-shadow: none;
    transition: box-shadow 260ms var(--motion-ease), transform 260ms var(--motion-ease);
}

.device-card--small::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 3px solid #95efce;
    border-radius: inherit;
    background: rgb(149 239 206 / 0.08);
    box-shadow: 0 7px 14px rgb(42 43 95 / 0.14);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms var(--motion-ease);
}

.device-card--small[data-device="ecg"] {
    border-radius: 60px 20px 20px;
}

.device-card--small[data-device="display"] {
    border-radius: 20px 20px 60px;
}

.device-card--small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.device-card--small.is-active {
    box-shadow: 0 0 0 4px rgb(149 239 206 / 0.2);
    transform: translateY(-3px);
}

.device-card--small.is-active::after {
    opacity: 1;
}

.device-detail-copy {
    position: relative;
    height: auto;
    min-height: var(--device-detail-height);
    align-self: start;
}

.device-detail-grid { align-self: start; }

.device-detail-intro {
    position: static;
    margin: 0 0 30px;
    color: #373737;
    font-family: var(--font-main);
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
}

.device-facts {
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.device-facts li {
    position: relative;
    margin: 0;
    padding-left: 17px;
    color: #373737;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
    transform: translateY(45svh);
}

.device-facts li::before {
    content: "•";
    position: absolute;
    top: 0;
    left: 0;
    color: #373737;
    font-size: 20px;
    line-height: 30px;
}

.device-facts strong {
    color: #373737;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 700;
    line-height: 30px;
    letter-spacing: 0;
}

.intro-summary {
    min-height: calc(100svh - var(--header-height));
    display: grid;
    place-items: center;
    padding: clamp(72px, 10vw, 150px) 24px;
}

.chapter-motion-ready .intro-summary-hold {
    height: calc(var(--summary-height, 100svh) + var(--summary-hold, 100svh));
}
.chapter-motion-ready .intro-summary-hold .intro-summary {
    position: sticky;
    top: min(var(--header-height), calc(100svh - var(--summary-height, 0px)));
}

.intro-summary__content {
    width: min(798px, 100%);
}

.intro-summary__lead {
    margin-bottom: 21px;
    color: #373737;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 30px;
    letter-spacing: 0;
}

.intro-summary__lead p {
    margin: 0;
}

.topic-links {
    margin: 0;
    padding-left: 27px;
    color: #2a2b5f;
    font-family: var(--font-condensed);
    font-size: 20px;
    font-stretch: normal;
    font-style: normal;
    font-weight: 400;
    line-height: 60px;
    letter-spacing: 0;
}

.topic-links a {
    color: #2a2b5f;
    text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-thickness: 1px;
    text-underline-offset: 0;
    text-decoration-skip-ink: auto;
    transition: color 180ms var(--motion-ease);
}

.topic-links a:hover,
.topic-links a:focus-visible {
    color: #29d092;
}

.chapter-placeholder {
    min-height: 72svh;
    display: grid;
    align-items: center;
    padding: clamp(90px, 12vw, 160px) 0;
    border-top: 1px solid var(--border);
    background: #f2f2f2;
}

.chapter-placeholder--alt {
    background: #e3efec;
}

.chapter-placeholder--final {
    min-height: 88svh;
    color: #fff;
    background: var(--navy);
}

.chapter-placeholder--final h2,
.chapter-placeholder--final .eyebrow {
    color: var(--mint);
}

.placeholder-tag {
    display: inline-flex;
    margin-top: 18px;
    padding: 7px 11px;
    border: 1px dashed currentColor;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chapter-placeholder--final .placeholder-tag {
    color: rgb(255 255 255 / 0.68);
}

html:not(.js) [data-enter-step],
html:not(.js) [data-scroll-enter] {
    opacity: 1;
    transform: none;
}

@media (max-width: 900px) {
    .device-grid--large {
        column-gap: clamp(18px, 5.7vw, 54px);
        row-gap: clamp(18px, 5.4vw, 51px);
    }

    .device-detail-stage {
        --device-detail-height: 521.63px;
        width: min(820px, 100%);
        grid-template-columns: 340px 1fr;
        gap: 32px;
    }

    .device-detail-grid {
        width: 340px;
        height: auto;
        aspect-ratio: 380 / 583;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
        column-gap: 30px;
        row-gap: 28px;
    }

    .device-card--small {
        width: auto;
        height: auto;
    }
}

@media (max-width: 700px) {
    .chapter-title__heading {
        gap: 12px;
    }

    .chapter-title__mark {
        width: 51px;
        height: auto;
    }

    .chapter-title h1 {
        font-size: 36px;
    }

    .sticky-stage {
        padding: 24px 18px;
    }

    .device-grid--large {
        width: min(430px, 92vw);
        height: auto;
        aspect-ratio: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, auto);
        gap: 10px;
    }

    .device-reveal .sticky-stage {
        padding: 24px 18px;
    }
    .device-reveal__content {
        gap: 20px;
        max-width: 430px;
    }
    .device-reveal .device-grid--large {
        grid-template-rows: repeat(3, minmax(0, 1fr));
    }
    .device-reveal__lead p {
        font-size: 17px;
        line-height: 25px;
    }

    .challenge-content,
    .device-detail-stage {
        grid-template-columns: 1fr;
    }

    .challenge-content {
        width: min(480px, 100%);
        gap: 28px;
    }

    .challenge-visual {
        width: min(465px, 88vw);
        height: auto;
        aspect-ratio: 465 / 330;
        margin-inline: auto;
    }

    .monitor-screen-window {
        top: 4.545%;
        left: 3.226%;
        width: 93.548%;
        height: 67.879%;
    }

    .monitor-screen-image {
        width: 102.151%;
        height: 109.091%;
    }

    .monitor-frame-image {
        width: 100%;
        height: 100%;
    }

    .challenge-copy {
        max-width: 465px;
        margin-inline: auto;
        transform: translateY(-10px);
    }

    .challenge-copy p {
        font-size: 17px;
        line-height: 25px;
    }

    .device-facts li {
        font-size: 17px;
        line-height: 25px;
    }

    .device-facts li::before,
    .device-facts strong {
        font-size: 17px;
        line-height: 25px;
    }

    .map-stage {
        padding: 24px 18px;
    }

    .map-layout {
        width: min(540px, 100%);
        height: auto;
        aspect-ratio: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 18px;
    }

    .map-copy {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
    }

    .map-copy p {
        font-size: 17px;
        line-height: 25px;
    }

    .map-visual {
        position: relative;
        top: auto;
        right: auto;
        width: min(539px, 76vw);
        height: auto;
        aspect-ratio: 539 / 699;
    }

    .map-layer {
        width: 100%;
    }

    .device-detail-stage {
        align-content: center;
        gap: 24px;
    }

    .device-detail-copy {
        height: auto;
        min-height: 0;
        align-self: start;
        width: 100%;
    }

    .device-detail-intro {
        margin-bottom: 24px;
        font-size: 17px;
        line-height: 25px;
    }

    .device-facts {
        gap: 7px;
    }

    .device-detail-grid {
        width: min(380px, 88vw);
        height: auto;
        aspect-ratio: 380 / 583;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(3, minmax(0, 1fr));
        column-gap: clamp(16px, 7.9vw, 34px);
        row-gap: clamp(14px, 7.4vw, 32px);
        margin-inline: auto;
    }

    .intro-summary {
        padding-inline: 20px;
    }

    .intro-summary__lead,
    .topic-links {
        font-size: 17px;
    }

    .intro-summary__lead {
        line-height: 25px;
    }

    .topic-links {
        padding-left: 22px;
        line-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chapter-motion-ready .intro-summary-hold { height: auto; }
    .chapter-motion-ready .intro-summary-hold .intro-summary { position: relative; top: auto; }
    .scroll-scene {
        height: auto;
    }

    .sticky-stage {
        position: relative;
        top: auto;
        min-height: 100svh;
    }

    [data-enter-step],
    [data-scroll-enter] {
        opacity: 1;
        transform: none;
    }
    .device-reveal__content { height: auto; }
    .device-reveal .device-grid--large { height: auto; }
}

/* Short landscape screens use normal scrolling so the paragraph stays readable. */
@media (max-height: 560px) {
    .device-reveal { height: auto; }
    .device-reveal .sticky-stage { position: relative; top: auto; }
    .device-reveal__content { height: auto; }
    .device-reveal .device-grid--large { height: auto; }
    .device-reveal [data-scroll-enter] { transform: none; }
}
