/* ==========================================================================
   USFinCalc — Base
   Modern reset + semantic element styles + layout primitives + a11y defaults.
   Loaded after tokens.css. Mobile-first.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* ---- Headings ---- */
h1, h2, h3, h4 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  text-wrap: balance;
}
h1 {
  font-family: var(--font-figure);
  font-weight: var(--fw-regular);   /* DM Serif is heavy by design */
  font-size: var(--fs-2xl);
  letter-spacing: -0.01em;
}
h2 { font-size: var(--fs-xl); margin-top: var(--space-6); }
h3 { font-size: var(--fs-lg); margin-top: var(--space-5); }

/* ---- Prose ---- */
p { line-height: var(--lh-base); }
:is(h1, h2, h3, p, ul, ol) + p { margin-top: var(--space-3); }

a {
  color: var(--color-primary);
  text-underline-offset: 0.15em;
}
a:hover { color: var(--color-primary-hover); }

ul, ol { padding-left: var(--space-5); }
li + li { margin-top: var(--space-1); }

strong { font-weight: var(--fw-semibold); }

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

/* ==========================================================================
   Accessibility primitives
   ========================================================================== */

/* Visible focus on keyboard nav only */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: var(--z-overlay);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--space-2); }

/* Screen-reader-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;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* Vertical rhythm for stacked page sections */
main {
  flex: 1 0 auto;
  padding-block: var(--space-5) var(--space-7);
}
main > section + section,
main > * + .ad-slot,
main > .ad-slot + * { margin-top: var(--space-6); }

/* Readable measure for long-form content (SEO copy, guides) */
.prose { max-width: var(--content-max); }
.prose :is(h2, h3) { margin-top: var(--space-6); }

/* Utility */
.text-positive { color: var(--color-accent); }
.text-warning  { color: var(--color-warning); }
.muted         { color: var(--color-muted); }
.center        { text-align: center; }
