/**
 * Post-reg corporate logo continuity (register → welcome → flip to intent).
 * Spec: docs/planning/POST_REG_CONTINUOUS_SHELL_2026-08.md §4.8
 *
 * The field is the sunrise gradient. The hero is the Sun Road mark.
 * There is no repeating mark tile. At night the ground is Dusk.
 */

#post-reg-logo-seq {
    position: fixed;
    inset: 0;
    /* Mobile Safari: prefer dynamic/small viewport over 100% of layout viewport. */
    width: 100%;
    height: 100%;
    height: 100svh;
    height: 100dvh;
    /*
     * Over-cover the *large* viewport in every mode. iOS Safari does not
     * re-resolve dvh while the address bar animates, so a dvh-tall wallpaper
     * exposes a band of the host page along the bottom mid-collapse — on an
     * intake host that band is the patient's own AI questions. The root is
     * pointer-events:none + overflow:hidden, so painting past the visible
     * area costs nothing. Scoping this to one mode (it was choice-only) left
     * every parked/below-modal state able to gap.
     */
    min-height: 100lvh;
    z-index: 2147483005;
    pointer-events: none;
    overflow: hidden;
    background: var(--gradient-sunrise-field);
}

/*
 * Wallpaper under Add-dependent (proxy z-index 2147483000). Keeps the branded
 * field without covering the form; stage/welcome hidden until intent flip.
 */
#post-reg-logo-seq.prls--underlay {
    z-index: 2147482990;
    pointer-events: none;
}

#post-reg-logo-seq.prls--underlay .prls-stage,
#post-reg-logo-seq.prls--underlay .prls-welcome {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Hide the plain white care-transition shell while the logo scene owns the stage.
 * html.ns-prls-* class fallbacks for engines without reliable :has(). */
html:has(#post-reg-logo-seq) #care-transition-shell,
html:has(#post-reg-logo-seq) #care-transition-shell.cts-shell--visible,
html.ns-prls-present #care-transition-shell,
html.ns-prls-present #care-transition-shell.cts-shell--visible {
    opacity: 0 !important;
    pointer-events: none !important;
}

html:has(#post-reg-logo-seq).ns-care-shell-pending::before,
html.ns-prls-present.ns-care-shell-pending::before {
    opacity: 0 !important;
    /* Boot trap uses pointer-events:auto — do not block logo/welcome taps. */
    pointer-events: none !important;
}

#post-reg-logo-seq.prls--interactive {
    pointer-events: auto;
}

/*
 * Body-mounted typeaheads sit under the open-intake / post-reg wizard
 * wallpaper (~2147483005) unless boosted — same bug as address suggestions
 * looking "broken". Covers Google Places (.pac-container) and curated /
 * DPD terminology (.ta-dropdown used by past-surgery + entry components).
 */
html:has(#post-reg-logo-seq.prls--wizard) .pac-container,
html:has(#post-reg-logo-seq.prls--wizard) .ta-dropdown,
html.ns-prls-wizard .pac-container,
html.ns-prls-wizard .ta-dropdown {
    z-index: 2147483010 !important;
}

#post-reg-logo-seq .prls-stage {
    position: fixed;
    left: var(--prls-left, 50%);
    top: var(--prls-top, 50%);
    width: var(--prls-w, 12.5rem);
    height: var(--prls-h, 12.5rem);
    margin: 0;
    perspective: 1600px;
    overflow: visible;
    transition:
        left var(--prls-move-ms, 720ms) cubic-bezier(0.22, 1, 0.36, 1),
        top var(--prls-move-ms, 720ms) cubic-bezier(0.22, 1, 0.36, 1),
        width var(--prls-move-ms, 720ms) cubic-bezier(0.22, 1, 0.36, 1),
        height var(--prls-move-ms, 720ms) cubic-bezier(0.22, 1, 0.36, 1);
    /* Avoid permanent will-change layer promotion for the whole handoff lifetime. */
}

#post-reg-logo-seq .prls-card {
    position: relative;
    width: 100%;
    height: 100%;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    overflow: visible;
    transition: transform var(--prls-flip-ms, 680ms) cubic-bezier(0.4, 0.0, 0.2, 1);
}

#post-reg-logo-seq.prls--flipped .prls-card {
    transform: rotateY(180deg);
}

