/* ========================================
   BASE STYLES
   Typography, Reset, Global Styles
   ======================================== */

/* ===== BOX SIZING RESET ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ===== ROOT & BODY ===== */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--gray-800);
  background-color: var(--white);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--space-4);
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--white-color);
}

h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
}

h2 {
  font-size: var(--fs-3xl);
}

h3 {
  font-size: var(--fs-2xl);
}

h4 {
  font-size: var(--fs-xl);
}

h5 {
  font-size: var(--fs-lg);
}

h6 {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}

/* Responsive Typography */
@media (max-width: 991px) {
  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  h3 { font-size: var(--fs-xl); }
}

@media (max-width: 575px) {
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
  h3 { font-size: var(--fs-lg); }
}

/* Paragraphs */
p {
  margin-top: 0;
  margin-bottom: var(--space-4);
  line-height: var(--lh-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--primary-dark);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--space-4);
  padding-left: var(--space-8);
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--lh-relaxed);
}

/* Remove list styles for navigation */
nav ul,
nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav li {
  margin: 0;
}

/* ===== TEXT UTILITIES ===== */
.text-muted {
  color: var(--light-gray);
}

.text-small {
  font-size: var(--fs-sm);
}

.text-large {
  font-size: var(--fs-md);
}

.fw-light { font-weight: var(--fw-light); }
.fw-normal { font-weight: var(--fw-normal); }
.fw-medium { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold { font-weight: var(--fw-bold); }

/* ===== IMAGES ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

svg {
  max-width: 100%;
  height: auto;
}

/* ===== BUTTONS RESET ===== */
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

button:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== FORMS ===== */
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ===== HR ===== */
hr {
  margin: var(--space-8) 0;
  border: 0;
  border-top: 1px solid var(--gray-300);
}

/* ===== SELECTION ===== */
::selection {
  background-color: var(--primary-light);
  color: var(--white);
}

::-moz-selection {
  background-color: var(--primary-light);
  color: var(--white);
}

/* ===== SCROLLBAR (Webkit only) ===== */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ===== FOCUS INDICATORS ===== */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: var(--white);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* ===== PRINT STYLES ===== */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
