/**
 * NUGUI Typography System
 * Comprehensive typography with responsive scaling and accessibility
 * Combines Apple-inspired design with modern responsive techniques
 */

/* ========================================
   FONT FAMILIES & BASE TYPOGRAPHY
   ======================================== */
:root {
  /* Font Families - Apple System Fonts */
  --font-family-primary: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-family-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-heavy: 800;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* Responsive Font Sizes - Improved scaling */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8rem);      /* 12-13px */
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);    /* 13-14px */
  --text-base: clamp(0.925rem, 0.875rem + 0.25vw, 1rem);   /* 15-16px */
  --text-lg: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);      /* 16-18px */
  --text-xl: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);  /* 18-20px */
  --text-2xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);     /* 20-24px */
  --text-3xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);   /* 24-30px */
  --text-4xl: clamp(1.75rem, 1.5rem + 1.25vw, 2.25rem);    /* 28-36px */
  --text-5xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);           /* 32-48px */
  --text-6xl: clamp(2.5rem, 2rem + 2.5vw, 3.75rem);        /* 40-60px */
}

/* ========================================
   BASE TEXT ELEMENTS
   ======================================== */
body {
  font-family: var(--font-family-primary);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   HEADINGS - Hierarchical System
   ======================================== */
h1, .h1 {
  font-family: var(--font-family-display);
  font-size: var(--text-6xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

h2, .h2 {
  font-family: var(--font-family-display);
  font-size: var(--text-4xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

h3, .h3 {
  font-family: var(--font-family-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

h4, .h4 {
  font-family: var(--font-family-display);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  margin-bottom: 0.5rem;
}

h5, .h5 {
  font-family: var(--font-family-display);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  margin-bottom: 0.5rem;
}

h6, .h6 {
  font-family: var(--font-family-display);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   PARAGRAPH & TEXT ELEMENTS
   ======================================== */
p {
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  margin-bottom: 1rem;
}

.lead {
  font-size: var(--text-xl);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-normal);
  color: var(--color-text-secondary);
}

.text-large {
  font-size: var(--text-lg);
  line-height: var(--line-height-relaxed);
}

.text-small {
  font-size: var(--text-sm);
  line-height: var(--line-height-normal);
}

.text-xs {
  font-size: var(--text-xs);
  line-height: var(--line-height-normal);
}

/* ========================================
   LINKS
   ======================================== */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

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

/* ========================================
   LISTS
   ======================================== */
ul, ol {
  font-size: var(--text-base);
  line-height: var(--line-height-relaxed);
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ========================================
   CODE & MONOSPACE
   ======================================== */
code {
  font-family: var(--font-family-mono);
  font-size: 0.85em;
  background: var(--color-surface-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: var(--border-radius-sm);
}

pre {
  font-family: var(--font-family-mono);
  font-size: var(--text-sm);
  line-height: var(--line-height-relaxed);
  background: var(--color-surface-secondary);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.leading-tight { line-height: var(--line-height-tight); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }

.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.italic { font-style: italic; }
.not-italic { font-style: normal; }

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
  /* Better line height for readability on small screens */
  p, li {
    line-height: var(--line-height-relaxed);
  }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Ensure minimum readable sizes */
  body {
    font-size: max(16px, 1rem);
  }
  
  p, li, td {
    font-size: max(14px, 0.875rem);
  }
}

/* ========================================
   CARD & COMPONENT TYPOGRAPHY
   ======================================== */

/* Feature & Solution Cards */
.feature-card h3,
.solution-card h3,
.product-card h3 {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem) !important;  /* 18-22px */
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.feature-card p,
.solution-card p,
.product-card p {
  font-size: clamp(0.875rem, 0.825rem + 0.25vw, 0.95rem) !important;  /* 14-15px */
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

/* Process Cards - Smaller text */
.process-card h3 {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem) !important;  /* 16-18px */
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.process-card p {
  font-size: clamp(0.8rem, 0.775rem + 0.125vw, 0.875rem) !important;  /* 13-14px */
  line-height: 1.4;
  color: var(--color-text-secondary);
}

/* Mini Feature Cards - Compact sizing */
.mini-feature-card h4 {
  font-size: clamp(0.875rem, 0.85rem + 0.125vw, 0.95rem) !important;  /* 14-15px */
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.mini-feature-card p {
  font-size: clamp(0.75rem, 0.725rem + 0.125vw, 0.825rem) !important;  /* 12-13px */
  line-height: 1.4;
  color: var(--color-text-secondary);
}

/* Team Cards */
.team-card h3 {
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem) !important;  /* 15-17px */
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.team-card .role {
  font-size: clamp(0.75rem, 0.725rem + 0.125vw, 0.825rem) !important;  /* 12-13px */
  font-weight: 500;
  color: var(--color-accent);
}

/* Hero sections - reduced sizes */
.hero-title,
.hero h1 {
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3.5rem) !important;  /* 32-56px */
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.hero-subtitle,
.hero p.lead {
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.25rem) !important;  /* 16-20px */
  line-height: 1.5;
  font-weight: 400;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

/* Section headers - better hierarchy */
.section-title,
section h2 {
  font-size: clamp(1.5rem, 1.25rem + 1.25vw, 2.25rem) !important;  /* 24-36px */
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.section-subtitle,
section p.lead {
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.125rem) !important;  /* 15-18px */
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
}

/* ========================================
   DARK MODE TYPOGRAPHY ADJUSTMENTS
   ======================================== */
[data-theme="dark"] {
  /* Slightly lighter text weight in dark mode for better readability */
  color: rgba(255, 255, 255, 0.87);
}

[data-theme="dark"] p,
[data-theme="dark"] li {
  color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .text-secondary {
  color: rgba(255, 255, 255, 0.6);
}