/* Conceal: hide back-face copy during forward flip (Safari leak) and unflip. */
#post-reg-logo-seq.prls--concealing .prls-face--back {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#post-reg-logo-seq .prls-face {
    position: absolute;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#post-reg-logo-seq .prls-face--front {
    inset: 0;
    background: transparent;
    /* Promote a compositor layer so Safari does not leak the back face. */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Back face can be larger than the logo stage; stays centered on the mark. */
#post-reg-logo-seq .prls-face--back {
    left: 50%;
    top: 50%;
    width: min(26rem, calc(100vw - 2rem));
    height: auto;
    min-height: 100%;
    -webkit-transform: translate3d(-50%, -50%, 0) rotateY(180deg);
    transform: translate3d(-50%, -50%, 0) rotateY(180deg);
    background: transparent;
    overflow: visible;
}

/*
 * Care-path picker: hug the card row (no empty side gutter). Keep the logo
 * stage size for the flip, but drop perspective once flipped so the oversized
 * back-face stays optically centered in the viewport.
 */
#post-reg-logo-seq.prls--care-paths .prls-face--back {
    width: max-content;
    max-width: min(72rem, calc(100vw - 1.5rem));
}

/* Phone: stack care-path cards; hug a single-column panel width. */
@media (max-width: 640px) {
    #post-reg-logo-seq.prls--care-paths .prls-face--back {
        width: min(24rem, calc(100vw - 1.5rem));
        max-width: calc(100vw - 1.5rem);
        /*
         * Top-anchor every phone, not just SE-class. A stacked four-card
         * column is taller than the viewport, and center-Y clips it. Phones
         * used to get this from prls--intent leaking into the care-path
         * scene; anchor it here now that mode classes are exclusive.
         */
        top: calc(0.75rem - var(--prls-top, 0px));
        -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
        transform: translate3d(-50%, 0, 0) rotateY(180deg);
    }

    #post-reg-logo-seq.prls--care-paths .prls-face--back .pro-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* Add-dependent form — top-anchor + scroll so CTAs clear Safari chrome. */
#post-reg-logo-seq.prls--proxy .prls-face--back {
    /* --prls-vv-offset-top re-anchors into the *visual* viewport: fixed
     * positioning is layout-relative, so a raised keyboard would otherwise
     * strand the face (and its pinned CTAs) above the keyboard edge. */
    top: calc(1rem + var(--prls-vv-offset-top, 0px) - var(--prls-top, 0px));
    left: calc(50vw - var(--prls-left, 0px));
    width: min(32rem, calc(100vw - 2rem));
    /* Join pattern: VV height only — no 100vh / safe-area re-subtract. */
    max-height: calc(100svh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--prls-vv-height, 100dvh) - 2rem);
    min-height: 0;
    -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
    transform: translate3d(-50%, 0, 0) rotateY(180deg);
    /* Column: the wallpaper header stacks above the form card. */
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /*
     * Focus scroll-into-view must clear the pinned Add / Skip band, or tapping
     * a field near the end of the form parks it behind the buttons. Approximates
     * the band: two 2.75rem CTAs + 0.75rem gap + 0.85rem of band padding.
     */
    scroll-padding-bottom: 7.5rem;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    /*
     * Side padding is what keeps the scroll rail off the card edge. Without
     * it the face and the card are the same width, so a classic desktop
     * scrollbar butts against the card's rounded corner and reads square.
     */
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    /* Home-indicator floor only. The face is anchored by --prls-vv-offset-top and
     * capped at --prls-vv-height, so its bottom already sits above the keyboard;
     * a keyboard inset here is dead scroll that reads as a blank band under the
     * form on short states. */
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    /* Overlay-style rail; iOS/Android already draw their own. */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--color-ink) 25%, transparent) transparent;
}

