/* base.css: reset + element defaults. Every page, after tokens. */

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

/* Constrain the media that actually overflows. Never `* { max-width: 100% }`. */
img,
svg,
video,
iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

figure {
    margin: 0;
}

/* The root sizing lever: 1rem = 10px, rescaled by viewport in the two bands
   below. Author sizes in rem or they stop scaling. See agent/scale.md. */
html {
    font-size: 10px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 9.6rem;   /* anchored sections clear the sticky header */
}

/* 981px, not 767px and not the nav's 900px: below this, compressing the root
   drops body text to ~11px. See agent/scale.md. */
@media only screen and (min-width: 981px) and (max-width: 1024px) {
    html {
        font-size: 0.85vw;
    }
}

@media only screen and (min-width: 1441px) {
    html {
        font-size: 0.6945759vw;
    }
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--ink-body);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    line-height: var(--leading-snug);
    text-wrap: balance;
    overflow-wrap: break-word;   /* else one long word at display size outgrows the viewport */
}

h1 {
    font-size: var(--fs-1);
    font-weight: 800;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-display);
    text-transform: uppercase;
}

h2 {
    font-size: var(--fs-2);
    font-weight: 800;
    letter-spacing: var(--tracking-display);
}

h3 {
    font-size: var(--fs-3);
    font-weight: 700;
    letter-spacing: -0.015em;
}

h4 {
    font-size: var(--fs-4);
    font-weight: 700;
}

p {
    margin: 0 0 var(--space-4);
    text-wrap: pretty;
}

p:last-child {
    margin-bottom: 0;
}


a {
    color: var(--blue-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--dur) var(--ease-out);
}

a:hover {
    color: var(--blue-fill-hover);
}

ul, ol {
    margin: 0;
    padding: 0;
}

/* Invisible on any --surface-ink band unless overridden; see agent/colour.md */
strong {
    font-weight: 600;
    color: var(--ink);
}

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

/* Screen-reader-only, still focusable. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100%;
    z-index: var(--z-modal);
    padding: var(--space-3) var(--space-5);
    background: var(--ink);
    color: var(--ink-on-dark);
    border-radius: 0 0 var(--radius) var(--radius);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
    color: var(--ink-on-dark);
}

/* Reduced motion, site-wide. Not zero motion: colour and opacity stay, movement
   through space goes. Adding a transform effect? Add its selector to the
   enumerated list below. See agent/motion.md. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-property: opacity, color, background-color, border-color,
                             fill, stroke !important;
        transition-duration: var(--dur) !important;
        scroll-behavior: auto !important;
    }

    [data-reveal],
    [data-stagger] > *,
    .hero__inner > *,
    .btn:active,
    .call-fab:active,
    .bento button:active,
    .nav__panel,
    .lightbox {
        transform: none !important;
        translate: none !important;
        scale: none !important;
    }
}

/* A phone number must not break across lines, on any page. */
.nowrap {
    white-space: nowrap;
}
