/* ==========================================================================
   Typography - Mobile-First & Readability Optimized
   ========================================================================== */

/* ========================================
   Body Text - Mobile-First Base
   ======================================== */
body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);  /* 16px minimum on mobile */
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);  /* 1.5 for optimal readability */
  color: var(--color-text-primary);
  /* Prevent text from appearing too wide on large screens */
  max-width: 100%;
}

/* ========================================
   Headings - Responsive Hierarchy
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);  /* 1.2 for headings */
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
  /* Improve readability on narrow screens */
  overflow-wrap: break-word;
  hyphens: auto;
}

h1 {
  font-size: var(--font-size-3xl);  /* 36px -> 64px */
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: var(--font-size-2xl);  /* 32px -> 56px */
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: var(--font-size-xl);  /* 24px -> 36px */
  line-height: 1.3;
}

h4 {
  font-size: var(--font-size-lg);  /* 18px -> 24px */
  line-height: 1.4;
}

h5, h6 {
  font-size: var(--font-size-base);  /* 16px -> 18px */
  line-height: var(--line-height-normal);
}

/* ========================================
   Paragraphs - Optimal Reading Experience
   ======================================== */
p {
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-relaxed);  /* 1.6 for body text */
  /* Limit line length for better readability on desktop */
  max-width: 75ch;  /* 65-75 characters is optimal */
  overflow-wrap: break-word;
}

p:last-child {
  margin-bottom: 0;
}

/* Long-form content readability */
.content p,
.article p {
  line-height: var(--line-height-loose);  /* 1.7 for long-form content */
}

/* ========================================
   Links - Accessible & Clear
   ======================================== */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

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

/* Underlined links in body text for clarity */
p a,
li a {
  color: var(--color-accent-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

p a:hover,
li a:hover {
  text-decoration-thickness: 2px;
}

/* ========================================
   Blockquote - Emphasized Content
   ======================================== */
blockquote {
  position: relative;
  padding: var(--spacing-xl);
  margin: var(--spacing-2xl) 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-relaxed);
  background-color: var(--color-bg-secondary);
  border-left: 4px solid var(--color-accent-primary);
  border-radius: var(--border-radius-sm);
  max-width: 75ch;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Lists - Improved Readability
   ======================================== */
/* Reset for semantic lists */
article ul,
article ol,
.content ul,
.content ol {
  list-style-position: outside;
  padding-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-relaxed);
}

article ul,
.content ul {
  list-style-type: disc;
}

article ol,
.content ol {
  list-style-type: decimal;
}

article li,
.content li {
  margin-bottom: var(--spacing-xs);
}

/* ========================================
   Small Text & Fine Print
   ======================================== */
small,
.text-small {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
}

/* ========================================
   Strong & Emphasis
   ======================================== */
strong,
b {
  font-weight: var(--font-weight-bold);
}

em,
i {
  font-style: italic;
}

/* ========================================
   Utility Classes
   ======================================== */
/* Font Weights */
.text-light { font-weight: var(--font-weight-light); }
.text-regular { font-weight: var(--font-weight-regular); }
.text-medium { font-weight: var(--font-weight-medium); }
.text-semibold { font-weight: var(--font-weight-semibold); }
.text-bold { font-weight: var(--font-weight-bold); }

/* Colors */
.text-accent { color: var(--color-accent-primary); }
.text-muted { color: rgba(34, 34, 34, 0.7); }

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

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

/* Line Heights */
.leading-tight { line-height: var(--line-height-tight); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }
.leading-loose { line-height: var(--line-height-loose); }

/* Text Transforms */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* Text Decoration */
.no-underline { text-decoration: none; }
.underline { text-decoration: underline; }

/* ========================================
   Responsive Typography Adjustments
   ======================================== */
/* Ensure centered text blocks don't become too wide */
.text-center p {
  margin-left: auto;
  margin-right: auto;
}