#post-reg-logo-seq.prls--proxy .prls-face--back::-webkit-scrollbar {
    width: 6px;
}

#post-reg-logo-seq.prls--proxy .prls-face--back::-webkit-scrollbar-track {
    background: transparent;
}

#post-reg-logo-seq.prls--proxy .prls-face--back::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--color-ink) 25%, transparent);
    border-radius: 999px;
}

/* Flow header rides the wallpaper, not the card — see post-reg-proxy-step.css. */
#post-reg-logo-seq.prls--proxy .prls-face--back .prp-header {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#post-reg-logo-seq.prls--proxy .prls-face--back .prp-panel,
#post-reg-logo-seq.prls--proxy .prls-face--back .pro-panel {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    /* Face is the only scroller — nested panel scroll traps CTAs. */
    max-height: none;
    overflow: visible;
    /*
     * Branded chrome, matching the post-intake choice panel. The standalone
     * page card (flat grey hairline, generic shadow) read as a transplanted
     * page pasted onto the wallpaper rather than a surface belonging to it.
     */
    background: var(--color-linen);
    border: 1px solid color-mix(in srgb, var(--color-ink) 14%, transparent);
    border-radius: var(--radius-lg, 16px);
    box-shadow:
        0 18px 48px color-mix(in srgb, var(--color-ink) 14%, transparent),
        0 0 0 1px color-mix(in srgb, var(--color-paper) 60%, transparent) inset;
    padding: var(--space-lg, 1.5rem);
    /* Safari paints back-face children through the front face mid-rotateY
     * unless the children opt into culling too. */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/*
 * Sticky CTAs on the face scroller — the form is taller than any phone, so
 * unpinned Add / Skip sit below the fold. Face already owns safe-area bottom
 * pad. Horizontal bleed so scrolled fields cannot show in the card gutters.
 */
#post-reg-logo-seq.prls--proxy .prls-face--back .prp-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-left: calc(-1 * var(--space-lg, 1.5rem));
    margin-right: calc(-1 * var(--space-lg, 1.5rem));
    padding-top: 0.5rem;
    padding-right: var(--space-lg, 1.5rem);
    padding-bottom: 0.35rem;
    padding-left: var(--space-lg, 1.5rem);
    /*
     * Opaque, not a gradient. The choice panel can fade its footer because its
     * content barely scrolls; this form is long, and a translucent top third
     * lets field text show through the pinned buttons.
     */
    background: var(--color-linen);
}

/* Fade outgoing fields above the pinned band rather than behind it. */
#post-reg-logo-seq.prls--proxy .prls-face--back .prp-actions::before {
    content: '';
    position: absolute;
    right: 0;
    bottom: 100%;
    left: 0;
    height: var(--space-md, 1rem);
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--color-linen) 100%
    );
    pointer-events: none;
}

/* No 300ms double-tap-zoom delay on the pinned CTAs. */
#post-reg-logo-seq.prls--proxy .prls-face--back .prp-btn {
    touch-action: manipulation;
}

/* SE-class fold: trim card chrome so more of the form clears the toolbar. */
@media (max-width: 360px), (max-height: 640px) {
    #post-reg-logo-seq.prls--proxy .prls-face--back {
        top: calc(0.75rem + var(--prls-vv-offset-top, 0px) - var(--prls-top, 0px));
        padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
        /* Home-indicator floor only — see the base proxy face rule. */
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    }

    #post-reg-logo-seq.prls--proxy .prls-face--back .prp-panel,
    #post-reg-logo-seq.prls--proxy .prls-face--back .pro-panel {
        padding: var(--space-md, 1.25rem) var(--space-sm, 0.75rem);
    }

    #post-reg-logo-seq.prls--proxy .prls-face--back .prp-actions {
        margin-left: calc(-1 * var(--space-sm, 0.75rem));
        margin-right: calc(-1 * var(--space-sm, 0.75rem));
        padding-right: var(--space-sm, 0.75rem);
        padding-left: var(--space-sm, 0.75rem);
        gap: var(--space-2xs, 0.25rem);
    }
}

