/* EDsmart Data - Base Styles */
/* Master UI Design System - Light-first, data-first aesthetic */
/* Statista × Bloomberg Intelligence × modern government data portal */

:root {
    /* ========================================
       EDsmartData Color System
       ======================================== */
    
    /* Primary Brand Colors (light + Stitch-inspired accents) */
    --color-primary: #0A1C4A;            /* Primary brand color - dark navy */
    --color-aqua: #00B3C6;               /* Aqua fill / border / chart accent (not body text on white) */
    --color-aqua-soft: #E6F7F9;          /* Soft aqua wash for hovers / key blocks */
    --color-aqua-dark: #006874;          /* Aqua text/icons on light surfaces — ≥4.5:1 on white */
    --color-aqua-text: var(--color-aqua-dark);
    --color-aqua-on-dark: #7AD7E2;       /* Aqua text on navy — ≥4.5:1 on --color-primary */
    --color-link: #0A5F6D;               /* Teal links — ≥4.5:1 on white */
    --color-link-hover: #064A55;
    --border-accent: rgba(0, 179, 198, 0.45);
    --color-button: #D51C31;             /* Legacy CTA / negative accent */
    --color-white: #FFFFFF;
    --color-gray-text: #6B7885;
    
    /* Background Colors */
    --background-color: #F5F7FB;         /* Cool page tint */
    --background: var(--background-color);
    --surface: #FFFFFF;
    --surface-alt: #EEF2F8;              /* Muted panels, inputs */
    
    /* Text Colors */
    --text-color: #1A2332;               /* Primary body text */
    --text-primary: var(--text-color);
    --text-color-light: #4A5A6B;
    --text-secondary: var(--text-color-light);
    --text-meta: #5C6B7A;
    --text-on-navy: #FFFFFF;             /* Primary text on navy panels */
    --text-on-navy-muted: #C8D0DB;       /* Labels / meta on navy — ≥4.5:1 */
    
    /* Banner Colors */
    --banner-background-color: #FF3500;  /* Primary banner background - red/orange */
    --banner-text-color: #FFFFFF;        /* Banner text - white */
    --secondary-banner-background-color: #FFD6F8; /* Secondary banner - pink */
    --secondary-banner-text-color: #FF3500; /* Secondary banner text - red/orange */
    
    /* Button Colors — primary actions use navy (see .btn-primary) */
    --button-color: #0A1C4A;
    --button-color-hover: #152A52;
    --button-color-active: #07142E;
    --button-color-disabled: #8A9AAD;
    --button-text-color: #FFFFFF;
    --button-success: #3F6B52;           /* Success fill + text — ≥4.5:1 on white */
    --button-success-hover: #345A45;
    --status-success: var(--button-success);
    --status-danger: var(--color-button);
    
    /* Menu Colors */
    --menu-background: #fffefc;          /* Menu background */
    --menu-background-grey-light: #f9f9f9; /* Light gray menu background */
    --menu-background-grey-dark: #efefef; /* Dark gray menu background */
    --menu-background-highlight: #f8f5f1; /* Menu highlight background */
    --menu-border: #D8E0ED;
    --menu-text: #210803;                /* Menu text color */
    --menu-text-light: #4A5A6B;          /* Light menu text - darker bluish-gray (WCAG AA: 7.1:1 contrast) */
    --menu-grey-dark: #737373;           /* Dark gray for menu (WCAG AA compliant: 4.8:1 contrast) */
    
    /* Legacy/Compatibility Colors */
    --primary: var(--color-primary);     /* Legacy primary - maps to color-primary */
    --primary-hover: #07142E;            /* Darker primary for hover */
    --secondary: var(--color-aqua);      /* Legacy secondary - maps to aqua */
    --warning: #FFB020;                  /* Warning color - amber */
    --negative: var(--color-button);     /* Negative/error - maps to button red */
    
    /* Borders & Dividers */
    --border: #D8E0ED;
    --border-light: #E2E8F0;

    /* Chart palette (Datawrapper-aligned: blue-gray UI + data grays) */
    --chart-gray-grid: #E8EBEF;
    --chart-gray-axis: #8A939C;
    --chart-gray-label: #4A5568;
    --chart-gray-data-light: #C0C5C9;    /* U.S. / national benchmark bars */
    --chart-gray-data-mid: #8A939C;      /* secondary comparison */
    --chart-gray-data-dark: #5C6670;
    --chart-gray-data-warm: #C5C9B8;
    --chart-navy: #2E5074;               /* desaturated navy fills (Harvard charts) */
    --chart-aqua: #4A98A8;               /* desaturated teal fills */
    --chart-coral: #D4654A;              /* warm accent series */
    --status-warning: #B34A32;           /* coral text on light — ≥4.5:1 */
    --chart-steel: #6B8CAE;
    --chart-teal-light: #8CB4BD;
    --chart-tan: #B89A7A;
    --chart-deep-blue: #3D6B8E;
    --chart-muted-orange: #C4896E;
    --chart-tooltip-bg: #1A1F2E;
    --chart-segment-border: #3D4550;
    
    /* Switch/Toggle */
    --switch-color: #FF3500;             /* Switch/toggle color */
    
    /* Layout */
    --container-max-width: 1320px;       /* Wide max-width for data display */
    --spacing-unit: 8px;                 /* 8px spacing system */
    --space-1: calc(var(--spacing-unit) * 1);   /* 8px */
    --space-2: calc(var(--spacing-unit) * 2);   /* 16px */
    --space-3: calc(var(--spacing-unit) * 3);   /* 24px */
    --space-4: calc(var(--spacing-unit) * 4);   /* 32px */
    --space-5: calc(var(--spacing-unit) * 5);   /* 40px */
    --space-6: calc(var(--spacing-unit) * 6);   /* 48px */
    --space-8: calc(var(--spacing-unit) * 8);   /* 64px */

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 999px;

    /* Shadows (navy-tinted) */
    --shadow-xs: 0 1px 2px rgba(10, 28, 74, 0.04);
    --shadow-sm: 0 1px 3px rgba(10, 28, 74, 0.06);
    --shadow-md: 0 4px 16px rgba(10, 28, 74, 0.08);
    --shadow-lg: 0 8px 24px rgba(10, 28, 74, 0.1);

    /* Grid */
    --grid-gap: var(--space-4);
    --hub-sidebar-width: 17.5rem;
    
    /* Typography */
    --font-body: 'Open Sans', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
    --font-primary: var(--font-body);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: tabular-nums; /* Tabular numerals for all data */
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-color);
}

