/* ==========================================================================
   Typography Utilities
   ========================================================================== */

/* ===== BASE TYPOGRAPHY ===== */

html {
  font-family: var(--font-family-primary);
  font-size: 100%; /* 16px base */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--background);
}

/* ===== HEADINGS ===== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin: 0 0 var(--space-4) 0;
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: var(--letter-spacing-tight);
}

h2 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
}

h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
}

h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

h5 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
}

h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* ===== PARAGRAPHS & TEXT ===== */

p {
  margin: 0 0 var(--space-4) 0;
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

/* Lead text */
.lead {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
}

/* Small text */
small,
.small {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* ===== LINKS ===== */

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ===== LISTS ===== */

ul,
ol {
  margin: 0 0 var(--space-4) 0;
  padding-left: var(--space-5);
}

ul ul,
ul ol,
ol ul,
ol ol {
  margin-bottom: 0;
}

li {
  margin-bottom: var(--space-1);
  line-height: var(--line-height-relaxed);
}

li:last-child {
  margin-bottom: 0;
}

/* Reset list styles */
.list-none {
  list-style: none;
  padding-left: 0;
}

/* ===== EMPHASIS & FORMATTING ===== */

strong,
b {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

em,
i {
  font-style: italic;
}

mark {
  background-color: var(--accent-orange);
  color: var(--text-primary);
  padding: 0.1em 0.2em;
  border-radius: var(--radius-sm);
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.875em;
  background-color: var(--neutral-100);
  color: var(--text-primary);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-family-mono);
  background-color: var(--neutral-100);
  color: var(--text-primary);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0 0 var(--space-4) 0;
}

pre code {
  background: none;
  padding: 0;
}

/* ===== BLOCKQUOTES ===== */

blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--primary-500);
  background-color: var(--neutral-50);
  font-style: italic;
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ===== UTILITY CLASSES ===== */

/* 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); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }

/* Font Weights */
.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }

/* Line Heights */
.leading-tight { line-height: var(--line-height-tight); }
.leading-snug { line-height: var(--line-height-snug); }
.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 Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-disabled { color: var(--text-disabled); }
.text-inverse { color: var(--text-inverse); }

/* Brand Colors */
.text-brand { color: var(--primary-600); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Text Transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* Letter Spacing */
.tracking-tighter { letter-spacing: var(--letter-spacing-tighter); }
.tracking-tight { letter-spacing: var(--letter-spacing-tight); }
.tracking-normal { letter-spacing: var(--letter-spacing-normal); }
.tracking-wide { letter-spacing: var(--letter-spacing-wide); }
.tracking-wider { letter-spacing: var(--letter-spacing-wider); }
.tracking-widest { letter-spacing: var(--letter-spacing-widest); }

/* Text Decoration */
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

/* Text Overflow */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis {
  text-overflow: ellipsis;
}

.text-clip {
  text-overflow: clip;
}

/* Whitespace */
.whitespace-normal { white-space: normal; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre { white-space: pre; }
.whitespace-pre-line { white-space: pre-line; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* Word Break */
.break-normal {
  overflow-wrap: normal;
  word-break: normal;
}

.break-words {
  overflow-wrap: break-word;
}

.break-all {
  word-break: break-all;
}

/* ===== GRADIENT TEXT EFFECTS ===== */

.text-gradient {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-hero {
  background: linear-gradient(135deg, var(--primary-600), var(--accent-green), var(--primary-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-accent {
  background: linear-gradient(135deg, var(--accent-green), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */

@media (min-width: 48rem) { /* 768px */
  .sm\\:text-xs { font-size: var(--font-size-xs); }
  .sm\\:text-sm { font-size: var(--font-size-sm); }
  .sm\\:text-base { font-size: var(--font-size-base); }
  .sm\\:text-lg { font-size: var(--font-size-lg); }
  .sm\\:text-xl { font-size: var(--font-size-xl); }
  .sm\\:text-2xl { font-size: var(--font-size-2xl); }
  .sm\\:text-3xl { font-size: var(--font-size-3xl); }
  .sm\\:text-4xl { font-size: var(--font-size-4xl); }
  .sm\\:text-5xl { font-size: var(--font-size-5xl); }
  
  .sm\\:text-center { text-align: center; }
  .sm\\:text-left { text-align: left; }
  .sm\\:text-right { text-align: right; }
}

@media (min-width: 64rem) { /* 1024px */
  .md\\:text-xs { font-size: var(--font-size-xs); }
  .md\\:text-sm { font-size: var(--font-size-sm); }
  .md\\:text-base { font-size: var(--font-size-base); }
  .md\\:text-lg { font-size: var(--font-size-lg); }
  .md\\:text-xl { font-size: var(--font-size-xl); }
  .md\\:text-2xl { font-size: var(--font-size-2xl); }
  .md\\:text-3xl { font-size: var(--font-size-3xl); }
  .md\\:text-4xl { font-size: var(--font-size-4xl); }
  .md\\:text-5xl { font-size: var(--font-size-5xl); }
  
  .md\\:text-center { text-align: center; }
  .md\\:text-left { text-align: left; }
  .md\\:text-right { text-align: right; }
}

@media (min-width: 90rem) { /* 1440px */
  .lg\\:text-xs { font-size: var(--font-size-xs); }
  .lg\\:text-sm { font-size: var(--font-size-sm); }
  .lg\\:text-base { font-size: var(--font-size-base); }
  .lg\\:text-lg { font-size: var(--font-size-lg); }
  .lg\\:text-xl { font-size: var(--font-size-xl); }
  .lg\\:text-2xl { font-size: var(--font-size-2xl); }
  .lg\\:text-3xl { font-size: var(--font-size-3xl); }
  .lg\\:text-4xl { font-size: var(--font-size-4xl); }
  .lg\\:text-5xl { font-size: var(--font-size-5xl); }
  
  .lg\\:text-center { text-align: center; }
  .lg\\:text-left { text-align: left; }
  .lg\\:text-right { text-align: right; }
}