/*
 * Demographics / medical wizard — tall scrollable panel on the flip face.
 * Face offsets are relative to the small logo stage; compensate with --prls-*
 * so translateY(-50%) does not clip the progress/header above the root.
 */
#post-reg-logo-seq.prls--wizard .prls-face--back {
    /* Same layout-vs-visual viewport compensation as prls--proxy: the wizard
     * takes typed input too, so a raised keyboard strands the face otherwise. */
    top: calc(1rem + var(--prls-vv-offset-top, 0px) - var(--prls-top, 0px));
    left: calc(50vw - var(--prls-left, 0px));
    width: min(40rem, calc(100vw - 2rem));
    /* Join pattern: VV height only — no 100vh / safe-area re-subtract. */
    max-height: calc(100svh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--prls-vv-height, 100dvh) - 2rem);
    min-height: 0;
    -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
    transform: translate3d(-50%, 0, 0) rotateY(180deg);
    align-items: stretch;
    justify-content: flex-start;
    /* The face is the scroller. A scrolling linen card paints a gutter on
       the card edge, and overflow-x:hidden there is a sticky containing
       block, so Next and the step title stay clipped. Hide the rail so it
       is not a track beside the card. */
    overflow: auto;
    scrollbar-width: none;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    /* Home-indicator floor only: the face is anchored into the visual viewport
     * and capped at its height, so a keyboard inset here is dead scroll that
     * pushes the sticky Back/Next band out of the visible band. */
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    scroll-padding-bottom: 7.5rem;
}

#post-reg-logo-seq.prls--wizard .prls-face--back::-webkit-scrollbar {
    width: 0;
    height: 0;
}

#post-reg-logo-seq.prls--wizard .prls-face--back #unifiedIntakeWizard,
#post-reg-logo-seq.prls--wizard .prls-face--back .intake-wizard-panel {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

#post-reg-logo-seq.prls--wizard .wizard-wrapper {
    animation: none;
}

/* The face scrolls. The linen card must not be a scrollport. */
#post-reg-logo-seq.prls--wizard .prls-face--back .intake-wizard-panel {
    max-height: none;
    height: auto;
    overflow: visible;
    border-radius: 20px;
}

/*
 * Card at rest, facing the viewer.
 *
 * Flattening the stage keeps an oversized back face optically centered once it
 * has landed. It is keyed to prls--flat — set at the mid-flip reveal, not at
 * rotation start — because dropping perspective while the card is still turning
 * renders the whole rotation as a squash: the logo never appears to turn away
 * and the panel reads as a pop, not a flip. At rest the panel sits at z=0, where
 * perspective is an identity projection, so dropping it there is inert.
 *
 * Both declarations were per-mode before, and that is the bug: the flatten had
 * five copies (intent / proxy / wizard / care-paths / choice) while the
 * front-face hide had exactly one, on choice. So every other mode left the
 * turned-away logo painted, and the intent card shipped with the corporate
 * lockup mirrored below it. backface-visibility: hidden on .prls-face does not
 * reliably hide a rotateY(180deg) face on Safari, so the front has to be taken
 * out explicitly — for every mode, which is why this is keyed on prls--flat
 * alone. prls--rise-pending is the one state that deliberately keeps the mark
 * visible while the choice copy is parked.
 */
#post-reg-logo-seq.prls--flat .prls-stage {
    perspective: none;
}

#post-reg-logo-seq.prls--flat:not(.prls--rise-pending) .prls-face--front {
    visibility: hidden;
    pointer-events: none;
}

/* Post-intake choice keeps an extra isolation layer (Slice 2 + §5.E Safari). */
#post-reg-logo-seq.prls--post-intake-choice.prls--flat .prls-stage {
    isolation: isolate;
}

