/* Reset-adjacent defaults, global element styles, motion. */

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

* {
    margin: 0;
}

html {
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
    scrollbar-gutter: stable;
}

html.app-dark {
    color-scheme: dark;
}

body {
    min-height: 100svh;
    background-color: var(--ground);
    color: var(--ink);
    font-family: var(--font-sans);
    font-feature-settings: var(--font-features);
    font-size: var(--step-0);
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Freya headlines: large, light (400), tight leading; emphasis carried by
   a medium-weight primary-colored span (.text-primary). */
h1, h2, h3, h4 {
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

p {
    max-width: var(--measure);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition) ease;
}

a:hover {
    color: var(--primary-text);
}

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

ul[class],
ol[class] {
    list-style: none;
    padding: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
}

::selection {
    background: var(--primary);
    color: var(--primary-contrast);
}

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

/* Turbo page changes: quiet cross-fade via the View Transitions API. */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 160ms ease both vt-fade-out;
}

::view-transition-new(root) {
    animation: 200ms ease 40ms both vt-fade-in;
}

@keyframes vt-fade-out {
    to { opacity: 0; }
}

@keyframes vt-fade-in {
    from { opacity: 0; }
}

/* Reveal-on-scroll (assets/controllers/reveal_controller.js) — the Freya
   animate-fadein entrance. Hidden state only ever applied by JS. */
.reveal-pending {
    opacity: 0;
    translate: 0 16px;
}

.reveal-in {
    opacity: 1;
    translate: 0 0;
    transition: opacity 450ms var(--ease-out), translate 450ms var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
    .reveal-pending,
    .reveal-in {
        opacity: 1;
        translate: none;
        transition: none;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none;
    }

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