/* Typography & Font System */

:root {
    --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Monaco", "Menlo", "Courier New", monospace;
    
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 40px;
    
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.8;
    --line-height-loose: 2;
    
    --letter-spacing-tight: -0.01em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.02em;
}

/* Base Typography */
body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--text-dark);
    font-weight: var(--font-weight-regular);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    margin-bottom: var(--spacing-md);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--text-dark);
}

h1 {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-lg);
}

h1.page-title {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

h2 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-lg);
    margin-top: var(--spacing-2xl);
}

h2:first-child {
    margin-top: 0;
}

h3 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

h4 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
}

h5 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
}

h6 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

/* Paragraphs */
p {
    margin: 0 0 var(--spacing-md) 0;
    line-height: var(--line-height-normal);
}

p.lead {
    font-size: var(--font-size-lg);
    color: #666;
    margin-bottom: var(--spacing-lg);
    line-height: var(--line-height-relaxed);
}

.text-muted {
    color: #999;
    font-size: var(--font-size-sm);
}

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

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

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

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

/* Lists */
ul, ol {
    margin: 0 0 var(--spacing-md) 0;
    padding-left: var(--spacing-xl);
}

li {
    margin-bottom: var(--spacing-sm);
    line-height: var(--line-height-relaxed);
}

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

ul.list-unstyled li {
    margin-bottom: var(--spacing-md);
}

/* Links */
a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #003d8a;
    text-decoration: underline;
}

a.text-inherit {
    color: inherit;
}

a.text-inherit:hover {
    color: var(--primary-blue);
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    background: var(--light-gray);
    padding: 2px 6px;
    border-radius: 3px;
    color: #c7254e;
}

pre {
    background: #f5f5f5;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--spacing-lg);
}

pre code {
    background: none;
    color: #333;
    padding: 0;
}

/* Blockquote */
blockquote {
    border-left: 4px solid var(--primary-blue);
    padding-left: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    color: #666;
    font-style: italic;
}

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

/* Strong & Emphasis */
strong, .font-bold {
    font-weight: var(--font-weight-bold);
}

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

mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
}

/* Inline elements */
.small {
    font-size: var(--font-size-sm);
}

.caption {
    font-size: var(--font-size-xs);
    color: #999;
}

/* Abbreviation */
abbr {
    border-bottom: 1px dotted #999;
    cursor: help;
}

/* Text utilities */
.text-uppercase {
    text-transform: uppercase;
}

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

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

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

.font-weight-normal {
    font-weight: var(--font-weight-regular);
}

.font-weight-medium {
    font-weight: var(--font-weight-medium);
}

.font-weight-semibold {
    font-weight: var(--font-weight-semibold);
}

.font-weight-bold {
    font-weight: var(--font-weight-bold);
}

/* Line breaks */
hr {
    border: none;
    border-top: 1px solid var(--border-gray);
    margin: var(--spacing-2xl) 0;
}

/* Definition list */
dl {
    margin-bottom: var(--spacing-lg);
}

dt {
    font-weight: var(--font-weight-semibold);
    margin-top: var(--spacing-md);
}

dd {
    margin-left: 0;
    margin-bottom: var(--spacing-sm);
    color: #666;
}

/* Table typography */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: var(--spacing-lg);
}

th {
    background: var(--light-gray);
    font-weight: var(--font-weight-semibold);
    text-align: left;
    padding: var(--spacing-md);
    border-bottom: 2px solid var(--border-gray);
}

td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-gray);
}

tr:hover {
    background: var(--light-gray);
}

/* Responsive typography */
@media (max-width: 1024px) {
    h1, h1.page-title {
        font-size: 36px;
    }
    
    h2 {
        font-size: 28px;
    }
    
    h3 {
        font-size: 22px;
    }
}

@media (max-width: 768px) {
    h1, h1.page-title {
        font-size: 28px;
    }
    
    h2 {
        font-size: 24px;
    }
    
    h3 {
        font-size: 20px;
    }
    
    p {
        line-height: var(--line-height-relaxed);
    }
}

/* Print styles */
@media print {
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    ul, ol, pre {
        page-break-inside: avoid;
    }
    
    a {
        color: var(--primary-blue);
    }
}
