/* ========================================================================
   Base — Reset + typography + body
   ======================================================================== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle grain texture on body for warmth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.35;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

/* Ensure content sits above grain */
body > * { position: relative; z-index: 2; }

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  outline: 0;
}

button { cursor: pointer; }

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

ul, ol { list-style: none; }

/* Typography ────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--ink-500);
}

h1 { font-size: clamp(2.5rem, 6vw, 4.75rem); font-variation-settings: "opsz" 144, "SOFT" 50; }
h2 { font-size: clamp(2rem, 4vw, 3rem); font-variation-settings: "opsz" 96; }
h3 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clay-600);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.serif { font-family: var(--font-display); }
.sans  { font-family: var(--font-sans); }
.mono  { font-family: var(--font-mono); }

.italic-serif {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

/* Focus ──────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--clay-500);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* Utilities ──────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}
.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-clay { color: var(--clay-500); }
.text-sage { color: var(--sage-500); }

.divider {
  height: 1px;
  background: var(--border);
  width: 100%;
}
.divider-warm {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-warm), transparent);
}

/* Scrollbars (subtle) ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-100);
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-200); }

/* Selection */
::selection {
  background: var(--clay-500);
  color: var(--cream-50);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
