/* ==========================================================================
   Base Styles - Reset, Custom Properties, Typography, Utilities
   ========================================================================== */

/* CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
}

/* CSS Custom Properties */
:root {
    /* Colors */
    --c-primary: #0055A4;
    --c-accent: #FF6F00;
    --c-bg: #F5F7FA;
    --c-text: #1A1A1A;
    --c-muted: #8A94A6;
    --c-border: #E5EAF1;
    --c-white: #FFFFFF;
    
    /* Font Scale */
    --fs-xs: 0.75rem;    /* 12px */
    --fs-sm: 0.875rem;   /* 14px */
    --fs-base: 1rem;     /* 16px */
    --fs-lg: 1.125rem;   /* 18px */
    --fs-xl: 1.25rem;    /* 20px */
    --fs-2xl: 1.5rem;    /* 24px */
    --fs-3xl: 1.875rem;  /* 30px */
    --fs-4xl: 2.25rem;   /* 36px */
    --fs-5xl: 3rem;      /* 48px */
    
    /* Responsive Font Scale */
    --fs-h1: clamp(2.25rem, 4vw, 3rem);
    --fs-h2: clamp(1.875rem, 3vw, 2.25rem);
    --fs-h3: clamp(1.5rem, 2.5vw, 1.875rem);
    
    /* Spacing (8pt grid) */
    --space-xs: 0.25rem;  /* 4px */
    --space-sm: 0.5rem;   /* 8px */
    --space-md: 1rem;     /* 16px */
    --space-lg: 1.5rem;   /* 24px */
    --space-xl: 2rem;     /* 32px */
    --space-2xl: 3rem;    /* 48px */
    --space-3xl: 4rem;    /* 64px */
    --space-4xl: 6rem;    /* 96px */
    
    /* Container */
    --container-max-width: 1200px;
    --container-padding: var(--space-md);
    
    /* Focus ring */
    --focus-ring: 0 0 0 3px rgba(0, 85, 164, 0.3);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* Typography */
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--fs-base);
    line-height: 1.6;
    color: var(--c-text);
    background-color: var(--c-bg);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--space-md);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }
h6 { font-size: var(--fs-base); }

p {
    margin-bottom: var(--space-md);
}

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

a:hover,
a:focus {
    color: var(--c-accent);
    text-decoration: underline;
}

/* Focus Styles */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

/* Skip to content link */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    width: auto;
    height: auto;
    padding: var(--space-sm) var(--space-md);
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: var(--c-primary);
    color: var(--c-white);
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
}

/* Container */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 768px) {
    .grid {
        gap: var(--space-lg);
    }
    
    .grid--2,
    .grid--3,
    .grid--4 {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-lg);
    border: 2px solid transparent;
    border-radius: 4px;
    font-size: var(--fs-base);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px; /* Accessibility: minimum touch target */
}

.btn--primary {
    background: var(--c-primary);
    color: var(--c-white);
    border-color: var(--c-primary);
}

.btn--primary:hover,
.btn--primary:focus {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: var(--c-white);
    text-decoration: none;
}

.btn--secondary {
    background: transparent;
    color: var(--c-primary);
    border-color: var(--c-primary);
}

.btn--secondary:hover,
.btn--secondary:focus {
    background: var(--c-primary);
    color: var(--c-white);
    text-decoration: none;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge--primary {
    background: var(--c-primary);
    color: var(--c-white);
}

.badge--accent {
    background: var(--c-accent);
    color: var(--c-white);
}

.badge--muted {
    background: var(--c-border);
    color: var(--c-muted);
}

/* Card */
.card {
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: var(--space-xl);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.1);
}

.card__title {
    font-size: var(--fs-xl);
    margin-bottom: var(--space-md);
}

.card__text {
    color: var(--c-muted);
    margin-bottom: var(--space-md);
}

.card__text:last-child {
    margin-bottom: 0;
}

.card--featured {
    border-color: var(--c-primary);
    border-width: 2px;
}

.card--featured .card__title {
    color: var(--c-primary);
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--c-white);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--c-border);
}

.table th,
.table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--c-border);
}

.table th {
    background: var(--c-bg);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background: rgba(0, 85, 164, 0.05);
}

@media (max-width: 768px) {
    .table {
        font-size: var(--fs-sm);
    }
    
    .table th,
    .table td {
        padding: var(--space-xs) var(--space-sm);
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* Print Styles */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
    
    .btn,
    .badge {
        border: 1px solid #000;
        background: transparent !important;
    }
    
    .header,
    .nav,
    .footer {
        display: none;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}