/* Docs modal — the AI-guided prompt.
 *
 * NAMED FOR A MODAL THAT NO LONGER EXISTS. This file began as the styling for
 * the endpoint-examples modal, which was replaced by the Endpoint TAB on
 * 2026-09-07 (see landing-page-tabs.js). The tab's own styling lives with the
 * landing tabs; what survived here is the generic `.docs-modal-*` shell, which
 * the AI-guide modal still uses, plus `.docs-endpoint-load-error` for its
 * failure copy.
 *
 * 58 rules for the deleted modal were removed on 2026-09-09 — every selector
 * whose classes were all unreachable from index.html, the partials and the
 * landing scripts. They had been shipped to every visitor since the modal went
 * away. The filename is left alone on purpose: renaming it means touching the
 * <link> in index.html and every reference to it, and a wrong name that is
 * explained costs less than a rename that misses one.
 */

/* Endpoint examples modal (ported from /docs) */
.docs-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.72);
    /* Safari 17 and earlier read only the prefixed name (as the widget's own
       scrim does, widget-styles/modal.js). */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 9999;
    padding: 1.25rem;
}

.docs-modal-overlay[hidden] {
    display: none !important;
}

.docs-modal-dialog {
    width: min(760px, 100%);
    max-height: min(90vh, 850px);
    max-height: min(90dvh, 850px); /* the visible viewport on a phone */
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.docs-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem 0.95rem;
    border-bottom: 1px solid var(--border);
}

.docs-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-strong);
}

.docs-modal-close {
    border: none;
    background: transparent;
    color: var(--text-strong);
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 0.45rem;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.docs-modal-close:hover,
.docs-modal-close:focus-visible {
    /* --text, not a black wash: the ink flips polarity with the theme, so this
     * darkens on a light surface and LIGHTENS on a dark one. A fixed black at
     * 6% was simply invisible on all 24 dark themes. */
    background-color: color-mix(in srgb, var(--text) 8%, transparent);
    color: var(--accent-strong);
    transform: scale(1.05);
}

/* Focus split out of the shared :hover rule — see .landing-tab-button in
 * landing-tabs.css for why. This one mattered most: it is the only way out of
 * an open modal by keyboard other than Escape, and it had a 6%-alpha wash
 * standing in for an indicator. */
.docs-modal-close:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 3px;
}

.docs-modal-close:active {
    background-color: color-mix(in srgb, var(--text) 14%, transparent);
    color: var(--accent-text);
    transform: scale(0.98);
}

.docs-modal-body {
    padding: 1rem 1.25rem 1.25rem;
    overflow: auto;
}

.docs-modal-body p {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.docs-modal-note {
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.justify-text {
    text-align: justify;
}

/* In the lazy modals' mounts until their content arrives, so a slow network
   opens a dialog that says so instead of a title over nothing. Replaced
   whole on load or failure. */
.docs-modal-loading {
    margin: 1.5rem 0;
    color: var(--text-muted);
    text-align: center;
}

/* Shown in place of the example cards when their partial fails to load. */
.docs-endpoint-load-error {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
    background: var(--danger-soft);
    color: var(--danger-text);
    text-align: center;
}

/* ---------------------------------------------------------------------------
   Guided AI prompt modal (partials/ai-guide.html).

   Its own classes rather than the endpoint modal's card styling, which is what
   let that modal be deleted without touching this. Those card rules are gone as
   of 2026-09-09; this block is the only thing that still styles the prompt. */
.ai-guide-lead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ai-guide-lead .docs-modal-note {
    flex: 1 1 16rem;
    margin: 0;
}

.ai-guide-prompt {
    margin: 0;
    padding: 1rem;
    border-radius: 10px;
    background: var(--code-bg);
    color: var(--code-text);
    overflow: auto;
    font-size: 0.85rem;
    line-height: 1.55;
}

/* The guided prompt is mostly prose ("readable by you"), and it was <pre>'s
   default no-wrap: 873px of text in a 291px box on a phone, so nearly every
   line had to be scrolled sideways (on desktop, the two longest still did).
   Wrapped on screen only; Copy reads the text, not the layout, so what is
   pasted is unchanged. Scoped to the prompt itself (by id: the global
   `pre code { white-space: pre }` in auth-and-code.css outranks a class), and
   the Migrate tab reuses .ai-guide-prompt for code samples, which keep their lines. */
#ai-guide-prompt-code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   Endpoint conformance checker (#conformance-modal).

   Shares the .docs-modal-* shell above; only the form and the result rows are
   its own. Colours come from the theme tokens rather than literals so the
   contrast repair layer covers them — the `-text` variants are the only legible
   foregrounds for these hues, since the raw --success / --danger tokens are
   fills. */

.conformance-form { margin: 0 0 1rem; }

.conformance-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    color: var(--text-muted);
}

.conformance-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.conformance-input {
    flex: 1 1 22rem;
    min-width: 0;
    padding: .5rem .7rem;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-strong);
    font: inherit;
    font-size: .9rem;
}

