/* ==========================================================================
   Base — element-level typography, forms and page scaffolding.
   Component classes live in components.css.
   ========================================================================== */

/* --- Headings ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-sans-serif);
    letter-spacing: var(--letter-spacing-tight);
    text-wrap: balance;
}

h1 { font-size: var(--font-size-4xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-3xl); font-weight: var(--font-weight-bold); }
h3 { font-size: var(--font-size-xl);  font-weight: var(--font-weight-semibold); }
h4 { font-size: var(--font-size-lg);  font-weight: var(--font-weight-semibold); }

/* Body copy reads better slightly narrower than its container. */
p {
    text-wrap: pretty;
}

/* --- Links -------------------------------------------------------------- */
a {
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

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

/* --- Media -------------------------------------------------------------- */
img {
    border-radius: var(--radius-md);
}

/* --- Form elements ------------------------------------------------------ */
input,
select,
textarea {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--focus-ring);
}

/* --- Buttons ------------------------------------------------------------
   Variants (.btn-primary / .btn-secondary / .btn-outline) are defined once,
   in components.css, alongside the .btn base class. */
button {
    font: inherit;
    border: none;
    cursor: pointer;
}

button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* --- Accessibility helpers ---------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-to-content {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-to-content:focus {
    left: var(--space-4);
    top: var(--space-4);
    width: auto;
    height: auto;
    overflow: auto;
    background: var(--color-surface);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
    z-index: 1100;
    text-decoration: none;
}

/* --- Page scaffolding ---------------------------------------------------- */
.page-wrapper {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1 0 auto;
}

/* The one horizontal container. Every section's content sits inside a
   .shell, so the left edge is identical the whole way down the page. */
.shell {
    width: 100%;
    max-width: var(--layout-max-width);
    margin-inline: auto;
    padding-inline: var(--layout-page-padding);
}

.shell-narrow {
    max-width: var(--layout-narrow-width);
}

/* --- Header -------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--color-header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

/* Set by navigation.js once the page has scrolled, so the header only
   separates itself from the content when there is content behind it. */
.site-header.is-stuck {
    border-bottom-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}
