/* =============================================================================
   Base Styles - Typography, Resets, Global Elements
   ============================================================================= */

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

html {
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
}

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

/* Base Typography */
body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  color: var(--ink);
}

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

/* Text Elements */
p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
  font-size: var(--text-base);
  line-height: 1.6;
}

.text-large {
  font-size: var(--text-lg);
  line-height: 1.6;
}

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

.text-muted {
  color: var(--muted);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

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

.list-unstyled {
  list-style: none;
  padding-left: 0;
}

.list-inline {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

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

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

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

/* Forms */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

input, textarea, select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #E5E7EB;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-out);
  background: var(--bg);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.1);
}

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

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

th, td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid #E5E7EB;
}

th {
  font-weight: 600;
  background: var(--bg-soft);
}

/* Utility Classes */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.hidden { display: none !important; }
.block { display: block !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }
.inline-flex { display: inline-flex !important; }

.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }

.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-start { justify-content: flex-start !important; }

.gap-1 { gap: var(--space-1) !important; }
.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }
.gap-6 { gap: var(--space-6) !important; }
.gap-8 { gap: var(--space-8) !important; }

.w-full { width: 100% !important; }
.h-full { height: 100% !important; }

.m-0 { margin: 0 !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mr-4 { margin-right: var(--space-4) !important; }
.ml-4 { margin-left: var(--space-4) !important; }

.p-0 { padding: 0 !important; }
.p-4 { padding: var(--space-4) !important; }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

/* High Contrast Support */
@media (prefers-contrast: high) {
  :root {
    --ink: #000000;
    --bg: #FFFFFF;
    --muted: #333333;
    --primary: #0000EE;
  }
  
  input, textarea, select {
    border-width: 3px;
  }
  
  a {
    text-decoration: underline;
  }
}

/* Print Styles */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000000;
    background: #FFFFFF;
  }
  
  .no-print {
    display: none !important;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}
