/**
 * TYPOGRAPHY SYSTEM
 * Comprehensive type scale and styles
 * Version 2.0.0
 *
 * Features:
 * - Fluid typography scales
 * - Consistent hierarchy
 * - Proper line heights and spacing
 * - Responsive type sizing
 * - Accessible contrast ratios
 */

/* ========================================
   BASE TYPOGRAPHY
   ======================================== */

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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(--neutral-900);
    letter-spacing: var(--letter-spacing-normal);
}

/* ========================================
   HEADINGS - Consistent Hierarchy
   ======================================== */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-black);
    line-height: var(--line-height-tight);
    color: var(--brand-navy-900);
    margin-top: 0;
    margin-bottom: var(--space-4);
    letter-spacing: var(--letter-spacing-tight);
}

h1, .h1 {
    font-size: var(--font-size-4xl);
    line-height: 1.1;
    letter-spacing: var(--letter-spacing-tighter);
    margin-bottom: var(--space-6);
}

h2, .h2 {
    font-size: var(--font-size-3xl);
    line-height: 1.15;
    letter-spacing: var(--letter-spacing-tighter);
    margin-bottom: var(--space-5);
}

h3, .h3 {
    font-size: var(--font-size-2xl);
    line-height: 1.2;
    letter-spacing: var(--letter-spacing-tight);
    margin-bottom: var(--space-4);
}

h4, .h4 {
    font-size: var(--font-size-xl);
    line-height: 1.25;
    margin-bottom: var(--space-4);
}

h5, .h5 {
    font-size: var(--font-size-lg);
    line-height: 1.3;
    margin-bottom: var(--space-3);
}

h6, .h6 {
    font-size: var(--font-size-md);
    line-height: 1.35;
    margin-bottom: var(--space-3);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
    font-weight: var(--font-weight-extrabold);
}

/* ========================================
   HEADING VARIANTS
   ======================================== */

/* Display headings - Extra large */
.display-1 {
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: var(--font-weight-black);
    line-height: 1;
    letter-spacing: -0.03em;
}

.display-2 {
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: var(--font-weight-black);
    line-height: 1.05;
    letter-spacing: -0.025em;
}

.display-3 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: var(--font-weight-black);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* Heading with accent */
.heading-accent {
    color: var(--brand-gold-900);
}

/* Heading with gradient */
.heading-gradient {
    background: linear-gradient(135deg, var(--brand-navy-900) 0%, var(--brand-navy-600) 50%, var(--brand-gold-900) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   PARAGRAPHS & BODY TEXT
   ======================================== */

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
    line-height: var(--line-height-relaxed);
}

p:last-child {
    margin-bottom: 0;
}

/* Lead paragraph */
.lead,
.intro-text {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-relaxed);
    font-weight: var(--font-weight-normal);
    color: var(--neutral-700);
    margin-bottom: var(--space-6);
}

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

/* Extra small text */
.text-xs {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-snug);
}

/* ========================================
   TEXT FORMATTING
   ======================================== */

/* Font weights */
.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); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }
.font-black { font-weight: var(--font-weight-black); }

/* Emphasis */
strong,
b,
.strong {
    font-weight: var(--font-weight-bold);
    color: var(--brand-navy-900);
}

em,
i,
.em {
    font-style: italic;
}

u,
.underline {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

mark,
.highlight {
    background-color: var(--brand-gold-100);
    color: var(--brand-navy-900);
    padding: 0.125em 0.25em;
    border-radius: var(--radius-sm);
}

del,
.strikethrough {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    opacity: 0.7;
}

/* ========================================
   TEXT TRANSFORMATIONS
   ======================================== */

.uppercase {
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
}

.lowercase {
    text-transform: lowercase;
}

.capitalize {
    text-transform: capitalize;
}

.normal-case {
    text-transform: none;
}

/* ========================================
   TEXT ALIGNMENT
   ======================================== */

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

/* ========================================
   TEXT COLORS
   ======================================== */

/* Brand colors */
.text-navy { color: var(--brand-navy-900) !important; }
.text-gold { color: var(--brand-gold-900) !important; }

/* Neutral colors */
.text-white { color: var(--neutral-white) !important; }
.text-black { color: var(--neutral-950) !important; }
.text-gray { color: var(--neutral-600) !important; }
.text-muted { color: var(--neutral-700) !important; }

/* Semantic colors */
.text-success { color: var(--success-700) !important; }
.text-error { color: var(--error-700) !important; }
.text-warning { color: var(--warning-700) !important; }
.text-info { color: var(--info-700) !important; }

/* ========================================
   LINE HEIGHT UTILITIES
   ======================================== */

.leading-none { line-height: 1; }
.leading-tight { line-height: var(--line-height-tight); }
.leading-snug { line-height: var(--line-height-snug); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }
.leading-loose { line-height: var(--line-height-loose); }

/* ========================================
   LETTER SPACING UTILITIES
   ======================================== */

.tracking-tighter { letter-spacing: var(--letter-spacing-tighter); }
.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); }

