/* Shared only by the Japanese and English :focus articles. */
body.reference-page.focus-page main {
    max-width: 76ch;
    margin-inline: auto;
    min-width: 0;
}

body.focus-page .focus-language {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-block: 1rem;
}

body.focus-page .focus-language [aria-current="page"] {
    font-weight: 700;
    text-decoration-thickness: .15em;
}

body.focus-page .pagetop {
    display: block;
    width: fit-content;
    min-height: 2.75rem;
    margin: 1.5rem auto;
    padding: .5rem .75rem;
}

body.focus-page .focus-ad {
    width: 100%;
    max-width: 76ch;
    min-width: 0;
    margin: 2rem auto;
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
}

body.focus-page .focus-ad:focus-visible {
    outline: 3px solid var(--site-focus);
    outline-offset: 3px;
}

body.focus-page .focus-ad-label {
    margin: 0 0 .5rem;
    color: var(--site-muted-text);
    font-size: .85rem;
}

/* Keep a served creative intact when it retains its original width on resize.
 * min-content prevents centered iframe hosts from overflowing off the left edge.
 * Only the ad region scrolls; the creative is not scaled, clipped, or refreshed.
 */
body.focus-page .focus-ad .adsbygoogle {
    width: 100%;
    min-width: min-content;
    max-width: none;
    /* Avoid baseline space below an inline ad host inside a fixed-height unit. */
    line-height: 0;
}

body.focus-page :where(h2, h3, section, nav)[id] {
    scroll-margin-top: 1rem;
}

body.focus-page :where(.focus-demo, .focus-card, .focus-note) {
    padding: 1.1rem;
    border: 1px solid var(--site-border);
    border-radius: .4rem;
    color: var(--site-text);
    background: var(--site-surface);
    min-width: 0;
}

body.focus-page .focus-demo {
    margin-block: 1rem;
}

body.focus-page .focus-demo label {
    display: block;
    margin-block: .75rem .4rem;
    font-weight: 700;
}

body.focus-page .focus-demo :where(input, button) {
    display: block;
    max-width: 100%;
    min-width: 0;
    min-height: 2.75rem;
    padding: .6rem .75rem;
    border: 1px solid var(--site-muted-text);
    border-radius: .25rem;
    color: var(--site-text);
    background: var(--site-bg);
    font: inherit;
}

body.focus-page .focus-demo input {
    width: min(100%, 24rem);
}

body.focus-page .focus-demo button {
    margin-block: 1rem;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
}

body.focus-page .focus-demo [hidden] {
    display: none;
}

body.focus-page .focus-demo--focus :where(input, button):focus,
body.focus-page .focus-demo--visible :where(input, button):focus-visible {
    outline: 3px solid var(--site-focus);
    outline-offset: 3px;
}

body.focus-page .focus-demo--within:focus-within {
    outline: 3px solid var(--site-focus);
    outline-offset: 3px;
}

body.focus-page .focus-state {
    min-height: 1.7em;
    margin-block: .75rem 0;
    font-size: .95rem;
}

body.focus-page .focus-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: 1rem;
    margin-block: 1.5rem;
}

body.focus-page .focus-card > :first-child,
body.focus-page .focus-note > :first-child {
    margin-top: 0;
}

body.focus-page .focus-card > :last-child,
body.focus-page .focus-note > :last-child {
    margin-bottom: 0;
}

body.focus-page .focus-card .focus-demo {
    padding: .8rem;
    background: var(--site-bg);
}

body.focus-page .focus-note {
    margin-block: 1.5rem;
    border-inline-start: .3rem solid var(--site-focus);
}

body.focus-page .focus-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    margin-block: 1rem;
    padding: .4rem;
    overscroll-behavior-inline: contain;
}

/* Override legacy OS-only table colors even when the manual theme differs. */
body.reference-page.focus-page .focus-table-scroll table {
    width: 100%;
    min-width: 38rem;
    max-width: none;
    margin: 0;
    border-collapse: collapse;
    color: var(--site-text);
    background: var(--site-bg);
}

body.reference-page.focus-page .focus-table-scroll :where(th, td) {
    padding: .75rem;
    border: 1px solid var(--site-muted-text);
    text-align: start;
    vertical-align: top;
}

body.reference-page.focus-page .focus-table-scroll :where(thead th, tbody th) {
    color: var(--site-text);
    background: var(--site-surface);
}

body.focus-page .focus-table-scroll caption {
    padding-bottom: .6rem;
    text-align: start;
    font-weight: 700;
}

body.focus-page .focus-table-scroll th code {
    white-space: nowrap;
    overflow-wrap: normal;
}

body.focus-page .focus-scroll-hint {
    display: none;
    color: var(--site-muted-text);
    font-size: .95rem;
}

body.focus-page .soce {
    margin: 1.25rem 0;
    min-width: 0;
    max-width: 100%;
}

body.focus-page .soceHead {
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

body.focus-page .soceHead > p {
    padding-left: .5rem;
}

body.focus-page pre {
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--site-border);
    white-space: pre;
    overflow-x: auto;
    tab-size: 2;
}

body.focus-page :where(pre, code) {
    color: var(--site-code-text);
    background: var(--site-code-bg);
    text-shadow: none;
    font-family: ui-monospace, Consolas, monospace;
    font-size: .94em;
}

body.focus-page pre code {
    font-size: inherit;
}

body.focus-page :not(pre) > code {
    padding: .1em .2em;
    border-radius: .2em;
    overflow-wrap: anywhere;
}

body.focus-page .focus-table-scroll:focus-visible {
    outline: 3px solid var(--site-focus);
    outline-offset: -3px;
}

@media (max-width: 600px) {
    body.focus-page .focus-cards {
        grid-template-columns: minmax(0, 1fr);
    }

    body.focus-page .theme-switcher {
        flex-wrap: wrap;
    }
}

@media (max-width: 760px) {
    body.focus-page .focus-scroll-hint {
        display: block;
    }
}

@media (forced-colors: active) {
    body.focus-page .focus-demo--focus :where(input, button):focus,
    body.focus-page .focus-demo--visible :where(input, button):focus-visible,
    body.focus-page .focus-demo--within:focus-within {
        outline-color: Highlight;
    }
}

@media print {
    body.focus-page h3 {
        break-before: auto;
    }
}
