/* ==========================================================================
   Base element styles — typography and global page defaults.
   Mobile-first: base rules target small screens, min-width queries layer
   refinements on top for larger viewports.
   ========================================================================== */

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    background-image: var(--gradient-bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* Locks page scroll behind the mobile nav drawer while it's open
   (toggled via main.js's initNavToggle). No effect on desktop, where the
   nav is always inline rather than an overlay. */
body.nav-open {
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h1 {
    font-size: var(--fs-3xl);
}

h2 {
    font-size: var(--fs-2xl);
}

h3 {
    font-size: var(--fs-lg);
}

p {
    color: var(--color-text-muted);
}

/* Vertical rhythm for flowing body copy — the reset zeroes every margin,
   so two stacked elements of the same font-size/line-height (a paragraph
   followed by another paragraph, or a paragraph followed by a bullet
   list) previously touched with no gap at all, reading as one run-on
   block. Headings avoid this already, since their larger font-size and
   line-height naturally create visual separation. :not(:first-child)
   skips the case where the element is the very first thing in its
   parent (e.g. right after an eyebrow/heading with its own spacing
   rule), so this never doubles up existing spacing. */
p:not(:first-child),
.skills-list:not(:first-child) {
    margin-top: var(--space-sm);
}

@media (min-width: 768px) {
    h1 {
        font-size: var(--fs-4xl);
    }

    h2 {
        font-size: var(--fs-3xl);
    }
}

/* Visible focus state for keyboard navigation — never remove outline */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 3px;
}

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

.skip-link {
    position: absolute;
    top: -48px;
    left: var(--space-md);
    z-index: 100;
    padding: var(--space-xs) var(--space-md);
    background: var(--color-accent);
    color: #fff;
    border-radius: var(--radius-sm);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-md);
}
