/* Cross-site responsive and accessibility hardening (SI-208). */

html,
body {
    max-width: 100%;
}

body {
    overflow-x: clip;
}

:where(main, section, article, aside, nav, header, footer),
:where(.nav-shell, .nav-links, .nav-actions, .product-brand-lockup, .footer-grid, .docs-layout, .prose) {
    min-width: 0;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 6px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
    outline: none;
}

/* Confirmed by the SI-246 axe recipe on preproduction. */
.code-toolbar {
    color: var(--faint);
}

.copy-button {
    color: var(--faint);
}

.invoice-ecosystem-inner > span {
    color: var(--faint);
}

.footer-heading {
    margin: 0 0 16px;
    color: #8799a3;
    font-size: 11px;
    font-weight: 800;
}

.prose,
.surface-card,
.products-card,
.invoice-feature-card,
.pricing-card {
    overflow-wrap: break-word;
}

.docs-code,
.developer-workbench,
.prose pre,
.prose table {
    max-width: 100%;
}

.prose pre,
.docs-code pre,
.code-pane pre {
    scrollbar-gutter: stable;
    overscroll-behavior-inline: contain;
}

@media (max-width: 1080px) {
    .nav-links {
        top: calc(var(--header-height) - 1px);
        max-height: calc(100dvh - var(--header-height) - 18px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .nav-mega {
        max-width: 100%;
    }

    .nav-mega-product {
        grid-template-columns: 46px minmax(0, 1fr) auto;
    }
}

@media (hover: none), (pointer: coarse) {
    .menu-toggle {
        width: 44px;
        height: 44px;
    }

    .menu-toggle span {
        left: 13px;
        width: 16px;
    }

    .nav-links > a,
    .nav-dropdown-trigger,
    .language-switcher a,
    .copy-button,
    .workbench-tabs button,
    .product-subnav a,
    .footer-grid a:not(.brand) {
        min-height: 44px;
    }

    .nav-links > a,
    .nav-dropdown-trigger,
    .product-subnav a,
    .footer-grid a:not(.brand) {
        display: flex;
        align-items: center;
    }

    .copy-button,
    .workbench-tabs button {
        padding-inline: 13px;
    }
}

@media (max-width: 720px) {
    .nav-links {
        top: calc(var(--header-height-mobile) - 1px);
        right: 14px;
        left: 14px;
        max-height: calc(100dvh - var(--header-height-mobile) - 14px);
    }

    .button {
        min-width: 0;
        white-space: normal;
        text-align: center;
    }

    .code-toolbar,
    .workbench-tabs {
        flex-wrap: wrap;
        height: auto;
        padding-block: 9px;
    }

    .footer-grid {
        gap: 34px 28px;
    }

    .footer-bottom {
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .docs-page {
        padding-top: calc(var(--header-height-mobile) + 42px);
    }

    .prose {
        font-size: .98rem;
        line-height: 1.72;
    }

    .prose h1 {
        font-size: clamp(2rem, 11vw, 2.6rem);
    }

    .prose h2 {
        margin-top: 2.4rem;
        font-size: 1.45rem;
    }

    .prose pre {
        padding: 1rem;
        font-size: .82rem;
    }

    .prose table {
        display: block;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-gutter: stable;
        -webkit-overflow-scrolling: touch;
    }

    .prose th,
    .prose td {
        min-width: 9rem;
        padding: .65rem .7rem;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .footer-brand {
        grid-column: auto;
    }

    .nav-mega-product {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .nav-mega-product > em {
        grid-column: 2;
        justify-self: start;
    }

    .product-brand-lockup .brand-compact span,
    .brand-divider {
        display: none;
    }

    .product-nav-shell {
        gap: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spotlight-card::after {
        display: none;
    }
}

@media (forced-colors: active) {
    :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
        outline: 2px solid Highlight;
    }

    .button,
    .language-switcher,
    .nav-mega,
    .surface-card,
    .docs-code,
    .developer-workbench {
        border-color: CanvasText;
    }
}
