:root {
    --nwr-logo-size: clamp(2.25rem, 1.95rem + 1.5vw, 3rem);
    --nwr-logo-text: clamp(1.2rem, .98rem + 1.05vw, 1.65rem);
    --nwr-header-gutter: clamp(.75rem, 3vw, 2.5rem);
    --nwr-header-row: calc(var(--nwr-logo-size) + 1rem);
}

:is(#header, #nwr-header-shell) .header-inner {
    box-sizing: border-box;
    max-width: 1480px;
    min-height: var(--nwr-header-row);
    padding-block: .5rem;
    padding-left: max(var(--nwr-header-gutter), env(safe-area-inset-left));
    padding-right: max(var(--nwr-header-gutter), env(safe-area-inset-right));
}

#header .header-inner {
    grid-template-rows: auto;
}

:is(#header, #nwr-header-shell) .header-inner .nwr-site-brand {
    align-self: center;
    justify-self: start;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: clamp(.4rem, 1vw, .7rem);
    white-space: nowrap;
}

:is(#header, #nwr-header-shell) .nwr-site-brand img {
    display: block;
    flex: 0 0 var(--nwr-logo-size);
    width: var(--nwr-logo-size);
    height: var(--nwr-logo-size);
    max-width: none;
    object-fit: contain;
}

:is(#header, #nwr-header-shell) .header-inner .nwr-site-brand > span {
    font-size: var(--nwr-logo-text);
    line-height: 1;
}

:is(#header, #nwr-header-shell) .nwr-site-brand small {
    margin-top: .25rem;
    font-size: .5rem;
    letter-spacing: .25em;
}

.nwr-demo-html {
    scroll-padding-top: calc(var(--nwr-header-row) + 1px + .75rem);
}
.nwr-demo-html:has(body.admin-bar) {
    scroll-padding-top: calc(var(--nwr-header-row) + 1px + .75rem + var(--wp-admin--admin-bar--height, 32px));
}
.nwr-demo-landing #main[id],
.nwr-demo-landing #main [id] {
    scroll-margin-top: 0;
}

@media (max-width: 1023px), (max-height: 599px) {
    .nwr-demo-landing #header,
    body.nwr-native #nwr-header-shell {
        position: relative;
        top: auto;
    }

    .nwr-demo-html,
    .nwr-demo-html:has(body.admin-bar) {
        scroll-padding-top: .75rem;
    }

    .nwr-demo-html:has(body.admin-bar) {
        scroll-padding-top: calc(.75rem + var(--wp-admin--admin-bar--height, 32px));
    }
}
@media (max-width: 600px) {
    /* WordPress moves its own toolbar into the page flow at this width. */
    .nwr-demo-html:has(body.admin-bar) {
        scroll-padding-top: .75rem;
    }
}
@media (max-width: 420px) {
    #nwr-header-shell .nwr-language-pill {
        min-width: 0;
        gap: .2rem;
        padding-inline: .45rem;
    }
}
