/* ==========================================================================
   Typography Styles - Media Bias Visualization
   Following the Typography Triangle principles:
   - Hierarchy (visual importance)
   - Scale (proportional sizes)
   - Spacing (line-height, letter-spacing)
   - Line Length (optimal reading width)
   ========================================================================== */

/* ==========================================================================
   Font Scale
   Using a modular scale of 1.25 (Major Third)
   Base: 16px
   ========================================================================== */

:root {
    /* Type Scale */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-md: 1.125rem;     /* 18px */
    --font-size-lg: 1.25rem;      /* 20px */
    --font-size-xl: 1.5rem;       /* 24px */
    --font-size-2xl: 1.875rem;    /* 30px */
    --font-size-3xl: 2.25rem;     /* 36px */
    --font-size-4xl: 3rem;        /* 48px */
    --font-size-5xl: 3.75rem;     /* 60px */
    --font-size-6xl: 4.5rem;      /* 72px */
    
    /* Line Heights */
    --line-height-tight: 1.15;
    --line-height-snug: 1.3;
    --line-height-normal: 1.6;
    --line-height-relaxed: 1.75;
    
    /* Letter Spacing */
    --letter-spacing-tight: -0.02em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
    --letter-spacing-widest: 0.1em;
    
    /* Font Weights */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    
    /* Maximum Line Length (for optimal readability) */
    --max-line-length: 70ch;
    --max-line-length-wide: 85ch;
    --max-line-length-narrow: 55ch;
}

/* ==========================================================================
   Headings - Roboto Slab
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.heading-1, .heading-2, .heading-3, 
.heading-4, .heading-5, .heading-6 {
    font-family: 'Roboto Slab', Georgia, 'Times New Roman', serif;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--space-md);
}

h1, .heading-1 {
    font-size: clamp(var(--font-size-3xl), 6vw, var(--font-size-5xl));
    line-height: 1.1;
    letter-spacing: -0.03em;
}

h2, .heading-2 {
    font-size: clamp(var(--font-size-2xl), 4vw, var(--font-size-4xl));
    line-height: var(--line-height-tight);
}

h3, .heading-3 {
    font-size: clamp(var(--font-size-xl), 3vw, var(--font-size-2xl));
    line-height: var(--line-height-snug);
    font-weight: var(--font-weight-semibold);
}

h4, .heading-4 {
    font-size: var(--font-size-lg);
    line-height: var(--line-height-snug);
    font-weight: var(--font-weight-semibold);
}

h5, .heading-5 {
    font-size: var(--font-size-md);
    line-height: var(--line-height-snug);
    font-weight: var(--font-weight-semibold);
}

h6, .heading-6 {
    font-size: var(--font-size-base);
    line-height: var(--line-height-snug);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
}

/* ==========================================================================
   Body Text - Fira Sans
   ========================================================================== */

body {
    font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                 Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
}

p {
    margin-top: 0;
    margin-bottom: var(--space-md);
    max-width: var(--max-line-length);
}

/* Lead paragraph - larger intro text */
.lead, 
.text-lead {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-light);
    line-height: var(--line-height-relaxed);
    color: var(--text-primary);
    max-width: var(--max-line-length-wide);
}

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

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

/* ==========================================================================
   Links
   ========================================================================== */

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

a:visited {
    color: var(--color-secondary);
}

/* Remove underline for navigation and buttons */
nav a,
.btn,
.no-underline {
    text-decoration: none;
}

/* ==========================================================================
   Text Emphasis & Semantic Styles
   ========================================================================== */

strong, b,
.text-bold {
    font-weight: var(--font-weight-semibold);
}

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

mark,
.text-highlight {
    background-color: rgba(207, 0, 99, 0.1);
    padding: 0.1em 0.3em;
    border-radius: 2px;
}

del, s,
.text-strikethrough {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ==========================================================================
   Text Colors
   ========================================================================== */

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

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

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

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

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

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

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

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

/* ==========================================================================
   Lists
   ========================================================================== */

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

li {
    margin-bottom: var(--space-xs);
    line-height: var(--line-height-normal);
}

li > ul,
li > ol {
    margin-top: var(--space-xs);
    margin-bottom: 0;
}

/* Unordered list styling */
ul {
    list-style-type: disc;
}

ul ul {
    list-style-type: circle;
}

ul ul ul {
    list-style-type: square;
}

/* Ordered list styling */
ol {
    list-style-type: decimal;
}

ol ol {
    list-style-type: lower-alpha;
}

ol ol ol {
    list-style-type: lower-roman;
}

/* Definition lists */
dl {
    margin-bottom: var(--space-md);
}

dt {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-xxs);
}