/* Under 16px a phone zooms the page when this field takes focus and leaves it
   zoomed. Touch screens only; see .landing-matrix-chars-select in landing-tabs.css. */
@media (pointer: coarse) {
    .conformance-input {
        font-size: max(16px, 1em);
    }
}

.conformance-run {
    padding: .5rem 1.1rem;
    border: 1px solid var(--accent);
    border-radius: 7px;
    background: var(--accent);
    color: var(--text-on-accent);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}
/* --text-on-accent is repaired against --accent, not against the darker/
   lighter --accent-strong this hover state swaps in; left unpaired, 7 of 48
   themes dropped under 4.5:1 here (sky worst, 2.72). --text-on-accent-strong
   is the matching repaired pairing (theme-derive.js). */
.conformance-run:hover:not(:disabled) { background: var(--accent-strong); color: var(--text-on-accent-strong); }
.conformance-run:disabled { opacity: .55; cursor: progress; }

/* `anywhere`, not break-word: the results echo the reader's own host
   ("Auth only ever calls https://<host>/api/barebones-host"), and that one
   unbroken URL set the min-content width of this grid's column. With a
   33-character hostname every row widened to it and the modal scrolled
   sideways at 320 and 375. A word that fits is never broken. */
.conformance-results { display: grid; gap: .5rem; overflow-wrap: anywhere; }

.conformance-summary {
    padding: .6rem .8rem;
    border-radius: 8px;
    font-size: .9rem;
    border: 1px solid currentColor;
}
.conformance-summary.pass { color: var(--success-text); background: var(--success-soft); }
.conformance-summary.fail { color: var(--danger-text); background: var(--danger-soft); }

.conformance-rule {
    display: grid;
    grid-template-columns: 1.4rem 1fr;
    gap: .1rem .5rem;
    padding: .5rem .6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .88rem;
}
.conformance-mark { font-weight: 700; }
.conformance-rule.pass .conformance-mark { color: var(--success-text); }
.conformance-rule.fail .conformance-mark { color: var(--danger-text); }
.conformance-why { grid-column: 2; font-size: .84rem; color: var(--text-muted); }
.conformance-detail {
    grid-column: 2;
    margin-top: .3rem;
    font-size: .84rem;
    color: var(--danger-text);
}

/* The caveat that rides on every answer: these are all negative checks, so
   "conformant" is never the same as "my integration works". */
.conformance-caveat {
    margin-top: .4rem;
    font-size: .84rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ---- Migrate tools (lib/landing-migrate-tab.js) --------------------------- */

/* A link inside a sentence needs more than its colour to stand out (axe
   link-in-text-block). `.docs-link` is underline-free site-wide, so this is
   scoped to the tool modal's running text. */
#migrate-tool-content p .docs-link {
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.migrate-tool-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 1rem;
}

.migrate-tool-pill {
    padding: .3rem .65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}

.migrate-tool-pill[aria-current="true"] {
    border-color: var(--accent);
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
    font-weight: 600;
}

.migrate-tool-pill:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

/* On a phone the eight pills stacked five rows deep before any tool showed.
   One sideways row instead; the script keeps the current tool in view, and the
   pill cut off at the edge says there is more. */
@media (max-width: 600px) {
    .migrate-tool-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        /* Room for the focus outline, which overflow would otherwise clip. */
        padding: 3px;
        margin: -3px -3px calc(1rem - 3px);
    }

    .migrate-tool-nav::-webkit-scrollbar {
        display: none;
    }

    .migrate-tool-pill {
        flex: none;
        white-space: nowrap;
    }
}

/* Each tool ends by naming the next, in the tab's order. */
.migrate-next {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border);
}

.migrate-next-button {
    padding: .45rem .95rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--accent-text);
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
}