/* ========================================
   LISTS
   ======================================== */

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

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

li:last-child {
    margin-bottom: 0;
}

/* Unstyled lists */
.list-none,
.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.list-none li,
.list-unstyled li {
    margin-bottom: var(--space-3);
}

/* Inline lists */
.list-inline {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.list-inline li {
    margin-bottom: 0;
}

/* Custom list markers */
.list-checkmark li::before {
    content: "✓ ";
    color: var(--success-600);
    font-weight: var(--font-weight-bold);
    margin-right: var(--space-2);
}

.list-arrow li::before {
    content: "→ ";
    color: var(--brand-gold-900);
    font-weight: var(--font-weight-bold);
    margin-right: var(--space-2);
}

/* ========================================
   LINKS
   ======================================== */

a {
    color: var(--brand-navy-900);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: var(--transition-colors);
}

a:hover {
    color: var(--brand-navy-700);
    text-decoration-thickness: 3px;
}

a:active {
    color: var(--brand-gold-900);
}

/* Link variants */
.link-primary {
    color: var(--brand-navy-900);
}

.link-secondary {
    color: var(--brand-gold-900);
}

.link-muted {
    color: var(--neutral-600);
    text-decoration: none;
}

.link-muted:hover {
    color: var(--brand-navy-900);
    text-decoration: underline;
}

.link-unstyled {
    color: inherit;
    text-decoration: none;
}

.link-unstyled:hover {
    color: var(--brand-gold-900);
}

/* ========================================
   BLOCKQUOTES
   ======================================== */

blockquote {
    margin: var(--space-8) 0;
    padding: var(--space-6);
    padding-left: var(--space-8);
    border-left: 4px solid var(--brand-gold-900);
    background-color: var(--neutral-50);
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    font-style: italic;
    color: var(--neutral-800);
}

blockquote p:last-child {
    margin-bottom: 0;
}

blockquote cite {
    display: block;
    margin-top: var(--space-4);
    font-size: var(--font-size-sm);
    font-style: normal;
    font-weight: var(--font-weight-semibold);
    color: var(--neutral-600);
}

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

/* ========================================
   CODE & PREFORMATTED TEXT
   ======================================== */

code,
kbd,
samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 0.125em 0.375em;
    background-color: var(--neutral-100);
    border-radius: var(--radius-sm);
    color: var(--error-700);
    font-weight: var(--font-weight-medium);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
    padding: var(--space-6);
    background-color: var(--neutral-900);
    color: var(--neutral-100);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin: var(--space-6) 0;
}

pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* ========================================
   TEXT TRUNCATION
   ======================================== */

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

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

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

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

/* ========================================
   TEXT DECORATION
   ======================================== */

.no-underline {
    text-decoration: none !important;
}

.underline {
    text-decoration: underline;
}

.line-through {
    text-decoration: line-through;
}

/* ========================================
   WHITE SPACE
   ======================================== */

.whitespace-normal { white-space: normal; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre { white-space: pre; }
.whitespace-pre-line { white-space: pre-line; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* ========================================
   WORD BREAK
   ======================================== */

.break-normal {
    overflow-wrap: normal;
    word-break: normal;
}

.break-words {
    overflow-wrap: break-word;
    word-break: break-word;
}

.break-all {
    word-break: break-all;
}

/* ========================================
   BADGES & LABELS
   ======================================== */

.badge,
.label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25em 0.75em;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background-color: var(--brand-navy-900);
    color: var(--neutral-white);
}

.badge-secondary {
    background-color: var(--brand-gold-900);
    color: var(--brand-navy-900);
}

.badge-success {
    background-color: var(--success-500);
    color: var(--neutral-white);
}

.badge-error {
    background-color: var(--error-500);
    color: var(--neutral-white);
}

.badge-warning {
    background-color: var(--warning-500);
    color: var(--brand-navy-900);
}

.badge-info {
    background-color: var(--info-500);
    color: var(--neutral-white);
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

@media (max-width: 768px) {
    /* Adjust heading sizes for mobile */
    h1, .h1 {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    h2, .h2 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }

    h3, .h3 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    /* Adjust body text for better mobile readability */
    body {
        font-size: var(--font-size-base);
        line-height: var(--line-height-relaxed);
    }

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

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }

    p {
        orphans: 3;
        widows: 3;
    }

    blockquote {
        page-break-inside: avoid;
    }
}
