/**
 * reset.css
 * ─────────────────────────────────────────────────────────────────────────────
 * Modern CSS reset and base styles.
 * Normalizes browser defaults and sets sensible global defaults.
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── BOX SIZING ─────────────────────────────────────────────────
   Apply border-box sizing to all elements for predictable layouts.
──────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── ROOT & BODY ────────────────────────────────────────────────
   Set base font, color, background, and smooth scrolling.
──────────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Prevent layout shift from scrollbar appearing */
  scrollbar-gutter: stable;
  /* Improve text rendering */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  /* Prevent horizontal overflow */
  overflow-x: hidden;
  /* Improve font rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── TYPOGRAPHY RESET ───────────────────────────────────────────
   Remove default heading styles; we apply our own.
──────────────────────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

/* ── LINKS ──────────────────────────────────────────────────────
   Remove default underline; add accent color.
──────────────────────────────────────────────────────────────── */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

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

/* ── LISTS ──────────────────────────────────────────────────────
   Remove default list styles; components apply their own.
──────────────────────────────────────────────────────────────── */
ul,
ol {
  list-style: none;
}

/* ── IMAGES & MEDIA ─────────────────────────────────────────────
   Make images responsive by default.
──────────────────────────────────────────────────────────────── */
img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── BUTTONS ────────────────────────────────────────────────────
   Reset button styles; components apply their own.
──────────────────────────────────────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: all var(--transition-base);
}

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

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── INPUTS ─────────────────────────────────────────────────────
   Reset input styles.
──────────────────────────────────────────────────────────────── */
input,
textarea,
select {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

/* ── CODE ───────────────────────────────────────────────────────
   Monospace font for code elements.
──────────────────────────────────────────────────────────────── */
code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-bg-card);
  color: var(--color-accent);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ── HORIZONTAL RULE ────────────────────────────────────────────
   Styled divider.
──────────────────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* ── SCROLLBAR ──────────────────────────────────────────────────
   Custom scrollbar for webkit browsers.
──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ── SELECTION ──────────────────────────────────────────────────
   Custom text selection color.
──────────────────────────────────────────────────────────────── */
::selection {
  background: var(--color-accent-dim);
  color: var(--color-text-primary);
}

/* ── FOCUS MANAGEMENT ───────────────────────────────────────────
   Remove focus ring for mouse users; keep for keyboard users.
──────────────────────────────────────────────────────────────── */
:focus:not(:focus-visible) {
  outline: none;
}

/* ── REDUCED MOTION ─────────────────────────────────────────────
   Respect user's motion preferences.
──────────────────────────────────────────────────────────────── */
@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;
  }
}
