/* ==========================================================================
   SERENA HEALTH - TYPOGRAPHY SYSTEM
   ========================================================================== */

/* ==========================================================================
   1. FONT IMPORTS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Montserrat:wght@600;700&family=Playfair+Display:wght@400;600;700&display=swap');

/* ==========================================================================
   2. BASE TYPOGRAPHY
   ========================================================================== */

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

body {
  font-family: var(--font-family-body);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   3. HEADING SCALES
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.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(--color-text-primary);
  margin-top: 0;
  margin-bottom: var(--spacing-2);
}

h1, .h1 {
  font-size: 3rem;
  letter-spacing: var(--letter-spacing-tight);
}

h2, .h2 {
  font-size: 2.25rem;
  letter-spacing: var(--letter-spacing-tight);
}

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

h4, .h4 {
  font-size: 1.5rem;
}

h5, .h5 {
  font-size: 1.25rem;
}

h6, .h6 {
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
}

/* Paragraph Styles */
p {
  margin-top: 0;
  margin-bottom: var(--spacing-2);
}

/* Lead Paragraph */
.lead {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-loose);
  color: var(--color-text-secondary);
}

/* ==========================================================================
   4. LABELS & BADGES
   ========================================================================== */

.label,
.badge-text {
  font-family: var(--font-family-label);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  line-height: 1;
}

.label-lg {
  font-size: var(--font-size-sm);
}

/* Category/Tag Labels */
.category-label {
  font-family: var(--font-family-label);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-widest);
  color: var(--color-accent-purple);
}

/* ==========================================================================
   5. TEXT SIZE UTILITIES
   ========================================================================== */

.text-4xl { font-size: var(--font-size-4xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-xl { font-size: var(--font-size-xl); }
.text-lg { font-size: var(--font-size-lg); }
.text-large { font-size: var(--font-size-lg); }
.text-md { font-size: var(--font-size-md); }
.text-base { font-size: var(--font-size-base); }
.text-sm { font-size: var(--font-size-sm); }
.text-small { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

/* ==========================================================================
   6. TEXT WEIGHT UTILITIES
   ========================================================================== */

.text-normal { font-weight: var(--font-weight-normal); }
.text-medium { font-weight: var(--font-weight-medium); }
.text-semibold { font-weight: var(--font-weight-semibold); }
.text-bold { font-weight: var(--font-weight-bold); }

/* ==========================================================================
   7. TEXT ALIGNMENT UTILITIES
   ========================================================================== */

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

/* ==========================================================================
   8. TEXT COLOR UTILITIES
   ========================================================================== */

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-inverse { color: var(--color-text-inverse); }
.text-muted { color: var(--color-gray-500); }

.text-accent-pink { color: var(--color-accent-pink); }
.text-accent-purple { color: var(--color-accent-purple); }
.text-accent-blue { color: var(--color-accent-blue); }

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* ==========================================================================
   9. GRADIENT TEXT
   ========================================================================== */

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.text-gradient-pink-purple {
  background: linear-gradient(135deg, var(--color-accent-pink) 0%, var(--color-accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.text-gradient-purple-blue {
  background: linear-gradient(135deg, var(--color-accent-purple) 0%, var(--color-accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   10. LINE HEIGHT UTILITIES
   ========================================================================== */

.leading-none { line-height: 1; }
.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); }

/* ==========================================================================
   11. LETTER SPACING UTILITIES
   ========================================================================== */

.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); }

/* ==========================================================================
   12. TEXT TRANSFORM UTILITIES
   ========================================================================== */

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* ==========================================================================
   13. TEXT DECORATION UTILITIES
   ========================================================================== */

.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

/* Link with underline animation */
.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-standard);
}

.link-underline:hover::after {
  width: 100%;
}

/* ==========================================================================
   14. FONT FAMILY UTILITIES
   ========================================================================== */

.font-heading { font-family: var(--font-family-heading); }
.font-body { font-family: var(--font-family-body); }
.font-label { font-family: var(--font-family-label); }

/* ==========================================================================
   15. SPECIAL TEXT STYLES
   ========================================================================== */

/* Quote/Blockquote */
blockquote,
.blockquote {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-xl);
  font-style: italic;
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  padding-left: var(--spacing-3);
  border-left: 4px solid var(--color-accent-purple);
  margin: var(--spacing-4) 0;
}

/* Code/Monospace */
code,
.code {
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.875em;
  background-color: var(--color-gray-100);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
}

/* Small Text */
small,
.small {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

/* Strong/Bold */
strong,
.strong {
  font-weight: var(--font-weight-bold);
}

/* Emphasis */
em,
.emphasis {
  font-style: italic;
}

/* ==========================================================================
   16. LIST STYLES
   ========================================================================== */

ul, ol {
  margin-top: 0;
  margin-bottom: var(--spacing-2);
  padding-left: var(--spacing-3);
}

li {
  margin-bottom: var(--spacing-1);
}

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

.list-disc {
  list-style-type: disc;
}

.list-decimal {
  list-style-type: decimal;
}

/* ==========================================================================
   17. RESPONSIVE TYPOGRAPHY
   ========================================================================== */

/* Tablet and below */
@media (max-width: 1024px) {
  h1, .h1 {
    font-size: 2.5rem;
  }

  h2, .h2 {
    font-size: 2rem;
  }

  h3, .h3 {
    font-size: 1.5rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  body {
    font-size: var(--font-size-base);
    line-height: var(--line-height-loose);
  }

  h1, .h1 {
    font-size: 2rem;
    margin-bottom: var(--spacing-1-5);
  }

  h2, .h2 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-1-5);
  }

  h3, .h3 {
    font-size: 1.5rem;
  }

  h4, .h4 {
    font-size: 1.25rem;
  }

  h5, .h5 {
    font-size: 1.125rem;
  }

  h6, .h6 {
    font-size: 1rem;
  }

  .lead {
    font-size: var(--font-size-md);
  }

  blockquote,
  .blockquote {
    font-size: var(--font-size-lg);
    padding-left: var(--spacing-2);
  }

  /* Responsive text size utilities for mobile */
  .md\:text-4xl { font-size: var(--font-size-3xl); }
  .md\:text-3xl { font-size: var(--font-size-2xl); }
  .md\:text-2xl { font-size: var(--font-size-xl); }
}

/* Small mobile - ensure minimum readable size */
@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  h1, .h1 {
    font-size: 1.75rem;
  }

  h2, .h2 {
    font-size: 1.5rem;
  }

  h3, .h3 {
    font-size: 1.25rem;
  }

  /* Prevent text from being too small on small screens */
  p, li, span {
    min-font-size: 16px;
  }
}

/* ==========================================================================
   18. ACCESSIBILITY
   ========================================================================== */

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .link-underline::after {
    transition: none;
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  body {
    color: var(--color-black);
  }

  .text-secondary,
  .text-tertiary,
  .text-muted {
    color: var(--color-gray-800);
  }
}
