/*
 * Base: reset, page typography, links, utilities.
 */

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

html {
    overflow-x: clip; /* with body's: nothing waiting off to the side (entrances) widens the page, iOS included */
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: var(--header-pinned, var(--header-height));
}

/* Smooth scrolling once loaded (site.js), so a reload doesn't glide back down to where it was */
html.is-loaded {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    background: var(--white);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 300;
    line-height: 1.56;
    letter-spacing: .02em;
}

/* The page between the header and the footer grows, so short pages keep the footer at the bottom. */
.site-main {
    flex: 1 0 auto;
    background: var(--white);
}

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

img {
    height: auto;
    user-select: none;
}

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

button {
    cursor: pointer;
    background: none;
    border: 0;
}

a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: .15em;
    transition: color .2s ease-in-out;
}

a:hover {
    color: var(--link-hover);
}

:focus-visible {
    outline: 2px solid var(--tertiary-600);
    outline-offset: 2px;
}

iframe:focus {
    outline: 2px solid var(--tertiary-600);
    outline-offset: 2px;
}

strong,
b {
    font-weight: 600;
}

ul,
ol {
    padding-inline-start: 20px;
}

li + li {
    margin-top: var(--step-2);
}

/* ---------- Headings ---------- */
/* Light, thin headings; each level has a size class (.is-h1 … .is-h4) so a heading's
   look can follow its setting while its level follows the page outline. */

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    font-family: var(--font-sans);
    font-weight: 100;
    letter-spacing: .01em;
}

/* Newsreader for h1–h4 (Inter for everything else, FAQ questions included) */
h1, h2, h3, h4 {
    font-family: var(--font-serif);
}

h1, .is-h1 {
    font-size: 62px;
    line-height: 1.1;
}

h2, .is-h2 {
    font-size: 54px;
    line-height: 1.11;
}

h3, .is-h3 {
    font-size: 40px;
    line-height: 1.1;
}

h4, .is-h4 {
    font-size: 28px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.14;
    letter-spacing: .03em;
}

h5, h6 {
    font-size: 18px;
    font-weight: 300;
    line-height: 1.33;
}

@media (max-width: 860px) {
    h1, .is-h1 { font-size: 44px; line-height: 1.09; }
    h2, .is-h2 { font-size: 38px; }
    h3, .is-h3 { font-size: 32px; line-height: 1.19; }
}

@media (max-width: 600px) {
    body { font-size: 16px; line-height: 1.5; }
    h1, .is-h1 { font-size: 42px; line-height: 1.14; }
    h2, .is-h2 { font-size: 34px; line-height: 1.18; }
    h3, .is-h3 { font-size: 28px; line-height: 1.21; }
    h4, .is-h4 { font-size: 24px; line-height: 1.17; }
}

/* [highlight] and [accent] in headings */
.has-highlight {
    background: var(--highlight);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.has-accent {
    background: linear-gradient(90deg, var(--gradient-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* ---------- Dark backgrounds ---------- */
/* Anything inside .is-dark (a dark section, block, hero…) switches to light text;
   .is-light switches back (e.g. a light card inside a dark section). */

.is-dark {
    --text: var(--white);
    --text-strong: var(--white);
    --heading: var(--white);
    --subheading: var(--tertiary-200);
    --highlight: var(--gradient-highlight);
    --link: var(--white);
    --link-hover: var(--tertiary-200);
    color: var(--text);
}

.is-light {
    --text: var(--neutral-800);
    --text-strong: var(--neutral-900);
    --heading: var(--neutral-900);
    --subheading: var(--tertiary-600);
    --highlight: var(--gradient-highlight-ink);
    --link: var(--tertiary-600);
    --link-hover: var(--tertiary-700);
    color: var(--text);
}

/* ---------- Utilities ---------- */

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

.skip-link:focus {
    z-index: 1000;
    top: 8px;
    left: 8px;
    width: auto;
    height: auto;
    padding: 12px 18px;
    clip: auto;
    background: var(--white);
    color: var(--black);
    border-radius: var(--radius);
}

/* The width every page's content lines up to */
.container {
    width: 100%;
    max-width: var(--page-width);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

/* WordPress admin bar: along the bottom, so it doesn't push the fixed header */
html {
    margin-top: 0 !important;
}

#wpadminbar {
    position: fixed !important;
    top: auto !important;
    bottom: 0;
    opacity: .9;
}

@media (max-width: 782px) {
    #wpadminbar {
        overflow-x: clip; /* its account name doesn't widen the page on phones */
    }
}

/* ---------- Reduced motion ---------- */
/* No transitions or animations anywhere: everything shows in its final state.
   (Scripts also skip entrances and make smooth scrolls instant: site.js, reveal.js.) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Back to top (footer.php, site.js) ----------
   A gold (accent) circle in the bottom right that scales in once the page is scrolled down. */

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tertiary-700);   /* as the accent button (gold) */
    color: var(--white);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
    cursor: pointer;
    transform: scale(0);
    visibility: hidden;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), visibility 0s .3s, background-color .2s ease;
}

.back-to-top.is-shown {
    transform: scale(1);
    visibility: visible;
    transition: transform .35s cubic-bezier(.34, 1.4, .64, 1), visibility 0s, background-color .2s ease;
}

.back-to-top:hover {
    background: var(--tertiary-600);
}

.back-to-top:active {
    background: var(--tertiary-700);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--tertiary-600);
    outline-offset: 3px;
}

.back-to-top svg {
    width: 22px;
    height: 22px;
}

/* Above the admin bar (moved to the bottom of the screen for logged-in users) */
.admin-bar .back-to-top {
    bottom: calc(24px + 32px);
}

@media (max-width: 782px) {
    .admin-bar .back-to-top {
        bottom: calc(24px + 46px);
    }
}

@media (max-width: 600px) {
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 50px;
        height: 50px;
    }

    .admin-bar .back-to-top {
        bottom: calc(16px + 46px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .back-to-top.is-shown {
        transition: none;
    }
}

/* ---------- Entrances: no flash before they start ----------
   html.rv-js (set in the <head>, inc/assets.php) holds blocks that animate in (.rv-wait) and
   section headers hidden from the first paint until their script has set the entrance up
   (assets/js/blocks.js), so they don't show for a moment and then disappear. */
html.rv-js .rv-wait,
html.rv-js .section__header:not(.rv-set) {
    opacity: 0;
}
