/* Skip link and <main> landmark for the public page shells (accessibility package P1-3,
   WCAG 2.4.1 and 1.3.1). Self-contained on purpose: P1-4 (focus style) and P1-5 (contrast)
   may restyle it later. */

/* "Skip to main content": the first focusable element of each shell. Hidden until it has
   focus, then shown in the top left corner, above the fixed navigation bar. */
.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 2147483647;
    width: auto;
    height: auto;
    margin: 0;
    padding: 8px 16px;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.5;
    text-decoration: underline;
}

/* The skip link's target. Following the link scrolls <main>'s top to the top of the window,
   where the fixed bars would cover it. skip-link.js measures the fixed bars at the top of the
   window when the link is used and sets that height as <main>'s scroll-margin-top, so the bars
   of each shell, at each width and in the toolbar's zoom mode, are taken as they are. The value
   here only covers the moment before the deferred script runs: the tallest bars any public shell
   has (168px, base_notification and base_knowledge). <main> starts right below its shell's bars,
   so a margin at least that tall leaves the page at its top. Its focus style is in focus.css. */
main#main {
    scroll-margin-top: 168px;
}

/* <main> wraps content roots that size themselves against <body>. Inside <main> those
   percentages would resolve against <main>, which has no height of its own, so <main> stands
   in for <body>. Each shell or page names the case on <main> (the main_class block):
   - shell-main--page: Remark's .page has min-height: calc(100% - 44px), 66px below 992px
     (site.min.css), which keeps the grey page area and the footer at the bottom of a short
     page. <main> takes that minimum height and its .page grows to fill it.
   - shell-main--fill: the request map pages' #content has height: 100%. <main> takes the full
     height instead. */
.shell-main--page {
    display: flex;
    flex-direction: column;
    min-height: calc(100% - 44px);
}

.shell-main--page > .page {
    flex: 1 0 auto;
}

@media (max-width: 991.98px) {
    .shell-main--page {
        min-height: calc(100% - 66px);
    }
}

/* Below 768px Remark clips the .page behind the open side menu to the viewport
   (body.site-menubar-open .page { height: 100%; overflow: hidden }); <main> gives that 100% a
   height to resolve against. */
@media (max-width: 767.98px) {
    body.site-menubar-open .shell-main--page {
        height: 100%;
    }
}

.shell-main--fill {
    height: 100%;
}

/* The accessibility toolbar's zoom mode scales every child of <body>
   (body.mic-toolbox-zoom-up > :not(#mic-init-access-tool) { zoom: 1.4; -moz-transform: scale(1.4) }).
   On the <header> and <main> wrappers, Firefox's transform would make them the containing block
   of the fixed bars and buttons inside them, which would then stop being fixed to the viewport.
   The wrappers keep the zoom, which doesn't do that, and pass the transform on to their
   children, the elements that were <body>'s children before the wrappers existed. The selectors
   outrank the toolbar's. */
body.mic-toolbox-zoom-up > header:not(#mic-init-access-tool),
body.mic-toolbox-zoom-up > main.shell-main:not(#mic-init-access-tool) {
    -moz-transform: none !important;
}

body.mic-toolbox-zoom-up > header:not(#mic-init-access-tool) > *,
body.mic-toolbox-zoom-up > main.shell-main:not(#mic-init-access-tool) > * {
    -moz-transform: scale(1.4) !important;
    -moz-transform-origin: 40% 0 !important;
}