h1 {
    font-size: 2.75rem;                 /* Large, confident headlines */
    font-weight: 700;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

h2 {
    font-size: 2rem;
    margin-top: calc(var(--spacing-unit) * 6);
    margin-bottom: calc(var(--spacing-unit) * 3);
    font-weight: 600;
}

h3 {
    font-size: 1.5rem;
    margin-top: calc(var(--spacing-unit) * 4);
    margin-bottom: calc(var(--spacing-unit) * 2);
    font-weight: 600;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

p {
    margin-bottom: calc(var(--spacing-unit) * 2);
    line-height: 1.7;
}

/* Numbers - Always use tabular numerals */
.number, .metric, .stat {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Links (static HTML; keep in sync with edsmart-data-theme/assets/css/base.css) */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

a:focus-visible {
    outline: 2px solid var(--color-aqua);
    outline-offset: 2px;
    border-radius: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--color-aqua);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip link for keyboard + screen reader users */
.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--color-primary);
    color: #FFFFFF;
    z-index: 9999;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
    text-decoration: none;
    font-weight: 700;
}

.skip-link:focus,
.skip-link:focus-visible {
    transform: translateY(0);
}

/* Visually hidden utility for accessible captions/labels */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Header & Navigation */
html {
    overflow-x: clip;
    --site-header-clearance: 7.5rem;
}

html.is-header-compact {
    --site-header-clearance: 5.25rem;
}

body {
    overflow-x: clip;
}

header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 0 rgba(0, 179, 198, 0.12);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.2s ease;
}

