/* ============================================
   BASE STYLES
   Typography, Common Elements, Utilities
   ============================================ */

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

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition-base), color var(--transition-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
}

/* Responsive Typography */
@media (min-width: 768px) {
  h1 {
    font-size: var(--text-5xl);
  }

  h2 {
    font-size: var(--text-4xl);
  }

  h3 {
    font-size: var(--text-3xl);
  }
}

@media (min-width: 1025px) {
  h1 {
    font-size: var(--text-6xl);
  }
}

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

a {
  color: var(--color-primary-600);
  transition: color var(--transition-fast);
}

a:hover:not(.btn):not([class*="btn-"]):not([class*="course-"]):not([class*="hero-"]):not([class*="modal-"]) {
  color: var(--color-primary-700);
}

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

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

em, i {
  font-style: italic;
}

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

/* ===== BRAND TEXT ===== */

.brand-kwick {
  color: var(--color-primary-500);
  font-weight: var(--font-bold);
}

.brand-prep {
  color: var(--text-primary);
  font-weight: var(--font-bold);
}

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

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

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

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

/* ===== IMAGES ===== */

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

/* ===== CONTAINER ===== */

.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1025px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* ===== SECTIONS ===== */

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section-lg {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.section-xl {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

@media (min-width: 1025px) {
  .section {
    padding-top: var(--space-16);
    padding-bottom: var(--space-16);
  }

  .section-lg {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
  }

  .section-xl {
    padding-top: var(--space-32);
    padding-bottom: var(--space-32);
  }
}

/* ===== UTILITY CLASSES ===== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-brand { color: var(--color-primary-600); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-white { color: #ffffff; }

/* Font Weights */
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

/* Font Sizes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

/* Spacing Utilities */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.pt-4 { padding-top: var(--space-4); }
.pt-8 { padding-top: var(--space-8); }
.pt-12 { padding-top: var(--space-12); }

.pb-4 { padding-bottom: var(--space-4); }
.pb-8 { padding-bottom: var(--space-8); }
.pb-12 { padding-bottom: var(--space-12); }

/* Display Utilities */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex Utilities */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Width Utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-full { max-width: 100%; }

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

/* Focus Visible (for keyboard navigation) */
*:focus-visible {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 2px;
}

/* ============================================
   MOBILE-FIRST RESPONSIVE BASE STYLES
   ============================================ */

/* Prevent horizontal scroll on all screens */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* Mobile: Reduce section padding */
@media (max-width: 767px) {
  .section {
    padding-top: var(--mobile-space-xl);
    padding-bottom: var(--mobile-space-xl);
  }

  .section-lg {
    padding-top: calc(var(--mobile-space-xl) * 1.5);
    padding-bottom: calc(var(--mobile-space-xl) * 1.5);
  }

  .section-xl {
    padding-top: calc(var(--mobile-space-xl) * 2);
    padding-bottom: calc(var(--mobile-space-xl) * 2);
  }

  /* Mobile typography adjustments */
  h1 { font-size: var(--mobile-text-2xl); line-height: var(--leading-tight); }
  h2 { font-size: var(--mobile-text-xl); line-height: var(--leading-tight); }
  h3 { font-size: var(--mobile-text-lg); line-height: var(--leading-snug); }
  h4 { font-size: var(--mobile-text-base); line-height: var(--leading-snug); }

  /* Reduce paragraph spacing on mobile */
  p { margin-bottom: var(--mobile-space-md); }
}

/* Mobile: Ensure all media is responsive */
@media (max-width: 767px) {
  img, video, iframe, embed {
    max-width: 100%;
    height: auto;
  }

  /* Allow flex/grid containers to shrink */
  .container, [class*="grid"], [class*="flex"] {
    min-width: 0;
  }
}

/* Small mobile refinements (<=480px) */
@media (max-width: 480px) {
  body {
    font-size: var(--mobile-text-base);
    line-height: var(--leading-normal);
  }

  h1 { font-size: var(--mobile-text-xl); }
  h2 { font-size: var(--mobile-text-lg); }
  h3 { font-size: var(--mobile-text-base); }

  .container {
    padding-left: var(--mobile-space-sm);
    padding-right: var(--mobile-space-sm);
  }
}

/* Force large inline containers to stay fluid on tablet/mobile */
@media (max-width: 1024px) {
  [style*="max-width: 1280px"],
  [style*="max-width: 1200px"],
  [style*="max-width: 1100px"],
  [style*="max-width: 1024px"],
  [style*="max-width: 1000px"],
  [style*="max-width: 900px"],
  [style*="max-width: 800px"],
  [style*="width: 1200px"],
  [style*="width: 1100px"],
  [style*="width: 1000px"] {
    max-width: min(100%, 94vw) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}
