/* =============================================================================
   TYPOGRAPHY FOUNDATION
   Path: /css/_shared/_typography.css
   
   Purpose: Base typography styles applied globally.
   Load Order: After _variables.css
   
   Based on: TYPOGRAPHY-STANDARDS.md
   ========================================================================== */

/* =============================================================================
   BASE RESET
   ========================================================================== */

html {
    font-size: 16px; /* Do not change - this is the rem baseline */
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    color: var(--text);
}

/* =============================================================================
   HEADINGS
   ========================================================================== */

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

h1, .h1 {
    font-size: var(--font-2xl);      /* 36px */
    font-weight: var(--font-extrabold);
}

h2, .h2 {
    font-size: var(--font-xl);       /* 28px */
    font-weight: var(--font-bold);
}

h3, .h3 {
    font-size: var(--font-lg);       /* 22px */
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

h4, .h4 {
    font-size: var(--font-md);       /* 18px */
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

h5, .h5 {
    font-size: var(--font-base);     /* 16px */
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

h6, .h6 {
    font-size: var(--font-sm);       /* 14px */
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
}

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

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

/* Lead text */
.lead {
    font-size: var(--font-md);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
}

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

/* Extra small text - Use sparingly, accessibility minimum */
.text-xs {
    font-size: var(--font-xs);       /* 12px - absolute minimum */
    line-height: var(--leading-normal);
}

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

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

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

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

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

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

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

code {
    color: var(--danger);
    background-color: var(--bg-tertiary);
    padding: 0.125rem 0.25rem;
    border-radius: var(--radius-sm);
}

pre {
    display: block;
    margin-top: 0;
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

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

/* =============================================================================
   FORM TYPOGRAPHY
   ========================================================================== */

label,
.form-label {
    font-family: var(--font-family);
    font-size: var(--font-sm);       /* 14px */
    font-weight: var(--font-medium);
    line-height: var(--leading-normal);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

input,
textarea,
select,
.form-control,
.form-select {
    font-family: var(--font-family);
    font-size: var(--font-base);     /* 16px - prevents iOS zoom */
    line-height: var(--leading-normal);
}

/* Validation errors */
.field-validation-error,
.invalid-feedback {
    font-family: var(--font-family);
    font-size: var(--font-xs);       /* 12px */
    line-height: var(--leading-normal);
    color: var(--danger);
}

/* Help text */
.form-text,
.help-text {
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* =============================================================================
   BUTTON TYPOGRAPHY
   ========================================================================== */

button,
.btn {
    font-family: var(--font-family);
    font-weight: var(--font-semibold);
    line-height: var(--leading-normal);
}

/* =============================================================================
   TABLE TYPOGRAPHY
   ========================================================================== */

th {
    font-weight: var(--font-semibold);
    text-align: inherit;
}

/* =============================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Font weights */
.fw-normal { font-weight: var(--font-normal) !important; }
.fw-medium { font-weight: var(--font-medium) !important; }
.fw-semibold { font-weight: var(--font-semibold) !important; }
.fw-bold { font-weight: var(--font-bold) !important; }

/* Text transforms */
.text-uppercase { text-transform: uppercase !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-capitalize { text-transform: capitalize !important; }

/* Text alignment */
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }

/* Line heights */
.lh-1 { line-height: 1 !important; }
.lh-sm { line-height: var(--leading-tight) !important; }
.lh-base { line-height: var(--leading-normal) !important; }
.lh-lg { line-height: var(--leading-relaxed) !important; }

/* Word break */
.text-break {
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.text-nowrap {
    white-space: nowrap !important;
}

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