/* Typography System - ADHD-Friendly Design */
/* Part of UI/UX Audit Recommendation #3: Fix Typography Hierarchy */

/* Base Typography Settings */
body {
    font-family: 'Lexend', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Heading Hierarchy - Consistent Across Application */

h1, .h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 var(--space-4) 0;
    letter-spacing: -0.02em;
}

h2, .h2 {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 var(--space-3) 0;
    letter-spacing: -0.01em;
}

h3, .h3 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 var(--space-3) 0;
}

h4, .h4 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 var(--space-2) 0;
}

h5, .h5 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 var(--space-2) 0;
}

h6, .h6 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    margin: 0 0 var(--space-2) 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Body Text Variants */

.text-body {
    font-size: 16px;
    line-height: 1.6;
    font-weight: 400;
}

.text-body-large {
    font-size: 18px;
    line-height: 1.6;
    font-weight: 400;
}

.text-body-small {
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.text-caption {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Font Weight Utilities */

.font-light {
    font-weight: 300;
}

.font-regular {
    font-weight: 400;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

/* Text Color Utilities */

.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

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

/* Text Alignment */

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Line Height Utilities - ADHD-Friendly Spacing */

.leading-tight {
    line-height: 1.25;
}

.leading-normal {
    line-height: 1.5;
}

.leading-relaxed {
    line-height: 1.75;  /* Better for reading comprehension */
}

.leading-loose {
    line-height: 2.0;  /* Maximum readability */
}

/* Letter Spacing - Improves Readability for ADHD */

.tracking-tight {
    letter-spacing: -0.02em;
}

.tracking-normal {
    letter-spacing: 0;
}

.tracking-wide {
    letter-spacing: 0.025em;  /* Helps with letter differentiation */
}

.tracking-wider {
    letter-spacing: 0.05em;
}

/* Reading-Optimized Text */

.text-readable {
    line-height: 1.8;
    letter-spacing: 0.01em;
    max-width: 65ch;  /* Optimal line length for reading */
}

/* Display Text - For Hero Sections */

.display-1 {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.display-2 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.display-3 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* ADHD-Specific Typography Enhancements */

/* High-contrast text for focus items */
.text-emphasis {
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-purple), #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Reduced motion preference support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Increased contrast for better readability */
@media (prefers-contrast: high) {
    body {
        color: #FFFFFF;
    }

    .text-secondary,
    .text-muted {
        color: #CCCCCC;
    }
}

/* Mobile Typography Adjustments */
@media (max-width: 768px) {
    h1, .h1 {
        font-size: 28px;
    }

    h2, .h2 {
        font-size: 22px;
    }

    h3, .h3 {
        font-size: 18px;
    }

    h4, .h4 {
        font-size: 16px;
    }

    .display-1 {
        font-size: 36px;
    }

    .display-2 {
        font-size: 32px;
    }

    .display-3 {
        font-size: 28px;
    }

    /* Increase base font size on mobile for better readability */
    body {
        font-size: 16px;
    }
}

/* Truncation Utilities */

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

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

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

/* Link Styling */

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-purple);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Code and Technical Text */

code, .code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875em;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--accent-purple);
}

pre {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    background: var(--bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    line-height: 1.5;
}

/* Lists */

ul, ol {
    margin: 0 0 var(--space-4) 0;
    padding-left: var(--space-6);
}

li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

/* Blockquotes */

blockquote {
    margin: var(--space-4) 0;
    padding-left: var(--space-4);
    border-left: 4px solid var(--accent-purple);
    font-style: italic;
    color: var(--text-secondary);
}

/* Horizontal Rule */

hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: var(--space-6) 0;
}

/* Selection Styling */

::selection {
    background: var(--accent-purple);
    color: white;
}

::-moz-selection {
    background: var(--accent-purple);
    color: white;
}

/* Placeholder Styling */

::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Focus Visible for Keyboard Navigation */

:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 2px;
}