html.is-header-compact header {
    box-shadow: 0 2px 10px rgba(26, 35, 50, 0.08);
}

.header-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 3);
}

nav,
.primary-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 3) 0;
    gap: calc(var(--spacing-unit) * 3);
    flex-wrap: wrap;
    transition: padding 0.2s ease, gap 0.2s ease;
}

html.is-header-compact nav,
html.is-header-compact .primary-nav {
    padding: 10px 0;
    gap: 12px;
}

/* Logo styles are in logo.css */

a.logo:focus-visible {
    outline: 2px solid var(--color-aqua);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: calc(var(--spacing-unit) * 4);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.nav-menu a:hover {
    color: var(--color-primary);
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    flex: 0 0 auto;
}

.nav-toggle-bars {
    position: relative;
    display: block;
    width: 1.1rem;
    height: 0.85rem;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.18s ease, top 0.18s ease;
}

.nav-toggle-bars::before {
    top: 0;
    box-shadow: 0 0.325rem 0 currentColor;
}

.nav-toggle-bars::after {
    bottom: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
    top: 0.325rem;
    box-shadow: none;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
    bottom: auto;
    top: 0.325rem;
    transform: rotate(-45deg);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--color-aqua);
    outline-offset: 2px;
}

/* Search Bar in Header */
.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 calc(var(--spacing-unit) * 3);
    transition: max-width 0.2s ease, margin 0.2s ease;
}

.header-search-form {
    margin: 0;
    width: 100%;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.header-search input {
    width: 100%;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--surface-alt);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, padding 0.2s ease, font-size 0.2s ease;
    font-family: var(--font-body);
}

.header-search input:focus {
    outline: 2px solid var(--color-aqua);
    outline-offset: 2px;
    border-color: var(--color-aqua);
}

.header-search input::placeholder {
    color: var(--text-secondary);
}

html.is-header-compact .header-search {
    max-width: 340px;
    margin: 0 12px;
}

html.is-header-compact .header-search input {
    padding: 8px 14px;
    font-size: 0.875rem;
}

@media (min-width: 769px) {
    html.is-header-compact .nav-toggle {
        display: inline-flex;
    }

    html.is-header-compact .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        order: 10;
        margin: 0;
        padding: 0.35rem 0 0.15rem;
        border-top: 1px solid var(--border-light, #e2e8f0);
    }

    html.is-header-compact.is-nav-open .nav-menu {
        display: flex;
    }

    html.is-header-compact .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border-light, #e2e8f0);
    }

    html.is-header-compact .nav-menu li:last-child {
        border-bottom: none;
    }

    html.is-header-compact .nav-menu a {
        display: block;
        padding: 0.7rem 0.25rem;
        font-family: var(--font-heading);
        font-weight: 600;
        font-size: 0.95rem;
    }
}

/* Main Content Container */
main {
    min-height: calc(100vh - 200px);
    padding: calc(var(--spacing-unit) * 6) 0;
    min-width: 0;
    max-width: 100%;
}

.container {
    max-width: var(--container-max-width);
    width: 100%;
    min-width: 0; /* flex/grid child: allow shrinking so inner scroll areas respect viewport */
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 3);
    box-sizing: border-box;
}

/* Content Cards - White cards, thin border, no shadows */
.content-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: calc(var(--spacing-unit) * 4);
    margin-bottom: calc(var(--spacing-unit) * 3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.content-card:hover {
    border-color: rgba(0, 179, 198, 0.4);
    box-shadow: 0 8px 24px rgba(10, 28, 74, 0.08);
}

article {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--color-primary);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(10, 28, 74, 0.06);
    padding: calc(var(--spacing-unit) * 5);
    margin-bottom: calc(var(--spacing-unit) * 3);
    min-width: 0; /* lets wide children (e.g. scrollable tables) respect the article max-width */
}

/* Breadcrumbs */
.breadcrumbs {
    margin: calc(var(--spacing-unit) * 2.5) 0 calc(var(--spacing-unit) * 3.5);
    padding: 0;
}

.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0;
    margin: 0;
    padding: 0;
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.35;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    color: var(--text-secondary);
}

