/* ==========================================================================
   Typography System
   Modern, scalable, and maintainable text styles
   ========================================================================== */

/* CSS Custom Properties for Typography */
:root {
  /* Font Families */
  --font-primary: 'Verdana', 'Geneva', sans-serif;
  --font-secondary: 'Tahoma', 'Arial', sans-serif;
  
  /* Font Sizes */
  --text-size-sm: 12px;
  --text-size-md: 14px;
  --text-size-lg: 16px;
  
  /* Colors */
  --color-text-primary: #333333;
  --color-text-secondary: #003366;
  --color-text-accent: #FF7C07;
  --color-text-inverse: #FFFFFF;
  --color-border: #22498A;
  
  /* Line Heights */
  --line-height-normal: 1.4;
  --line-height-relaxed: 1.6;
  
  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;
}

/* Base Text Styles */
.text-body {
  font-family: var(--font-primary);
  font-size: var(--text-size-sm);
  color: var(--color-text-primary);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-normal);
}

/* Color Variants */
.text-primary {
  color: var(--color-text-primary);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-accent {
  color: var(--color-text-accent);
}

.text-inverse {
  color: var(--color-text-inverse);
}

/* Font Family Variants */
.text-font-primary {
  font-family: var(--font-primary);
}

.text-font-secondary {
  font-family: var(--font-secondary);
}

/* Size Variants */
.text-size-small {
  font-size: var(--text-size-sm);
}

.text-size-medium {
  font-size: var(--text-size-md);
}

.text-size-large {
  font-size: var(--text-size-lg);
}

/* Combined Utility Classes (Backward Compatible) */
.bodytext {
  composes: text-body;
}

.bodytext-orange {
  font-family: var(--font-secondary);
  font-size: var(--text-size-md);
  color: var(--color-text-accent);
  line-height: var(--line-height-normal);
}

.bodytext-blue {
  font-family: var(--font-primary);
  font-size: var(--text-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
}

.bodytext-white {
  font-family: var(--font-primary);
  font-size: var(--text-size-sm);
  color: var(--color-text-inverse);
  line-height: var(--line-height-normal);
}

/* Enhanced Bodytext with Modern Features */
.bodytext-enhanced {
  font-family: var(--font-primary);
  font-size: clamp(0.875rem, 2vw, var(--text-size-sm));
  color: var(--color-text-primary);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-normal);
}

/* Border Utilities */
.border {
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.border-thin {
  border: 1px solid var(--color-border);
}

.border-medium {
  border: 2px solid var(--color-border);
}

.border-thick {
  border: 3px solid var(--color-border);
}

/* Border Radius Variants */
.border-rounded {
  border-radius: 4px;
}

.border-rounded-md {
  border-radius: 6px;
}

.border-rounded-lg {
  border-radius: 8px;
}

.border-pill {
  border-radius: 50px;
}

/* Semantic Border Classes */
.border-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.border-input {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.border-input:focus {
  border-color: var(--color-text-accent);
  box-shadow: 0 0 0 3px rgba(255, 124, 7, 0.1);
  outline: none;
}

/* ==========================================================================
   Responsive Typography
   ========================================================================== */

@media (min-width: 768px) {
  :root {
    --text-size-sm: 13px;
    --text-size-md: 15px;
    --text-size-lg: 18px;
  }
  
  .bodytext-responsive {
    font-size: clamp(1rem, 1.5vw, var(--text-size-md));
  }
}

@media (min-width: 1024px) {
  :root {
    --text-size-sm: 14px;
    --text-size-md: 16px;
    --text-size-lg: 20px;
  }
}

/* ==========================================================================
   Accessibility Features
   ========================================================================== */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .bodytext-orange {
    color: #CC5500; /* Higher contrast orange */
  }
  
  .bodytext-blue {
    color: #002244; /* Higher contrast blue */
  }
  
  .border {
    border-color: #000000;
    border-width: 2px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .border-input {
    transition: none;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .bodytext {
    color: #E0E0E0;
  }
  
  .bodytext-blue {
    color: #6699CC;
  }
  
  .border {
    border-color: #446688;
  }
}

/* ==========================================================================
   Utility Classes for Modern Development
   ========================================================================== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font Weight */
.font-light { font-weight: 300; }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-bold { font-weight: var(--font-weight-bold); }

/* Text Transformation */
.text-uppercase { text-transform: uppercase; }
.text-lowercase { text-transform: lowercase; }
.text-capitalize { text-transform: capitalize; }

/* Text Decoration */
.text-underline { text-decoration: underline; }
.text-no-underline { text-decoration: none; }

/* Line Height */
.leading-tight { line-height: 1.2; }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }
.leading-loose { line-height: 1.8; }

/* Letter Spacing */
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: normal; }
.tracking-wide { letter-spacing: 0.025em; }

/* Opacity */
.text-opacity-75 { opacity: 0.75; }
.text-opacity-50 { opacity: 0.5; }
.text-opacity-25 { opacity: 0.25; }

/* ==========================================================================
   Component-specific Text Styles
   ========================================================================== */

/* Button Text */
.text-button {
  font-family: var(--font-primary);
  font-size: var(--text-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Heading Text */
.text-heading {
  font-family: var(--font-secondary);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

/* Code Text */
.text-code {
  font-family: 'Monaco', 'Consolas', 'Monaco', monospace;
  font-size: calc(var(--text-size-sm) - 1px);
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.125rem 0.25rem;
  border-radius: 2px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .bodytext,
  .bodytext-orange,
  .bodytext-blue,
  .bodytext-white {
    color: #000000 !important;
    font-family: "Times New Roman", serif !important;
  }
  
  .border {
    border-color: #000000 !important;
  }
}

/* ==========================================================================
   Legacy Support with Modern Enhancements
   ========================================================================== */

/* Backward compatibility with original classes */
.legacy-bodytext {
  font-family: Verdana;
  font-size: 12px;
  color: #333333;
}

.legacy-bodytext-orange {
  font-family: Tahoma;
  font-size: 14px;
  color: #FF7C07;
}

.legacy-bodytext-blue {
  font-family: Verdana;
  font-size: 12px;
  color: #003366;
}

.legacy-bodytext-white {
  font-family: Verdana;
  font-size: 12px;
  color: #FFFFFF;
}

.legacy-border {
  border: 1px solid #22498A;
}