/* ==========================================================================
   base.css — modern reset + base element styling for Warm Spruce.
   Depends on tokens.css custom properties. No component classes here.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-200);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  overflow-x: hidden;
}

/* Media defaults — block-level, never overflow, inherit rounded by default. */
img, svg, video, canvas, picture {
  display: block;
  max-width: 100%;
  height: auto;
}
img { font-style: italic; color: var(--c-ink-faint); } /* alt text fallback styling */

/* Forms inherit type. */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: none; }

/* Typographic balance for headings. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-snug);
  color: var(--color-text);
  text-wrap: balance;
  font-optical-sizing: auto;
}

p, li { text-wrap: pretty; }

h1 { font-size: var(--fs-600); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-500); }
h3 { font-size: var(--fs-400); }
h4 { font-size: var(--fs-300); font-weight: 600; }

p { max-width: 68ch; }

/* Links — spruce, with a warm underline treatment. */
a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-accent-deep); }

ul, ol { padding-left: 1.25em; }

strong, b { font-weight: 700; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-32);
}

blockquote {
  margin: 0;
  padding-left: var(--space-20);
  border-left: 3px solid var(--c-amber);
  font-style: italic;
}

::selection {
  background: var(--c-amber);
  color: var(--c-spruce-darker);
}

/* Accessible, visible focus — only for keyboard users. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

/* Skip link — hidden until focused. */
.skip-link {
  position: absolute;
  left: var(--space-16);
  top: var(--space-16);
  z-index: var(--z-overlay);
  padding: 0.7em 1.1em;
  background: var(--c-spruce);
  color: #fff;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-100);
  box-shadow: var(--shadow-md);
  transform: translateY(-150%);
  transition: transform var(--dur) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); color: #fff; }

/* Visually-hidden but available to assistive tech. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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