.breadcrumbs li:not(:last-child)::after {
    content: "";
    display: block;
    width: 0.35rem;
    height: 0.35rem;
    margin: 0 0.55rem 0 0.45rem;
    border-right: 1.5px solid var(--text-meta);
    border-bottom: 1.5px solid var(--text-meta);
    transform: rotate(-45deg);
    opacity: 0.7;
    flex: 0 0 auto;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 5px;
    padding: 0.2rem 0.35rem;
    margin: -0.2rem -0.15rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    color: var(--color-primary);
    background-color: var(--surface-alt);
    outline: none;
}

.breadcrumbs a:focus-visible {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px rgba(10, 28, 74, 0.25);
}

.breadcrumbs li[aria-current="page"] {
    color: var(--color-primary);
    font-weight: 700;
    padding: 0.2rem 0.1rem;
    max-width: min(100%, 28rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .breadcrumbs {
        margin-bottom: calc(var(--spacing-unit) * 2);
    }

    .breadcrumbs ol {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        font-size: 0.75rem;
        padding-bottom: 0.15rem;
        scrollbar-width: none;
    }

    .breadcrumbs ol::-webkit-scrollbar {
        display: none;
    }

    .breadcrumbs li {
        flex: 0 0 auto;
    }

    .breadcrumbs li[aria-current="page"] {
        max-width: none;
    }
}

/* Buttons - Rectangular with soft rounding */
.btn-primary {
    display: inline-block;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 4);
    background: linear-gradient(135deg, var(--color-primary) 0%, #152A52 100%);
    color: var(--button-text-color) !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: filter 0.2s ease, background-color 0.2s ease;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-primary:active {
    filter: brightness(0.96);
}

.btn-primary:disabled {
    background: var(--button-color-disabled);
    filter: none;
    cursor: not-allowed;
    opacity: 0.85;
}

.btn-secondary {
    display: inline-block;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 4);
    background-color: transparent;
    color: var(--color-link) !important;
    text-decoration: none;
    border: 2px solid var(--color-aqua);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-family: var(--font-body);
}

.btn-secondary:hover {
    background-color: var(--color-aqua-soft);
    border-color: var(--color-aqua);
}

.btn-success {
    background-color: var(--button-success);
    color: var(--button-text-color);
}

.btn-success:hover {
    background-color: var(--button-success-hover);
}

/* Footer — static HTML pages only (plain <footer>). WP uses <footer class="wp-block-template-part">. */
footer:not(.wp-block-template-part) {
    background-color: var(--color-primary);
    color: rgba(255, 255, 255, 0.9);
    padding: calc(var(--spacing-unit) * 8) 0 calc(var(--spacing-unit) * 4);
    margin-top: calc(var(--spacing-unit) * 10);
}

.footer-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 3);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: calc(var(--spacing-unit) * 6);
    margin-bottom: calc(var(--spacing-unit) * 6);
}

.footer-section h3 {
    color: white;
    margin-bottom: calc(var(--spacing-unit) * 3);
    font-size: 1.1rem;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.footer-section a {
    color: #9CF0FF;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: #FFFFFF;
}

.footer-bottom {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

/* Section Spacing - Generous whitespace */
section {
    margin: calc(var(--spacing-unit) * 6) 0;
}

/* Responsive */
@media (max-width: 768px) {
    .primary-nav,
    header .header-container > nav {
        flex-wrap: wrap;
        gap: calc(var(--spacing-unit) * 1.5);
        padding: calc(var(--spacing-unit) * 2) 0;
    }

    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .header-search {
        display: none;
    }

    .nav-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        order: 10;
        margin: 0;
        padding: 0.35rem 0 0.15rem;
        border-top: 1px solid var(--border-light, #e2e8f0);
    }

    html.is-nav-open .nav-menu {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--border-light, #e2e8f0);
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-menu a {
        display: block;
        padding: 0.85rem 0.25rem;
        font-family: var(--font-heading);
        font-weight: 600;
        font-size: 0.95rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .container {
        padding: 0 calc(var(--spacing-unit) * 2);
    }
}
