/* ============================================================
   base.css — reset, tipografia base, container, helpers
   ============================================================ */

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

* { margin: 0; padding: 0; }

html {
  scroll-padding-top: calc(var(--header-h) + 16px);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .grain-overlay { display: none !important; }
}

/* Reveal fail-safe */
.reveal { opacity: 1; transform: none; filter: none; }

html.js-ready .reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(6px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out), filter .8s var(--ease-out);
}

html.js-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

html.js-fallback .reveal {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

/* Tipografia base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--fg-display);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p { max-width: var(--measure); color: var(--fg); }

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

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

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

ul, ol { list-style: none; }

button {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

input,
textarea,
select { font: inherit; color: inherit; }

::selection {
  background: var(--sage-2);
  color: var(--sage-12);
}

/* Focus visible */
:focus { outline: none; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible {
  box-shadow: var(--ring-focus);
  border-radius: 6px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--s-3) var(--s-6);
  background: var(--sage-9);
  color: var(--paper);
  border-radius: var(--r-md);
  font-weight: 500;
  z-index: 10000;
  transition: top var(--dur-base) var(--ease);
}

.skip-link:focus { top: 16px; color: var(--paper); }

/* Scroll progress */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: transparent;
  z-index: var(--z-progress);
  pointer-events: none;
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sage-9), var(--copper-9));
  transition: width 100ms linear;
}

/* Grain overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: var(--noise-opacity);
  z-index: var(--z-grain);
  mix-blend-mode: multiply;
}

section { position: relative; }

/* SR only */
.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-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty; }
