/* ============================================================
   Currant — Base
   Modern reset + element defaults + layout/utility helpers.
   Load AFTER tokens.css, before components.css.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; text-rendering: optimizeLegibility; }
img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
:target { scroll-margin-top: calc(var(--nav-height) + var(--space-4)); }

/* ---------- Element defaults ---------- */
body {
  background-color: var(--color-cream);
  background-image: var(--gradient-page-wash);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  text-wrap: balance;
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { max-width: 65ch; }
p, li { line-height: var(--leading-normal); }

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

strong, b { font-weight: var(--weight-semibold); }
small { font-size: var(--text-sm); }

.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
code, pre, .code { font-family: var(--font-code); font-size: 0.92em; }

hr { border: none; border-top: 1px solid var(--color-divider); }

/* ---------- Accessibility ---------- */
:focus-visible { outline: none; box-shadow: var(--shadow-ring); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: var(--space-3); top: -3rem;
  background: var(--color-ink); color: var(--color-text-invert);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill);
  z-index: var(--z-toast); transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); text-decoration: none; }

.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;
}

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

.section { padding-block: var(--space-8); }
.section--alt { background: var(--color-surface-alt); }
.section--ink { background: var(--color-ink); color: var(--color-text-invert); }
.section--ink h1, .section--ink h2, .section--ink h3 { color: var(--color-text-invert); }

/* vertical stack with consistent gaps */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--space-4); }
.stack--sm > * + * { margin-top: var(--space-2); }
.stack--lg > * + * { margin-top: var(--space-6); }

/* responsive auto-grid */
.grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

.lead { font-size: var(--text-md); color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }
.subtle { color: var(--color-text-subtle); }
.center { text-align: center; }
.text-balance { text-wrap: balance; }

/* gradient text accent — use sparingly, NEVER on body copy or buttons */
.gradient-text {
  background: var(--gradient-currant-flow);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
