/**
 * Unified Typography System
 * Sport Personalities - Astra Child Theme
 * Version: 1.0.0
 *
 * Fully Sans-Serif System for Maximum Readability
 * Performance-First: System Fonts Only (0 HTTP requests)
 * Accessibility: WCAG 2.1 AA Compliant
 */

:root {
  /* ===== FONT FAMILIES ===== */
  /* System Font Stack - Optimized for all platforms */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  --font-mono: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;

  /* ===== TYPE SCALE ===== */
  /* Base: 16px, Ratio: 1.25 (Major Third) */
  /* Mobile-first with desktop overrides */
  --text-xs: 0.75rem;      /* 12px - Badges, timestamps, meta */
  --text-sm: 0.875rem;     /* 14px - Captions, labels, small UI */
  --text-base: 1rem;       /* 16px - Body text, default */
  --text-lg: 1.125rem;     /* 18px - Large body, intro paragraphs */
  --text-xl: 1.25rem;      /* 20px - Small headings, emphasis */
  --text-2xl: 1.563rem;    /* 25px - H4 */
  --text-3xl: 1.953rem;    /* 31px - H3 */
  --text-4xl: 2.441rem;    /* 39px - H2 */
  --text-5xl: 3.052rem;    /* 49px - H1 */
  --text-6xl: 3.815rem;    /* 61px - Hero, display */

  /* ===== FONT WEIGHTS ===== */
  /* Limited palette for consistency */
  --font-normal: 400;      /* Body text, default */
  --font-medium: 500;      /* Subtle emphasis, labels */
  --font-semibold: 600;    /* Headings, strong emphasis */
  --font-bold: 700;        /* Primary headings, CTAs */

  /* ===== LINE HEIGHTS ===== */
  /* WCAG 2.1 compliant (minimum 1.5 for body) */
  --leading-none: 1;
  --leading-tight: 1.25;     /* Large headings */
  --leading-snug: 1.375;     /* Medium headings */
  --leading-normal: 1.5;     /* WCAG minimum */
  --leading-relaxed: 1.625;  /* Body text - optimal */
  --leading-loose: 2;        /* Reports, long-form */

  /* ===== LETTER SPACING ===== */
  --tracking-tighter: -0.05em;  /* Large headings only */
  --tracking-tight: -0.025em;   /* H1, H2 */
  --tracking-normal: 0;         /* Default */
  --tracking-wide: 0.025em;     /* H6, uppercase */
  --tracking-wider: 0.05em;     /* Badges, all-caps */
  --tracking-widest: 0.1em;     /* Special emphasis */

  /* ===== TEXT COLORS ===== */
  /* WCAG AA contrast ratios (4.5:1 minimum) */
  --color-heading: #111827;        /* Near black - headings */
  --color-body: #374151;           /* Dark gray - body text */
  --color-body-emphasis: #1f2937;  /* Darker gray - emphasis */
  --color-muted: #6b7280;          /* Medium gray - meta info */
  --color-subtle: #9ca3af;         /* Light gray - subtle text */
  --color-link: #b60f0a;           /* Brand red - links */
  --color-link-hover: #a50e09;     /* Darker red - hover */

  /* ===== BACKGROUND COLORS ===== */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-bg-tertiary: #f3f4f6;
}

/* ===== BASE STYLES ===== */
html {
  font-size: 16px; /* Base for rem calculations */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-relaxed); /* 1.625 - exceeds WCAG 1.5 */
  color: var(--color-body);
}

/* ===== HEADINGS ===== */
/* All sans-serif for modern, clean look */

h1, .h1, .text-h1 {
  font-family: var(--font-sans);
  font-size: var(--text-5xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-heading);
  margin: 0 0 1rem 0;
}

h2, .h2, .text-h2 {
  font-family: var(--font-sans);
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-heading);
  margin: 0 0 0.875rem 0;
}

h3, .h3, .text-h3 {
  font-family: var(--font-sans);
  font-size: var(--text-3xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--color-heading);
  margin: 0 0 0.75rem 0;
}

h4, .h4, .text-h4 {
  font-family: var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--color-heading);
  margin: 0 0 0.625rem 0;
}

h5, .h5, .text-h5 {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  color: var(--color-heading);
  margin: 0 0 0.5rem 0;
}

h6, .h6, .text-h6 {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  color: var(--color-heading);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin: 0 0 0.5rem 0;
}

/* ===== PARAGRAPHS & TEXT ===== */
p {
  margin: 0 0 1rem 0;
}

.text-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-body-emphasis);
  font-weight: var(--font-normal);
}

.text-small {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.text-xs {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
}

/* Text color utilities */
.text-muted {
  color: var(--color-muted);
}

.text-subtle {
  color: var(--color-subtle);
}

.text-emphasis {
  color: var(--color-body-emphasis);
  font-weight: var(--font-medium);
}

/* ===== LINKS ===== */
a {
  color: var(--color-link);
  text-decoration: underline;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
}

a:focus {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* ===== STRONG & EMPHASIS ===== */
strong, b {
  font-weight: var(--font-semibold);
  color: var(--color-body-emphasis);
}

em, i {
  font-style: italic;
}

/* ===== CODE & PRE ===== */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-tertiary);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  background: var(--color-bg-tertiary);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ===== LISTS ===== */
ul, ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
  line-height: var(--leading-relaxed);
}

/* ===== SPECIAL TEXT CLASSES ===== */

/* Hero text - responsive fluid sizing */
.text-hero {
  font-family: var(--font-sans);
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tighter);
  color: var(--color-heading);
}

/* Display text - large, attention-grabbing */
.text-display {
  font-size: var(--text-6xl);
  font-weight: var(--font-bold);
  line-height: 1;
  letter-spacing: var(--tracking-tighter);
}

/* Uppercase utility */
.text-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* Monospace utility */
.text-mono {
  font-family: var(--font-mono);
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */

/* Tablet and up */
@media (min-width: 768px) {
  :root {
    --text-5xl: 3.5rem;    /* Increase H1 on larger screens */
    --text-6xl: 4.5rem;    /* Increase hero on larger screens */
  }
}

/* Desktop and up */
@media (min-width: 1024px) {
  :root {
    --text-5xl: 4rem;      /* Further increase H1 */
    --text-6xl: 5rem;      /* Further increase hero */
  }
}

/* Mobile optimization */
@media (max-width: 767px) {
  :root {
    --text-5xl: 2.5rem;    /* Reduce H1 on mobile */
    --text-4xl: 2rem;      /* Reduce H2 on mobile */
  }

  /* Ensure minimum tap targets */
  a, button {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ===== ACCESSIBILITY ===== */

/* Selection highlight */
::selection {
  background-color: rgba(182, 15, 10, 0.2);
  color: inherit;
}

::-moz-selection {
  background-color: rgba(182, 15, 10, 0.2);
  color: inherit;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-link);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* ===== PRINT STYLES ===== */
@media print {
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
  }

  h1 { font-size: 24pt; }
  h2 { font-size: 20pt; }
  h3 { font-size: 18pt; }
  h4 { font-size: 16pt; }
  h5 { font-size: 14pt; }
  h6 { font-size: 12pt; }

  a {
    text-decoration: underline;
    color: #000;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
  }
}

/* ===== UTILITY CLASSES ===== */

/* Font weight utilities */
.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); }

/* Line height utilities */
.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); }

/* Letter spacing utilities */
.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); }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Truncate text */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Line clamp (max 2 lines) */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Line clamp (max 3 lines) */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
