/*
 * Fortico Starter — base.css
 *
 * Modern CSS reset + sensible element defaults.
 * Everything references tokens. No raw values here.
 *
 * Based on the best parts of:
 *   - Andy Bell's Modern Reset
 *   - Josh Comeau's Custom Reset
 *   - Sanitize.css
 */

/* ── Box model ──────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── Root ───────────────────────────────────────────────────────────────────── */
html {
  font-size: 100%;                        /* Respect user browser settings */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

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

/* ── Body ───────────────────────────────────────────────────────────────────── */
body {
  margin: 0;
  min-block-size: 100svh;
  font-family:    var(--font-body);
  font-size:      var(--text-base);
  font-weight:    var(--font-weight-regular);
  line-height:    var(--leading-normal);
  color:          var(--color-text);
  background:     var(--color-bg);
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family:    var(--font-heading);
  font-weight:    var(--font-weight-bold);
  line-height:    var(--leading-tight);
  color:          var(--color-heading);
  margin-block:   0;
  text-wrap:      balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl);  }
h5 { font-size: var(--text-lg);  }
h6 { font-size: var(--text-md);  }

p {
  margin-block: 0;
  text-wrap:    pretty;
  max-width:    72ch;       /* Prevent overly long lines */
}

p + p {
  margin-block-start: var(--space-sm);
}

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

/* ── Links ──────────────────────────────────────────────────────────────────── */
a {
  color:           inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition:      color var(--transition-fast);
}

a:hover {
  color: var(--color-primary);
}

a:focus-visible {
  outline:        2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius:  var(--radius-sm);
}

/* ── Images & Media ─────────────────────────────────────────────────────────── */
img,
picture,
video,
canvas,
svg {
  display:   block;
  max-width: 100%;
}

img {
  height: auto;
  font-style: italic;    /* Shows alt text in italics if image fails */
}

/* ── Form elements ──────────────────────────────────────────────────────────── */
input,
button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* ── Lists ──────────────────────────────────────────────────────────────────── */
ul, ol {
  margin-block: 0;
  padding-inline-start: 0;
  list-style: none;
}

/* ── Horizontal rule ────────────────────────────────────────────────────────── */
hr {
  border: none;
  border-block-start: var(--border-width-thin) solid var(--color-border);
  margin-block: var(--space-lg);
}

/* ── Code ───────────────────────────────────────────────────────────────────── */
code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size:   var(--text-sm);
}

/* ── Accessibility ──────────────────────────────────────────────────────────── */
.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;
}

:focus:not(:focus-visible) {
  outline: none;
}

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