/* =====================================================================
BASE STYLES — minimal, predictable
---------------------------------------------------------------------
Element-level resets & typography. Avoid layout opinions here.
Vertical rhythm is provided by utilities in components.css
===================================================================== */

/* Font is loaded in header.php via Google Fonts link tag */

/* Reset & box model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
    /* Offset for fixed header */
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    /* padding-top removed for sticky header */
    font-family: var(--font-family-body);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    font-size: var(--font-size-base);
    text-rendering: optimizeLegibility;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.025em;
    position: relative;
    /* Ensure body is relative for the overlay */
}

/* Sitewide Grain Texture (Option 1) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    /* Very subtle texture */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

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

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-primary);
    line-height: var(--leading-tight);
    margin: 0 0 var(--spacing-sm);
    font-weight: var(--weight-semibold);
}

h1 {
    font-size: var(--font-size-2xl);
    margin-top: 0;
}

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

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

p {
    margin: 0 0 var(--spacing-sm);
    color: var(--color-text-secondary);
}

ul,
ol {
    margin: 0 0 var(--spacing-sm);
    padding-left: 1.25rem;
}

li+li {
    margin-top: var(--spacing-4);
}

small {
    font-size: var(--font-size-sm);
}

strong {
    font-weight: var(--weight-semibold);
}

/* Links */
a {
    color: var(--color-accent);
    text-decoration: none;
}

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

/* Code */
code,
pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
}

pre {
    padding: var(--spacing-sm);
    background: var(--color-bg-secondary);
    border-radius: 8px;
}

/* Focus visible */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Accessibility helper */
.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;
}