/**
 * base.css — Reset & Global Base Styles
 * =======================================
 * Sensible defaults, typography base, and global element styles.
 */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Prevent layout shift when scrollbar appears */
  scrollbar-gutter: stable;
}

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);
  /* Smooth theme transitions */
  transition:
    background-color var(--transition-slow),
    color var(--transition-slow);
  /* Offset for fixed header */
  padding-top: var(--header-height);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 { font-size: clamp(var(--text-4xl), 6vw, var(--text-7xl)); }
h2 { font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl)); }
h3 { font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  max-width: 68ch;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

code, pre, kbd {
  font-family: var(--font-mono);
}

code {
  font-size: 0.9em;
  background: var(--color-bg-raised);
  color: var(--color-accent-light);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

pre {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text);
}

strong { font-weight: 600; color: var(--color-text); }
em     { font-style: italic; }

ul, ol {
  padding-left: var(--space-6);
  color: var(--color-text-muted);
}

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

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

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

/* ── Scrollbar Styling (Webkit) ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: var(--color-border-bright);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ── Selection ───────────────────────────────────────────────────────────── */
::selection {
  background: var(--color-accent-glow);
  color: var(--color-text);
}

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