/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Document ── */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1 {
  font-size: var(--text-display);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--text-2xl);
  font-weight: 400;
  margin-bottom: var(--space-lg);
}

h3 {
  font-size: var(--text-xl);
  font-weight: 400;
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--text-lg);
  font-weight: 500;
  margin-bottom: var(--space-md);
}

p {
  margin-bottom: var(--space-lg);
}

p:last-child {
  margin-bottom: 0;
}

/* ── Links ── */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--transition-fast);
}

a:visited {
  color: #6E3333;
}

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

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Selection ── */
::selection {
  background-color: #8B3A3A30;
  color: var(--color-text);
}

/* ── Lists ── */
ul, ol {
  padding-left: var(--space-xl);
  margin-bottom: var(--space-lg);
}

li {
  margin-bottom: var(--space-sm);
}

/* ── Blockquote ── */
blockquote {
  margin: 0;
  padding: 0;
  border: none;
}

/* ── Horizontal Rule ── */
hr {
  border: none;
  border-top: 1px solid var(--color-rule);
  margin-block: var(--space-2xl);
}

/* ── Images ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Table base ── */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ── Utilities ── */
.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-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-mid { color: var(--color-text-mid); }

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -3rem;
  left: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-accent);
  color: var(--color-bg);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  z-index: 200;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-sm);
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.skip-link:visited {
  color: var(--color-bg);
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
