/* ==========================================================================
   TYPOGRAPHY SYSTEM - Community & Forum Consistency
   ========================================================================== */

:root {
    /* Font Families */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-code: 'Courier New', Courier, monospace;
    
    /* Font Sizes */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */
    --font-size-5xl: 3rem;      /* 48px */
    
    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    --line-height-loose: 2;
    
    /* Colors */
    --color-text-primary: #2d3748;
    --color-text-secondary: #ffffff;
    --color-text-muted: #718096;
    --color-text-light: #a0aec0;
    --color-link: #667eea;
    --color-link-hover: #5a67d8;
    --color-heading: #1a202c;
}

/* ==========================================================================
   Base Typography
   ========================================================================== */

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-heading);
    margin-bottom: 0.75rem;
}

h1, .h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: 1rem;
}

h2, .h2 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
}

h3, .h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
}

h4, .h4 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

h5, .h5 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
}

h6, .h6 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Paragraphs */
p {
    margin-bottom: 1rem;
    line-height: var(--line-height-relaxed);
}

p.lead {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-light);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
}

/* Links */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* Text Utilities */
.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-primary { color: var(--color-text-primary) }
.text-secondary { color: var(--color-text-secondary)  }
.text-muted { color: var(--color-text-muted)  }
.text-light { color: var(--color-text-light)  }

.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); }

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
    line-height: var(--line-height-relaxed);
}

/* Code */
code, pre {
    font-family: var(--font-code);
    font-size: 0.9em;
}

code {
    background: #f7fafc;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: #e53e3e;
}

pre {
    background: #2d3748;
    color: #f7fafc;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

/* Blockquote */
blockquote {
    border-left: 4px solid var(--color-link);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* ==========================================================================
   Community-Specific Typography
   ========================================================================== */

/* Forum Post Content */
.forum-post-content {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-primary);
}

.forum-post-content h1 { font-size: var(--font-size-2xl); margin-top: 2rem; }
.forum-post-content h2 { font-size: var(--font-size-xl); margin-top: 1.5rem; }
.forum-post-content h3 { font-size: var(--font-size-lg); margin-top: 1rem; }

/* Forum Topic Title */
.forum-topic-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-heading);
    line-height: var(--line-height-tight);
}

/* Forum Meta Text */
.forum-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    line-height: var(--line-height-normal);
}

/* User Profile Names */
.user-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

.user-title {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-normal);
}

/* Card Titles */
.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
    margin-bottom: 0.75rem;
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-normal);
}

/* Badges & Tags */
.badge-text {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons Text */
.btn {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

.btn-sm {
    font-size: var(--font-size-sm);
}

.btn-lg {
    font-size: var(--font-size-lg);
}

/* ==========================================================================
   Responsive Typography
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --font-size-4xl: 1.875rem;  /* 30px */
        --font-size-3xl: 1.5rem;    /* 24px */
        --font-size-2xl: 1.25rem;   /* 20px */
    }
    
    body {
        font-size: 0.9375rem;  /* 15px */
    }
    
    .forum-topic-title {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 576px) {
    :root {
        --font-size-4xl: 1.5rem;    /* 24px */
        --font-size-3xl: 1.25rem;   /* 20px */
        --font-size-2xl: 1.125rem;  /* 18px */
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* 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;
}

/* Text Selection */
::selection {
    background: var(--color-link);
    color: white;
}
