/* Typography System for TestAutism.ro */
/* Design system for consistent typography across the site */

:root {
  /* Font families */
  --font-family-base: 'Segoe UI', Tahoma, Geneva, Verdana, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-mono: 'Courier New', Courier, monospace;

  /* Font sizes - Mobile first, optimized for accessibility & legibility.
     Base html font-size scales per breakpoint (18px mobile, 17px tablet, 17px desktop),
     so these rem values produce generous computed pixel sizes. */
  --font-size-xs: 0.8rem;       /* ~14px mobile */
  --font-size-sm: 0.9rem;       /* ~16px mobile */
  --font-size-base: 1rem;       /* ~18px mobile, 17px desktop */
  --font-size-lg: 1.15rem;      /* ~21px mobile */
  --font-size-xl: 1.35rem;      /* ~24px mobile */
  --font-size-2xl: 1.6rem;      /* ~29px mobile */
  --font-size-3xl: 2rem;        /* ~36px mobile */
  --font-size-4xl: 2.5rem;      /* ~45px mobile */

  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.4;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;

  /* Font weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Letter spacing */
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;

  /* Text colors */
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --text-light: #adb5bd;
  --text-white: #ffffff;

  /* Heading colors */
  --heading-color: #1a1a1a;
  --subheading-color: #333333;
}

/* Responsive font sizes for tablets (≥768px, html base = 17px) */
@media (min-width: 768px) {
  :root {
    --font-size-xs: 0.8rem;       /* ~14px */
    --font-size-sm: 0.9rem;       /* ~15px */
    --font-size-base: 1rem;       /* 17px */
    --font-size-lg: 1.175rem;     /* ~20px */
    --font-size-xl: 1.4rem;       /* ~24px */
    --font-size-2xl: 1.75rem;     /* ~30px */
    --font-size-3xl: 2.25rem;     /* ~38px */
    --font-size-4xl: 2.75rem;     /* ~47px */
  }
}

/* Responsive font sizes for desktop (≥1200px, html base = 17px) */
@media (min-width: 1200px) {
  :root {
    --font-size-xs: 0.825rem;     /* ~14px */
    --font-size-sm: 0.94rem;      /* ~16px */
    --font-size-base: 1.06rem;    /* ~18px */
    --font-size-lg: 1.25rem;      /* ~21px */
    --font-size-xl: 1.5rem;       /* ~26px */
    --font-size-2xl: 2rem;        /* ~34px */
    --font-size-3xl: 2.5rem;      /* ~43px */
    --font-size-4xl: 3rem;        /* ~51px */
  }
}

/* Base typography styles.
   17px desktop base is above the 16px minimum, optimal for content-heavy
   accessibility-focused sites. Scales up on smaller screens where users
   hold devices closer and need larger text. */
html {
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (max-width: 768px) {
  html {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 18px;
  }
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-normal);
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--heading-color);
  margin-top: 0;
  margin-bottom: 0.75rem;
  letter-spacing: var(--letter-spacing-tight);
}

h1, .h1 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: 1.5rem;
}

h2, .h2 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 1.25rem;
}

h3, .h3 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 1rem;
}

h4, .h4 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-medium);
  margin-bottom: 0.875rem;
}

h5, .h5 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  margin-bottom: 0.75rem;
}

h6, .h6 {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.5rem;
}

/* Paragraphs */
p {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: var(--line-height-base);
}

.lead {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--text-secondary);
}

/* Links */
a {
  color: #2196F3;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: #1976D2;
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: var(--line-height-base);
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.25rem;
}

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

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

/* Blockquotes */
blockquote {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  font-style: italic;
  color: var(--text-secondary);
  margin: 1.5rem 0;
  padding-left: 1.5rem;
  border-left: 4px solid #e9ecef;
}

/* Text utilities */
.text-xs { font-size: var(--font-size-xs) !important; }
.text-sm { font-size: var(--font-size-sm) !important; }
.text-base { font-size: var(--font-size-base) !important; }
.text-lg { font-size: var(--font-size-lg) !important; }
.text-xl { font-size: var(--font-size-xl) !important; }
.text-2xl { font-size: var(--font-size-2xl) !important; }
.text-3xl { font-size: var(--font-size-3xl) !important; }
.text-4xl { font-size: var(--font-size-4xl) !important; }

.font-normal { font-weight: var(--font-weight-normal) !important; }
.font-medium { font-weight: var(--font-weight-medium) !important; }
.font-semibold { font-weight: var(--font-weight-semibold) !important; }
.font-bold { font-weight: var(--font-weight-bold) !important; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-light { color: var(--text-light) !important; }

/* Mobile-specific adjustments for better readability */
@media (max-width: 576px) {
  p, li {
    line-height: var(--line-height-relaxed);
  }
}

/* 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: 16pt; }
  h4, h5, h6 { font-size: 14pt; }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-primary: #000000;
    --text-secondary: #333333;
    --heading-color: #000000;
  }

  a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }
}