/**
 * Ice Arena Design System - Typography v2
 * Distinctive typography for HockeyShare
 *
 * Font Stack:
 * - Display: Barlow Condensed (bold, athletic headlines)
 * - Body: DM Sans (clean, modern readability)
 * - Mono: JetBrains Mono (stats, numbers, code)
 *
 * Version: 2.0
 * Date: November 2025
 */

/* =========================================
   FONT IMPORTS
   ========================================= */

/* Google Fonts - Load in HTML head for better performance:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
*/

/* Fallback @import (not recommended for production) */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* =========================================
   HEADINGS
   Athletic, bold display typography
   ========================================= */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--space-4);
}

h1, .h1 {
    font-size: clamp(2.5rem, 5vw, var(--text-5xl));
    font-weight: var(--font-extrabold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    line-height: var(--leading-none);
}

h2, .h2 {
    font-size: clamp(1.875rem, 4vw, var(--text-4xl));
    font-weight: var(--font-bold);
}

h3, .h3 {
    font-size: clamp(1.5rem, 3vw, var(--text-3xl));
    font-weight: var(--font-semibold);
}

h4, .h4 {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
}

h5, .h5 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
}

h6, .h6 {
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
}

/* Page Title - Extra large hero-style heading */
.page-title-text,
.title-hero {
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, var(--text-6xl));
    font-weight: var(--font-extrabold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    line-height: var(--leading-none);
    color: var(--rink-900);
}

/* Section Title - Uppercase label style */
.section-title,
.title-section {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* Card Title */
.card-title-text,
.title-card {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-normal);
    color: var(--text-primary);
}

/* =========================================
   BODY TEXT
   ========================================= */

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

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

/* Lead paragraph - larger intro text */
.lead,
.text-lead {
    font-size: var(--text-lg);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    color: var(--text-secondary);
}

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

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

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

/* =========================================
   STATS & NUMBERS
   Monospace for tabular data
   ========================================= */

.stat-number,
.number,
.text-mono {
    font-family: var(--font-mono);
    font-weight: var(--font-semibold);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--tracking-tight);
}

/* Large stat display */
.stat-large {
    font-family: var(--font-mono);
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-none);
}

/* Medium stat display */
.stat-medium {
    font-family: var(--font-mono);
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-tight);
}

/* Small stat display */
.stat-small {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: var(--font-medium);
}

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

.label,
.text-label {
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--text-muted);
}

/* Form labels */
.form-label {
    display: block;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--rink-700);
    margin-bottom: var(--space-2);
}

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

/* Only apply link colors within content areas - prevents override of nav, footer, buttons */
.main-content a:not(.btn),
.modal-content a:not(.btn),
article a:not(.btn) {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

.main-content a:not(.btn):hover,
.modal-content a:not(.btn):hover,
article a:not(.btn):hover {
    color: var(--text-link-hover);
}

a:focus-visible {
    outline: 2px solid var(--ice-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Underline variant */
.link-underline {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link-underline:hover {
    text-decoration-thickness: 2px;
}

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

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

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

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

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

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

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

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

blockquote {
    margin: 0 0 var(--space-6);
    padding: var(--space-4) var(--space-6);
    border-left: 4px solid var(--ice-500);
    background: var(--ice-50);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

blockquote p {
    font-size: var(--text-lg);
    font-style: italic;
    color: var(--text-secondary);
}

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

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

blockquote cite::before {
    content: '\2014\00A0';
}

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

code, kbd, pre, samp {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

code {
    padding: var(--space-0-5) var(--space-1-5);
    background: var(--ice-100);
    color: var(--goal-red);
    border-radius: var(--radius-sm);
}

/* Code inside links should inherit color */
a code {
    color: inherit;
}

pre {
    display: block;
    margin: 0 0 var(--space-4);
    padding: var(--space-4);
    background: var(--rink-900);
    color: var(--ice-100);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

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

kbd {
    padding: var(--space-0-5) var(--space-1-5);
    background: var(--rink-800);
    color: var(--ice-100);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

/* =========================================
   HORIZONTAL RULE
   ========================================= */

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

/* =========================================
   TEXT UTILITIES
   ========================================= */

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

/* Font Weight */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

/* Font Style */
.italic { font-style: italic; }
.not-italic { font-style: normal; }

/* Text Transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* Letter Spacing */
.tracking-tighter { letter-spacing: var(--tracking-tighter); }
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }
.tracking-widest { letter-spacing: var(--tracking-widest); }

/* Line Height */
.leading-none { line-height: var(--leading-none); }
.leading-tight { line-height: var(--leading-tight); }
.leading-snug { line-height: var(--leading-snug); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }
.leading-loose { line-height: var(--leading-loose); }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-inverse { color: var(--text-inverse); }
.text-success { color: var(--save-green); }
.text-warning { color: var(--power-gold); }
.text-danger { color: var(--goal-red); }
.text-info { color: var(--assist-cyan); }

/* Text Decoration */
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

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

/* Whitespace */
.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 { word-break: normal; overflow-wrap: normal; }
.break-words { overflow-wrap: break-word; }
.break-all { word-break: break-all; }

/* =========================================
   FONT FAMILY UTILITIES
   ========================================= */

.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

/* =========================================
   RESPONSIVE TYPOGRAPHY (Mobile-First)
   Base = Mobile, then scale up
   ========================================= */

/* Mobile Base (< 640px) - Already defined above with clamp() */

/* Small screens and up (640px+) */
@media (min-width: 640px) {
    body {
        font-size: var(--text-base);
    }

    .lead,
    .text-lead {
        font-size: var(--text-lg);
    }
}

/* Tablet and up (768px+) */
@media (min-width: 768px) {
    .page-title-text,
    .title-hero {
        font-size: clamp(3rem, 6vw, var(--text-6xl));
    }

    .section-title,
    .title-section {
        font-size: var(--text-sm);
        letter-spacing: var(--tracking-widest);
    }
}

/* Desktop and up (1024px+) */
@media (min-width: 1024px) {
    h1, .h1 {
        font-size: clamp(2.5rem, 5vw, var(--text-5xl));
    }

    h2, .h2 {
        font-size: clamp(1.875rem, 4vw, var(--text-4xl));
    }
}

/* Legacy max-width fallback for very small screens */
@media (max-width: 374px) {
    h1, .h1 {
        font-size: var(--text-2xl);
    }

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

    h3, .h3 {
        font-size: var(--text-lg);
    }

    .page-title-text,
    .title-hero {
        font-size: var(--text-3xl);
    }
}

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

@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        color: #000;
    }

    p, blockquote {
        orphans: 3;
        widows: 3;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    pre, code {
        background: #f5f5f5;
        border: 1px solid #ccc;
    }
}

/* =========================================
   SELECTION STYLES
   ========================================= */

::selection {
    background: var(--ice-200);
    color: var(--rink-900);
}

::-moz-selection {
    background: var(--ice-200);
    color: var(--rink-900);
}