/*
 * Re-anchor the choice face to the *live* viewport rather than the logo
 * stage's px snapshot: --prls-top / --prls-left are frozen at flip time, so
 * Safari chrome show/hide (or rotation) would leave the panel off-centre and
 * push the CTAs under the toolbar. Same compensation shape as prls--proxy:
 * centre inside the *visual* band, since the fixed face resolves against the
 * layout viewport while its max-height comes from --prls-vv-height.
 */
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back {
    top: calc(50svh - var(--prls-top, 0px));
    top: calc(50dvh - var(--prls-top, 0px));
    top: calc(
        var(--prls-vv-offset-top, 0px)
        + var(--prls-vv-height, 100dvh) / 2
        - var(--prls-top, 0px)
    );
    left: calc(50vw - var(--prls-left, 0px));
    width: min(26rem, calc(
        100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)
    ));
    /* Join pattern: VV height only — no 100vh / safe-area re-subtract. */
    max-height: calc(100svh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--prls-vv-height, 100dvh) - 2rem);
    /* Column + auto margins on the panel: centred while it fits, but the top
     * stays reachable once it overflows (align-items:center clips it away). */
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    /* Do not chain the rubber-band into the inert intake host behind the flip. */
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    /* Home-indicator floor only. The face is anchored by --prls-vv-offset-top
     * and capped at --prls-vv-height, so it already ends above the keyboard;
     * re-adding the inset is dead scroll that overflows a card which fits,
     * engaging the sticky CTA band and a scroller for no reason. iOS also
     * reports a phantom inset here (innerHeight stays large while the
     * overlay covers the page), so this fires with no keyboard at all. */
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}

#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-panel,
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pic-panel {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: auto 0;
    /* The face is the only scroller — a nested one traps the touch drag. */
    max-height: none;
    overflow-y: visible;
    /*
     * Card chrome, matching the intent modal. Without it the title, queue
     * preview and CTAs read as loose text painted straight onto the
     * wallpaper. Opaque rather than the intent panel's 0.96 so the sticky
     * .pro-actions gradient (which ends on Linen) has no seam.
     */
    background: var(--color-linen);
    border: 1px solid color-mix(in srgb, var(--color-ink) 14%, transparent);
    border-radius: var(--radius-lg, 16px);
    box-shadow:
        0 18px 48px color-mix(in srgb, var(--color-ink) 14%, transparent),
        0 0 0 1px color-mix(in srgb, var(--color-paper) 60%, transparent) inset;
    padding: var(--space-xl, 1.75rem) var(--space-lg, 1.5rem);
    text-align: center;
    /* Safari paints back-face children through the front face mid-rotateY
     * unless the children opt into culling too. */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Sticky CTAs on the face scroller — face already owns safe-area bottom pad. */
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: auto;
    padding-top: 0.5rem;
    padding-bottom: 0.35rem;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--color-linen) 32%
    );
}

/* Thumb reach on ~320px, and no 300ms double-tap-zoom delay on the CTAs. */
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-btn {
    min-height: 3rem;
    touch-action: manipulation;
}

/* Latched CTA (one activation per mount) still reads as a control, not a bug. */
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-btn[disabled] {
    opacity: 0.65;
    cursor: default;
}

/* Queue depth / ETA — subordinate to CTAs; wraps on ~320px phones. */
#post-reg-logo-seq.prls--post-intake-choice .pic-queue-preview {
    margin: 0 0 var(--space-sm, 0.75rem);
    padding: 0 var(--space-2xs, 0.25rem);
    font-size: var(--text-xs, 0.75rem);
    line-height: var(--leading-normal, 1.4);
    color: var(--color-text-muted, #696a71);
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/*
 * SE-class fold (~320×568): compact chrome so title + dual CTAs clear the
 * iOS toolbar / home indicator without a second nested scroller.
 */
@media (max-width: 360px), (max-height: 640px) {
    /* Top-anchor like proxy/wizard — drop translateY(-50%) or CTAs clip above the fold. */
    #post-reg-logo-seq.prls--post-intake-choice .prls-face--back {
        top: calc(0.75rem + var(--prls-vv-offset-top, 0px) - var(--prls-top, 0px));
        -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
        transform: translate3d(-50%, 0, 0) rotateY(180deg);
        padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
        /* Home-indicator floor only — see the base choice face rule. */
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    }

    #post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-panel,
    #post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pic-panel {
        margin: 0;
        padding: var(--space-md, 1.25rem) var(--space-sm, 0.75rem);
    }

    #post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-panel__title {
        margin-bottom: var(--space-sm, 0.75rem);
        font-size: 1.1rem;
    }

    #post-reg-logo-seq.prls--post-intake-choice .pic-queue-preview {
        margin-bottom: var(--space-2xs, 0.25rem);
    }

    #post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-actions {
        gap: var(--space-2xs, 0.25rem);
    }
}

