/* ==========================================================================
   Base — Reset + Typography
   Modern CSS reset and foundational styles using design tokens.
   ========================================================================== */

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-main);
  background-color: var(--color-bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul,
ol {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

table {
  border-collapse: collapse;
}

/* Remove animations for reduced-motion preference */
@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;
  }
}

/* --- Typography --- */
h1,
h2,
h3,
h4 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-main);
}

h1 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-sub);
}

small {
  font-size: var(--font-size-xs);
  color: var(--color-text-sub);
}

strong {
  font-weight: var(--font-weight-bold);
}

/* --- Links --- */
a {
  color: var(--color-accent);
  transition: color var(--timing-fast) ease;
}

a:hover {
  color: var(--color-accent);
  opacity: 0.85;
}

a:active {
  opacity: 0.7;
}

/* --- Focus ring (keyboard accessibility) --- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Remove focus ring for mouse/touch */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Selection --- */
::selection {
  background-color: var(--color-accent);
  color: var(--color-bg-main);
}
