/**
* TYPOGRAPHY ENHANCEMENTS
* Premium typography system and text styling
* 2025/2026 Typography Best Practices
*/

/* ============================================
  TYPOGRAPHY SCALE
  ============================================ */
:root {
    --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-size-6xl: 3.75rem;    /* 60px */

    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;

    --letter-spacing-tighter: -0.05em;
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
    --letter-spacing-widest: 0.1em;
}

/* ============================================
  HEADING STYLES
  ============================================ */
h1, .h1 {
    font-size: var(--font-size-5xl);
    line-height: var(--line-height-tight);
    font-weight: 700;
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: 1rem;
}

h2, .h2 {
    font-size: var(--font-size-4xl);
    line-height: var(--line-height-snug);
    font-weight: 600;
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: 0.875rem;
}

h3, .h3 {
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-snug);
    font-weight: 600;
    letter-spacing: var(--letter-spacing-normal);
    margin-bottom: 0.75rem;
}

h4, .h4 {
    font-size: var(--font-size-2xl);
    line-height: var(--line-height-normal);
    font-weight: 600;
    margin-bottom: 0.625rem;
}

h5, .h5 {
    font-size: var(--font-size-xl);
    line-height: var(--line-height-normal);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

h6, .h6 {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-normal);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ============================================
  TEXT UTILITIES
  ============================================ */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
  READING OPTIMIZATION
  ============================================ */
.reading-content {
    max-width: 65ch;
    line-height: var(--line-height-relaxed);
    font-size: var(--font-size-lg);
}

.reading-content p {
    margin-bottom: 1.5rem;
}

.reading-content h2,
.reading-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* ============================================
  TEXT ANIMATIONS
  ============================================ */
.text-fade-in {
    animation: textFadeIn 0.6s ease-out;
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.text-slide-up {
    animation: textSlideUp 0.8s ease-out;
}

@keyframes textSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
  HIGHLIGHTING
  ============================================ */
.highlight {
    background: linear-gradient(120deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    padding: 0 4px;
    border-radius: 3px;
}

.highlight-gradient {
    background: linear-gradient(120deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* ============================================
  QUOTE STYLES
  ============================================ */
blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-color-light);
    position: relative;
}

blockquote::before {
    content: '"';
    font-size: 4rem;
    color: rgba(102, 126, 234, 0.2);
    position: absolute;
    left: 0.5rem;
    top: -1rem;
    line-height: 1;
}

blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-style: normal;
    color: var(--text-color-light);
}

blockquote cite::before {
    content: '— ';
}

/* ============================================
  CODE STYLES
  ============================================ */
code {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #667eea;
}

pre {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    line-height: var(--line-height-relaxed);
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
}

body.dark-mode pre {
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--dark-border-color);
}

/* ============================================
  LIST STYLES
  ============================================ */
ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

ul li, ol li {
    margin-bottom: 0.5rem;
    line-height: var(--line-height-relaxed);
}

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

ul.custom-list li {
    position: relative;
    padding-left: 1.5rem;
}

ul.custom-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* ============================================
  RESPONSIVE TYPOGRAPHY
  ============================================ */
@media (max-width: 768px) {
    h1, .h1 {
        font-size: var(--font-size-4xl);
    }

    h2, .h2 {
        font-size: var(--font-size-3xl);
    }

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

    .reading-content {
        font-size: var(--font-size-base);
    }
}

/* ============================================
  ACCESSIBILITY
  ============================================ */
@media (prefers-reduced-motion: reduce) {
    .text-fade-in,
    .text-slide-up {
        animation: none;
    }
}


/* Focus styles for accessibility - Auto-added */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}