/* Care-path picker: scroll the face (not only the panel) under notch/toolbar. */
#post-reg-logo-seq.prls--care-paths .prls-face--back {
    /*
     * Top-align the panel inside the scroller. The face inherits
     * align-items: center, and a centered flex child that outgrows its
     * scrollport overflows *both* ways — the top overflow sits before the
     * scroll origin and cannot be reached. That is why a stacked phone column
     * lost its first card entirely, and why a short desktop window clipped the
     * top of the row. The face shrink-wraps whatever fits, so this is inert
     * until the panel actually exceeds max-height.
     */
    align-items: flex-start;
    /* Join pattern: VV height only — no 100vh / safe-area re-subtract. */
    max-height: calc(100svh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--prls-vv-height, 100dvh) - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(
        0.75rem,
        env(safe-area-inset-bottom, 0px),
        var(--prls-vv-inset-bottom, 0px)
    );
    box-sizing: border-box;
}

/* SE-class: top-anchor like post-intake choice — center-Y clips tall card stacks. */
@media (max-width: 360px), (max-height: 640px) {
    #post-reg-logo-seq.prls--care-paths .prls-face--back {
        top: calc(0.75rem - var(--prls-top, 0px));
        -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
        transform: translate3d(-50%, 0, 0) rotateY(180deg);
        padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    }
}

#post-reg-logo-seq.prls--care-paths .prls-face--back .pro-panel {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    padding: var(--space-lg, 1.5rem) var(--space-md, 1.25rem);
    text-align: center;
    box-sizing: border-box;
    /* Nested scroll only as a fallback when the face cannot clip. */
    max-height: none;
    overflow: visible;
}

#post-reg-logo-seq.prls--care-paths .prls-face--back .pro-panel__title {
    margin-bottom: var(--space-md, 1.25rem);
    text-align: center;
}

/*
 * Membership two-up row fits a normal desktop window. The care-path face
 * scroller is for phone / short windows (cards stack). Overflow:auto on a
 * tall Windows desktop still paints a classic rail for a 1px leftover.
 */
@media (min-width: 641px) and (min-height: 640px) {
    #post-reg-logo-seq.prls--membership-plans .prls-face--back {
        overflow-y: visible;
        max-height: none;
    }
}

/*
 * Wallpaper under PBM after a closed-clinic path pick — sit below --z-modal
 * so the schedule modal wins while the branded field still shows through.
 * Keep above --z-overlay (300) so sticky portal chrome cannot flash white.
 *
 * Two class names, one stack, on purpose. below-modal means a modal inside
 * #main-content owns the screen, so logo-scene-host-conceal.css stands the
 * host conceal down for it. below-overlay means a *body-level* overlay owns
 * it — membership pay mounts #embeddedCheckoutModal / #membershipConfirmModal
 * as document.body children at z-index 2147483010 — so the host column never
 * needs to paint, and below-overlay is absent from that :not() list by
 * design. Parking the membership card rise through below-modal is what let
 * the Get Started column repaint and leak the Stay Ahead photo along the
 * bottom band mid-rise.
 */
#post-reg-logo-seq.prls--below-modal,
#post-reg-logo-seq.prls--below-overlay {
    z-index: 350;
    pointer-events: none;
    /* Opaque field — transparent stacking lets intake white flash mid-rise. */
    background: var(--gradient-sunrise-field);
}

