/**
 * Typography Styles
 * Using Atkinson Hyperlegible for accessibility
 * Designed by the Braille Institute for low vision readers
 */

/* ==========================================================================
   FONT FACE DECLARATIONS
   Loading Atkinson Hyperlegible from Google Fonts or local files
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

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

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

/* ==========================================================================
   HEADINGS
   Clear visual hierarchy with balanced text wrapping
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-4);
}

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

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

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

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

/* ==========================================================================
   PARAGRAPHS & BODY TEXT
   ========================================================================== */

p {
  margin-bottom: var(--spacing-4);
  max-width: var(--content-width);
}

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

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

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

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

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

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

a:hover {
  color: var(--color-primary-dark);
  text-decoration-thickness: 2px;
}

a:focus {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

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

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

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

li::marker {
  color: var(--color-primary);
}

/* Nested lists */
ul ul, 
ul ol, 
ol ul, 
ol ol {
  margin-top: var(--spacing-2);
  margin-bottom: var(--spacing-2);
}

/* ==========================================================================
   STRONG, EMPHASIS, AND OTHER INLINE ELEMENTS
   ========================================================================== */

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

em, i {
  font-style: italic;
}

mark {
  background-color: var(--color-warning-light);
  padding: 0 var(--spacing-1);
  border-radius: var(--radius-sm);
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background-color: var(--color-bg-tertiary);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
}

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

blockquote {
  border-left: 4px solid var(--color-primary);
  padding-left: var(--spacing-4);
  margin: var(--spacing-6) 0;
  font-style: italic;
  color: var(--color-text-secondary);
}

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

/* ==========================================================================
   HORIZONTAL RULES
   ========================================================================== */

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

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

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

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

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

.uppercase {
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.capitalize {
  text-transform: capitalize;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Font weight utilities */
.font-normal {
  font-weight: var(--font-weight-normal);
}

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

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

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

/* ==========================================================================
   RESPONSIVE TYPOGRAPHY
   ========================================================================== */

@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }
  
  h2 {
    font-size: var(--font-size-2xl);
  }
  
  h3 {
    font-size: var(--font-size-xl);
  }
  
  .lead {
    font-size: var(--font-size-lg);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: var(--font-size-2xl);
  }
  
  h2 {
    font-size: var(--font-size-xl);
  }
  
  h3 {
    font-size: var(--font-size-lg);
  }
}
