/*
 * Document defaults, readable typography and keyboard foundations.
 * Component presentation belongs in assets/css/components/.
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scroll-padding-top: var(--bhw-space-6);
}

body {
    margin: 0;
    background: var(--bhw-color-background-primary);
    color: var(--bhw-color-text-primary);
    font-family: var(--bhw-font-body);
    font-size: var(--bhw-text-md);
    line-height: var(--bhw-leading-body);
    text-rendering: optimizeLegibility;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    color: inherit;
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    min-width: 0;
    margin-block: 0 0.65em;
    color: var(--bhw-color-text-primary);
    font-family: var(--bhw-font-heading);
    font-weight: var(--bhw-weight-semibold);
    letter-spacing: var(--bhw-tracking-tight);
    line-height: var(--bhw-leading-heading);
    hyphens: auto;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

h1 {
    font-size: var(--bhw-text-3-xl);
}

h2 {
    font-size: var(--bhw-text-2-xl);
}

h3 {
    font-size: var(--bhw-text-xl);
}

p {
    max-width: var(--bhw-layout-reading-max);
}

a {
    color: var(--bhw-color-accent);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--bhw-color-accent-hover);
}

:where(
    a,
    button,
    input,
    select,
    textarea,
    summary,
    [tabindex]:not([tabindex="-1"])
):focus-visible {
    outline: var(--bhw-border-focus) solid var(--bhw-color-focus);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px var(--bhw-color-focus-contrast);
}

.screen-reader-text {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.screen-reader-text:focus {
    z-index: 100000;
    top: var(--bhw-space-4);
    left: var(--bhw-space-4);
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--bhw-space-3) var(--bhw-space-4);
    border-radius: var(--bhw-radius-small);
    clip: auto;
    clip-path: none;
    background: var(--bhw-color-text-primary);
    color: var(--bhw-color-background-primary);
    font-weight: var(--bhw-weight-semibold);
    white-space: normal;
}

.site-main:focus {
    outline: var(--bhw-border-focus) solid transparent;
    outline-offset: var(--bhw-space-2);
}

.site-main {
    width: min(
        calc(100% - (2 * var(--bhw-layout-gutter))),
        var(--bhw-layout-content-max)
    );
    margin-inline: auto;
}

.site-main > *,
.bhw-container > * {
    min-width: 0;
}

.bhw-container {
    width: min(
        calc(100% - (2 * var(--bhw-layout-gutter))),
        var(--bhw-layout-content-max)
    );
    margin-inline: auto;
}

.bhw-section {
    padding-block: var(--bhw-layout-section-space);
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