/* Choice→Book/Queue rise: hide parked back-face copy (Safari compositor). */
#post-reg-logo-seq.prls--rise-pending .prls-face--back {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#post-reg-logo-seq.prls--rise-pending .prls-face--front {
    /* Keep the corporate mark visible while choice copy is parked. */
    visibility: visible;
}

#post-reg-logo-seq .prls-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 10px 28px color-mix(in srgb, var(--color-ink) 22%, transparent));
}

/*
 * Hero title sits in the Paper end of the field, above the mark. Prefer
 * svh/dvh so iOS Safari's collapsing chrome does not park the title in the
 * large-vh void. The mark stays in the light half while welcome is showing
 * (not during the intent flip).
 */
#post-reg-logo-seq .prls-welcome {
    position: fixed;
    left: 0;
    right: 0;
    top: max(8svh, env(safe-area-inset-top, 0px));
    top: max(8dvh, env(safe-area-inset-top, 0px));
    height: auto;
    width: 100%;
    margin: 0;
    padding: 0 1.25rem;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-align: center;
    /* Fully opaque the moment welcome starts. A fade-in would eat the 1.2s read. */
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

#post-reg-logo-seq.prls--welcome .prls-welcome {
    opacity: 1;
}

/* 374ms = Math.round(680 * 0.55). The line stays readable until the flip covers the mark. */
#post-reg-logo-seq.prls--flipped .prls-welcome {
    opacity: 0;
    transition: opacity 220ms ease-out 374ms;
}

#post-reg-logo-seq .prls-welcome__title {
    margin: 0;
    max-width: 22ch;
    width: 100%;
    font-family: var(--font-display);
    /* Type scale, not a vmin clamp: two lines stay above the mark. */
    font-size: var(--text-h1);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--color-ink);
    text-shadow: none;
}

/* Tokens retune --text-h1 / --text-h2 at 1024 and 640. Phones step down so
   the line clears the mark in the light half. 360 and short windows use
   the smaller step. */
@media (max-width: 1024px) {
    #post-reg-logo-seq .prls-welcome__title {
        font-size: var(--text-h1);
    }
}

@media (max-width: 768px) {
    #post-reg-logo-seq .prls-welcome__title {
        font-size: var(--text-h2);
    }
}

@media (max-width: 640px) {
    #post-reg-logo-seq .prls-welcome__title {
        font-size: var(--text-h2);
    }
}

@media (max-width: 360px), (max-height: 640px) {
    #post-reg-logo-seq.prls--welcome:not(.prls--flipped) .prls-welcome {
        align-items: flex-start;
        padding-top: 0;
    }

    #post-reg-logo-seq .prls-welcome__title {
        font-size: var(--text-h3);
        line-height: 1.15;
    }
}

#post-reg-logo-seq .prls-welcome__subtitle {
    display: none;
}

/* Welcome beat: the mark's center stays above the 50% linen stop (the light
 * half). Intent flip recenters. Join pattern: svh/dvh only — no 68vh /
 * safe-area re-subtract. Short windows drop to 48dvh so the title still clears. */
#post-reg-logo-seq.prls--welcome:not(.prls--flipped) .prls-stage {
    top: calc(36svh - (var(--prls-h, 12.5rem) / 2)) !important;
    top: calc(36dvh - (var(--prls-h, 12.5rem) / 2)) !important;
    left: calc(50% - (var(--prls-w, 12.5rem) / 2)) !important;
}

@media (max-height: 500px) {
    #post-reg-logo-seq .prls-welcome {
        top: max(4svh, env(safe-area-inset-top, 0px));
        top: max(4dvh, env(safe-area-inset-top, 0px));
    }

    #post-reg-logo-seq.prls--welcome:not(.prls--flipped) .prls-stage {
        top: calc(48svh - (var(--prls-h, 12.5rem) / 2)) !important;
        top: calc(48dvh - (var(--prls-h, 12.5rem) / 2)) !important;
    }
}

