/* The /mermaid page: the intro and the embedded Mermaid app. */

@layer reset, tokens, base, layout, components, pages, utilities;

@layer pages {
    /* Fill the viewport so the iframe is the ONLY scroll region on desktop. The
       old fixed 80vh height made the page scroll AND the iframe scroll (nested
       scroll); flexing the iframe to fill the space below the intro removes the
       outer scroll when everything fits. Auto (not hidden) below still permits
       the page itself to scroll on short viewports, where the min-height further
       down keeps the iframe from collapsing toward its ~150px intrinsic height.
       Scoped to this page via :has() so other pages are untouched. */
    html:has(.mermaid-embed-frame),
    body:has(.mermaid-embed-frame) {
        overflow: auto;
    }
    body:has(.mermaid-embed-frame) main {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .mermaid-intro {
        max-width: 800px;
        margin: 0 auto var(--space-4);
        flex: 0 0 auto;
    }
    .mermaid-locations {
        margin: var(--space-2) 0 0;
        padding-left: 1.25rem;
    }
    .mermaid-embed-frame {
        flex: 1 1 auto;
        width: 100%;
        height: 80vh; /* fallback: without :has() support the flex layout above never applies */
        border: 0;
        border-radius: var(--radius-lg);
        display: block;
    }
    /* When :has() is supported, the viewport-fill flex layout owns the height.
       min-height keeps the iframe from collapsing to its ~150px intrinsic
       height on short viewports (e.g. landscape phones) where flexing to the
       remaining space below the intro would otherwise shrink it too far. */
    body:has(.mermaid-embed-frame) .mermaid-embed-frame {
        height: auto;
        min-height: 55vh;
    }
}