.migrate-next-button:hover {
    background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

.migrate-next-button:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

.migrate-form,
.migrate-fieldset {
    display: grid;
    gap: .5rem;
    margin: 0 0 1rem;
}

.migrate-fieldset {
    border: 0;
    padding: 0;
}

.migrate-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: .82rem;
    resize: vertical;
}

/* After the rule above, which out-ranks .conformance-input's touch size by
   coming later: a phone zooms on a field under 16px (see .conformance-input). */
@media (pointer: coarse) {
    .migrate-textarea {
        font-size: max(16px, 1em);
    }
}

.migrate-check {
    display: flex;
    gap: .4rem;
    align-items: baseline;
    color: var(--text);
    font-size: .9rem;
}

.migrate-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .75rem;
}

.migrate-field {
    display: grid;
    /* Not the implicit auto track: that could not go below a select's longest
       option, which at large text pushed the modal sideways (7px at 150%). */
    grid-template-columns: minmax(0, 1fr);
    gap: .3rem;
}

.migrate-block {
    margin: 0 0 1rem;
}

.migrate-block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
}

.migrate-block-label {
    color: var(--text-strong);
    font-weight: 600;
    font-size: .85rem;
}

.migrate-code {
    max-height: 22rem;
    white-space: pre;
    font-size: .78rem;
}

.migrate-message {
    color: var(--text);
    font-size: .9rem;
    line-height: 1.55;
    /* Quotes the field name from the reader's own markup, and real ones are long
       and unbroken (ASP.NET's ctl00$ContentPlaceHolder1$Login1$UserName): at 320
       a 44-character name was cut off and scrolled the tool sideways. */
    overflow-wrap: break-word;
}

.migrate-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .4rem;
}

.migrate-check-item {
    padding: .5rem .7rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .88rem;
    line-height: 1.5;
}

.migrate-check-item[data-level="stop"] { border-color: var(--danger); background: var(--danger-soft); }
.migrate-check-item[data-level="warn"] { border-color: var(--warning); background: var(--warning-soft); }
.migrate-check-item[data-level="ok"] { border-color: var(--success); background: var(--success-soft); }

.migrate-check-level {
    margin-right: .35rem;
    color: var(--text-strong);
}

/* Phones (2026-10-20): the dialog's frame -- 1.25rem of backdrop and 1.25rem of
   body padding, each side -- took 80px of a 375px screen around every code
   block a host copies. Half of the backdrop and two-thirds of the body padding
   still read as a card over the page. */
@media (max-width: 480px) {
    .docs-modal-overlay {
        padding: 0.625rem;
    }

    .docs-modal-body {
        padding: 0.85rem 0.85rem 1rem;
    }
}

/* Reduce transparency (macOS / iOS): the reader asked not to see one layer
   through another. The backdrop goes near-opaque and drops the blur; 94% rather
   than solid keeps it reading as a layer over the page. */
@media (prefers-reduced-transparency: reduce) {
    .docs-modal-overlay {
        background: rgba(15, 23, 42, 0.94);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* An open docs modal prints as a document, like an open threat (see the print
   block in security-matrix.css): fixed overlays repeat on every printed page,
   so the guided prompt printed its first screen four times and lost the rest.
   These overlays sit directly in <main>. Code wraps on paper instead of being
   cut at the right edge or at its on-screen max-height. */
@media print {
    body:has(.docs-modal-overlay:not([hidden])) > :not(.landing-scale-wrapper),
    body:has(.docs-modal-overlay:not([hidden])) .landing-scale-wrapper > :not(main),
    body:has(.docs-modal-overlay:not([hidden])) main > :not(.docs-modal-overlay:not([hidden])) {
        display: none !important;
    }

    /* Its own rule: a browser without :has() drops a whole selector list. */
    .docs-modal-overlay:not([hidden]) .docs-modal-close {
        display: none !important;
    }

    body:has(.docs-modal-overlay:not([hidden])) .landing-scale-wrapper,
    body:has(.docs-modal-overlay:not([hidden])) main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .docs-modal-overlay:not([hidden]) {
        position: static;
        height: auto;
        overflow: visible;
        padding: 0;
        background: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .docs-modal-overlay:not([hidden]) :is(.docs-modal-dialog, .docs-modal-body) {
        max-height: none;
        overflow: visible;
        box-shadow: none;
    }

    .docs-modal-overlay:not([hidden]) pre {
        max-height: none;
        overflow: visible;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }

    .docs-modal-overlay:not([hidden]) pre code {
        white-space: inherit;
    }
}