/* Intent (Arrange Care / Browse): face is the sole scroller + VV. */
#post-reg-logo-seq.prls--intent .prls-face--back {
    top: calc(1rem - var(--prls-top, 0px));
    left: calc(50vw - var(--prls-left, 0px));
    width: min(26rem, calc(100vw - 2rem));
    /* Join pattern: VV height only — no 100vh / safe-area re-subtract. */
    max-height: calc(100svh - 2rem);
    max-height: calc(100dvh - 2rem);
    max-height: calc(var(--prls-vv-height, 100dvh) - 2rem);
    min-height: 0;
    -webkit-transform: translate3d(-50%, 0, 0) rotateY(180deg);
    transform: translate3d(-50%, 0, 0) rotateY(180deg);
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(
        0.75rem,
        env(safe-area-inset-bottom, 0px),
        var(--prls-vv-inset-bottom, 0px)
    );
    box-sizing: border-box;
}

#post-reg-logo-seq.prls--intent .prls-face--back .pro-panel {
    width: 100%;
    margin: 0 auto;
    background: color-mix(in srgb, var(--color-linen) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-ink) 14%, transparent);
    border-radius: var(--radius-lg, 16px);
    box-shadow:
        0 18px 48px color-mix(in srgb, var(--color-ink) 14%, transparent),
        0 0 0 1px color-mix(in srgb, var(--color-paper) 60%, transparent) inset;
    padding: var(--space-xl, 1.75rem) var(--space-lg, 1.5rem);
    text-align: center;
    box-sizing: border-box;
    /* Face owns max-height — nested panel scroll traps CTAs. */
    max-height: none;
    overflow: visible;
}

#post-reg-logo-seq .prls-face--back .pro-panel__title {
    margin: 0 0 var(--space-lg, 1.5rem);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--color-text-primary);
}

/* Small name above the choice heading. The card is Linen on paper and after
   sunset, so this stays Ink on both grounds. Paper on Linen is about 1.1:1.
   Night selectors stay out of this day sheet. Not .pro-panel__body: the back
   face hides that class. */
#post-reg-logo-seq.prls--post-intake-choice .prls-face--back .pro-panel__for {
    margin: 0 0 var(--space-2xs, 0.35rem);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
    text-align: center;
    color: var(--color-ink);
}

#post-reg-logo-seq .prls-face--back .pro-panel__body {
    display: none;
}

#post-reg-logo-seq .prls-face--back .pro-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 0.75rem);
}

#post-reg-logo-seq .prls-face--back .pro-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* 44px iOS minimum touch target */
    min-height: 2.75rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--button-radius);
    border: 1px solid transparent;
    font-size: 0.975rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-wrap: balance;
    white-space: normal;
    cursor: pointer;
    box-sizing: border-box;
    /* Kill 300ms tap delay / accidental double-tap zoom on iOS Safari. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#post-reg-logo-seq .prls-face--back .pro-btn--primary {
    background: var(--color-primary);
    color: var(--color-text-on-primary, #fff);
}

#post-reg-logo-seq .prls-face--back .pro-btn--secondary {
    background: color-mix(in srgb, var(--color-paper) 92%, transparent);
    color: var(--color-text-primary);
    border-color: var(--color-gray-400, #d2d2d7);
}

/* Browse → dashboard: fade logo while portal content eases in. */
#post-reg-logo-seq.prls--fading {
    opacity: 0;
    transition: opacity 480ms ease-out;
    pointer-events: none;
}

html.prls-dashboard-reveal .patient-portal-content {
    animation: prls-dashboard-fade-in 520ms ease-out both;
}

@keyframes prls-dashboard-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    #post-reg-logo-seq.prls--fading,
    #post-reg-logo-seq .prls-welcome,
    #post-reg-logo-seq .prls-card,
    #post-reg-logo-seq .prls-stage {
        transition: none !important;
    }

    html.prls-dashboard-reveal .patient-portal-content {
        animation: none !important;
        opacity: 1 !important;
    }
}