dd {
    margin-left: 0;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

/* ==========================================================================
   Blockquotes
   ========================================================================== */

blockquote {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    border-left: 4px solid var(--color-primary);
    background-color: var(--bg-secondary);
    font-style: italic;
    color: var(--text-secondary);
}

blockquote p {
    margin-bottom: var(--space-sm);
}

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

blockquote cite,
blockquote footer {
    display: block;
    font-size: var(--font-size-sm);
    font-style: normal;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

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

/* ==========================================================================
   Code & Preformatted Text
   ========================================================================== */

code, kbd, samp, pre {
    font-family: 'Fira Code', 'JetBrains Mono', Consolas, Monaco, 
                 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* Inline code */
code {
    padding: 0.2em 0.4em;
    background-color: var(--color-gray-100);
    border-radius: var(--border-radius-sm);
    color: var(--color-primary-dark);
}

/* Code blocks */
pre {
    display: block;
    padding: var(--space-lg);
    margin: var(--space-md) 0;
    background-color: var(--color-gray-900);
    color: var(--color-gray-100);
    border-radius: var(--border-radius-md);
    overflow-x: auto;
    line-height: var(--line-height-relaxed);
}

pre code {
    padding: 0;
    background-color: transparent;
    color: inherit;
    font-size: var(--font-size-sm);
}

/* Keyboard input */
kbd {
    display: inline-block;
    padding: 0.2em 0.5em;
    font-size: var(--font-size-sm);
    background-color: var(--color-gray-100);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--border-radius-sm);
    box-shadow: inset 0 -1px 0 var(--color-gray-300);
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */

hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: var(--space-xl) 0;
}

hr.thick {
    height: 3px;
    background-color: var(--color-primary);
    width: 60px;
}

/* ==========================================================================
   Labels & Badges
   ========================================================================== */

.label,
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xxs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    border-radius: var(--border-radius-sm);
    line-height: 1;
}

.label-primary,
.badge-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.label-secondary,
.badge-secondary {
    background-color: var(--color-gray-200);
    color: var(--text-primary);
}

.label-outline,
.badge-outline {
    background-color: transparent;
    border: 1px solid currentColor;
    color: var(--color-primary);
}

/* ==========================================================================
   Captions & Annotations
   ========================================================================== */

caption,
.caption,
figcaption {
    font-size: var(--font-size-sm);
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-sm);
}

figure {
    margin: var(--space-lg) 0;
}

figure img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Data Display Typography
   ========================================================================== */

/* Large numbers (for statistics) */
.stat-number {
    font-family: 'Roboto Slab', Georgia, serif;
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: 1;
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-primary);
}

.stat-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wider);
    color: var(--text-muted);
}

/* Data values in charts */
.data-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    fill: var(--text-secondary);
}

.axis-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    fill: var(--text-secondary);
}

.chart-title {
    font-family: 'Roboto Slab', Georgia, serif;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    fill: var(--text-primary);
}

/* ==========================================================================
   Special Text Treatments
   ========================================================================== */

/* Insight callout */
.insight {
    padding: var(--space-md);
    background-color: rgba(21, 101, 192, 0.1);
    border-left: 3px solid var(--color-neutral);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin: var(--space-md) 0;
}

.insight strong {
    color: var(--color-neutral);
}

/* Caveat/warning callout */
.caveat {
    padding: var(--space-md);
    background-color: rgba(249, 168, 37, 0.1);
    border-left: 3px solid var(--color-warning);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin: var(--space-md) 0;
    font-size: var(--font-size-sm);
}

.caveat strong {
    color: var(--color-warning);
}

/* Truncation */
.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;
}

/* ==========================================================================
   Responsive Typography
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --font-size-base: 0.9375rem;
    }
    
    .lead,
    .text-lead {
        font-size: var(--font-size-md);
    }
}

@media (min-width: 1200px) {
    :root {
        --font-size-base: 1.0625rem;
    }
}
