/**
 * Base Styles - Reset & Typography
 */

/* ==========================================================================
   MODERN CSS RESET
   ========================================================================== */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--theme-text);
  background-color: var(--theme-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--theme-text-heading);
  margin-bottom: var(--space-4);
}

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

p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
}

.lead {
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--theme-text-muted);
}

/* Center paragraphs within text-center containers */
.text-center p,
.text-center .lead {
  margin-inline: auto;
}

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

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

a:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

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

small {
  font-size: var(--text-sm);
}

/* ==========================================================================
   LISTS
   ========================================================================== */

ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

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

/* ==========================================================================
   IMAGES & MEDIA
   ========================================================================== */

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--theme-text-muted);
  margin-top: var(--space-2);
}

/* ==========================================================================
   FORMS
   ========================================================================== */

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

input,
textarea,
select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background-color: var(--theme-bg);
  border: var(--border-width) solid var(--theme-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px rgba(27, 90, 125, 0.25);
}

label {
  display: block;
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
}

/* ==========================================================================
   TABLES
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: var(--border-width) solid var(--theme-border);
}

th {
  font-weight: var(--font-semibold);
  background-color: var(--theme-bg-alt);
}

/* ==========================================================================
   CODE
   ========================================================================== */

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

code {
  background-color: var(--theme-bg-alt);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--theme-bg-alt);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  background: none;
  padding: 0;
}

/* ==========================================================================
   HORIZONTAL RULE
   ========================================================================== */

hr {
  border: 0;
  height: var(--border-width);
  background-color: var(--theme-border);
  margin: var(--space-8) 0;
}

/* ==========================================================================
   BLOCKQUOTE
   ========================================================================== */

blockquote {
  border-left: 4px solid var(--theme-accent);
  padding-left: var(--space-6);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--theme-text-muted);
}

blockquote cite {
  display: block;
  margin-top: var(--space-2);
  font-style: normal;
  font-weight: var(--font-medium);
  color: var(--theme-text);
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

/* Section Spacing */
.section {
  padding-block: var(--section-padding);
}

.section--alt {
  background-color: var(--theme-bg-alt);
}

.section--dark {
  background-color: var(--color-gray-900);
  color: var(--color-gray-200);
}

.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-white);
}

/* Main content area */
.site-main {
  flex: 1;
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Screen reader only */
.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;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--theme-accent);
  color: var(--color-black);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-2);
}

/* Focus visible for keyboard navigation */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 2px;
}

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