/* Reset + typography foundation */

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

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

body {
  font-family: 'Nunito', system-ui, -apple-system, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--mist);
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  font-weight: 500;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: var(--sky-deep);
  text-decoration-color: rgba(42,156,192,0.4);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-soft),
              text-decoration-color var(--dur-fast) var(--ease-soft);
}
a:hover { color: var(--ember-deep); text-decoration-color: var(--ember); }

ul, ol { list-style: none; }

h1, h2, h3, h4, h5 {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-weight: 600;
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h1 { font-size: var(--fs-3xl); font-weight: 700; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { max-width: 60ch; }

::selection { background: var(--sun); color: var(--ink); }

:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
  border-radius: 6px;
}

/* Page background — gradient mesh + faint grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--grad-warm);
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.2  0 0 0 0 0.3  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}
.container-narrow {
  max-width: var(--container-narrow);
}
.stack > * + * { margin-top: var(--sp-5); }
.stack-lg > * + * { margin-top: var(--sp-7); }

/* Visually-hidden but accessible to screen readers */
.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--cloud);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: top var(--dur-fast);
}
.skip-link:focus { top: 1rem; color: var(--cloud); }
