/* ==========================================================================
   Reset — intentionally minimal. Normalises the handful of defaults the
   design actually fights with, and nothing else.
   ========================================================================== */

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

html {
    font-size: 16px; /* Base for rem units */
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchored sections must clear the sticky header. Without this, jumping
       to #projects parks the heading underneath the nav bar. */
    scroll-padding-top: calc(var(--header-height) + var(--space-5));
    /* A fixed chat launcher sits in the lower corner; keep focused content
       from being pinned underneath it when navigating by keyboard. */
    scroll-padding-bottom: calc(var(--space-10) + var(--space-6));
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-synthesis-weight: none;
    /* Theme switches should not flash a hard cut between palettes. */
    transition: background-color var(--dur-base) ease, color var(--dur-base) ease;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-2);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-snug);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
}

ul, ol {
    margin-top: 0;
    margin-bottom: var(--space-4);
    padding-left: var(--space-5);
}

figure {
    margin: 0;
}

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

img {
    height: auto;
}

a {
    color: var(--color-accent);
    text-decoration: underline;
    background-color: transparent;
}

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

button,
input,
optgroup,
select,
textarea {
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button,
select {
    text-transform: none;
}

button {
    background: none;
}

[role="button"] {
    cursor: pointer;
}

/* Every interactive element gets the same visible focus treatment, and it is
   never removed — only replaced with the project's ring. */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

a:focus-visible {
    outline-width: 3px;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

::selection {
    background-color: var(--color-accent-fill);
    color: var(--color-on-accent);
}
