/**
 * Borealis Institutional Governance Theme - ULTRA POLISHED PROTOCOL
 * Implementation of DESIGN_SPEC.md Component Library
 */

@import url("variables.css");

/* ==========================================================================
   GLOBAL RESET & BASE
   ========================================================================== */
body.gov-theme {
    background-color: var(--bg-01);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--type-body);
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

/* Container */
.gov-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    width: 100%;
    box-sizing: border-box;
}

/* 12-Column Grid */
.gov-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-gap);
}
.gov-grid > * {
    min-width: 0;
}

/* Section Rhythm */
.gov-section {
    padding: 72px 0; /* Updated Desktop Padding */
}

@media (max-width: 991px) {
    .gov-section {
        padding: 56px 0; /* Tablet */
    }
}

@media (max-width: 767px) {
    .gov-section {
        padding: 40px 0; /* Mobile */
    }
}

/* Alternating Backgrounds */
.gov-section-white {
    background-color: #FFFFFF;
}

.gov-section-alt {
    background-color: #F6F8FA;
}


/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
.gov-h1 {
    font-size: var(--type-h1);
    line-height: var(--lh-h1);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 24px;
}

.gov-h2 {
    font-size: var(--type-h2);
    line-height: var(--lh-h2);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: var(--space-content-y); /* 48px to content */
}

.gov-h3 {
    font-size: var(--type-h3);
    line-height: var(--lh-h3);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 16px;
}

.gov-h4 {
    font-size: 18px;
    line-height: 1.4;
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 8px;
}

.gov-body {
    font-size: var(--type-body);
    line-height: var(--lh-body);
    color: var(--text-primary);
    margin-bottom: 24px;
    max-width: 80ch; /* ~70-80 chars readability */
}

.gov-body-small {
    font-size: var(--type-small);
    line-height: var(--lh-ui);
    color: var(--text-muted);
}

.gov-label {
    font-size: var(--type-small);
    font-weight: var(--weight-semibold);
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    display: block;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.gov-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px; /* 16-18px spec */
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-pill);
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.2;
    gap: 8px;
}

/* Primary: Green Fill */
.gov-btn-primary {
    background-color: var(--accent-primary);
    color: var(--text-on-accent);
    border-color: var(--accent-primary);
}

.gov-btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Secondary: Outline */
.gov-btn-secondary {
    background-color: transparent;
    color: var(--accent-primary);
    border-color: var(--border-01); /* Or accent-primary based on pref, spec says accent or border */
    border: 1px solid var(--accent-primary);
}

.gov-btn-secondary:hover {
    background-color: var(--accent-primary-light);
}

/* Tertiary: Text Link */
.gov-btn-tertiary {
    background: none;
    border: none;
    color: var(--accent-primary);
    padding: 0;
    font-size: 16px;
    font-weight: var(--weight-regular);
}

.gov-btn-tertiary:hover {
    text-decoration: underline;
    color: var(--accent-primary-hover);
}

.w-100 { width: 100%; }

/* ==========================================================================
   CARDS
   ========================================================================== */
/* Base Standard Info Card */
.gov-card {
    background-color: var(--surface-01);
    border: 1px solid var(--border-01);
    border-radius: var(--radius-card);
    padding: var(--space-card-padding);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gov-card:hover {
    /* Subtle hover effect */
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Highlight Card */
.gov-card-highlight {
    border-top: 4px solid var(--accent-primary);
}

/* Flat Card (No Shadow/Border) */
.gov-card-flat {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}
.gov-card-flat:hover {
    transform: none;
    box-shadow: none;
}

/* Program Card (Icon top-left) */
.gov-card-program {
    /* Inherits gov-card base */
}
.gov-card-program .gov-icon {
    margin-bottom: 24px;
    color: var(--accent-secondary);
    font-size: 32px; /* Single line style */
}

/* Timeline Card */
.gov-card-timeline {
    /* Inherits gov-card base */
}
.gov-timeline-pill {
    display: inline-block;
    background: var(--accent-secondary-light);
    color: var(--accent-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--type-small);
    font-weight: var(--weight-semibold);
    margin-bottom: 16px;
}

/* Shield / Credential Card (Elevated) */
.gov-card-shield {
    background-color: var(--surface-01);
    border: 1px solid var(--border-01); /* Slightly thicker border could be applied */
    box-shadow: var(--shadow-elevated);
    border-radius: var(--radius-card);
    padding: 32px;
    position: relative;
    border-top: 4px solid var(--accent-primary); /* Optional branding touch */
}
.gov-card-shield .shield-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-01);
    padding-bottom: 16px;
}
.gov-card-shield .shield-icon {
    font-size: 24px;
    color: var(--accent-primary);
}
.gov-card-shield .shield-label {
    font-size: var(--type-small);
    font-weight: var(--weight-bold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Resource Card */
.gov-card-resource {
    /* Inherits gov-card */
}
.gov-card-resource .resource-category {
    font-size: var(--type-small);
    font-weight: var(--weight-bold);
    color: var(--accent-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}

/* ==========================================================================
   CHIPS
   ========================================================================== */
.gov-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    background-color: var(--accent-primary-light);
    color: var(--accent-primary);
    font-size: var(--type-small);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.gov-chip.secondary {
    background-color: var(--accent-secondary-light);
    color: var(--accent-secondary);
}

.gov-chip.small {
    font-size: 14px;
    padding: 4px 10px;
}

/* ==========================================================================
   LISTS
   ========================================================================== */
ul.gov-list {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

ul.gov-list li {
    position: relative;
    padding-left: 28px; /* Space for bullet */
    margin-bottom: 12px;
    font-size: var(--type-body);
    line-height: var(--lh-body);
    color: var(--text-primary);
}

ul.gov-list li::before {
    content: "•";
    color: var(--accent-primary);
    font-size: 1.5em; /* Larger bullet */
    line-height: 1;
    position: absolute;
    left: 0;
    top: -2px; /* Visual alignment */
}

/* ==========================================================================
   STATE SELECTOR COMPONENT
   ========================================================================== */
.gov-state-selector {
    display: flex;
    background: var(--surface-01);
    border: 1px solid var(--border-01);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    min-height: 550px;
}

.gov-state-list {
    width: 300px;
    background: var(--bg-01); /* Slightly distinct bg */
    border-right: 1px solid var(--border-01);
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gov-state-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: var(--weight-medium);
}

.gov-state-btn:hover {
    background: rgba(0,0,0,0.03);
    color: var(--text-primary);
}

.gov-state-btn.active {
    background: var(--surface-01);
    color: var(--accent-primary);
    font-weight: var(--weight-bold);
    border-left: 4px solid var(--accent-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.gov-state-detail {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ==========================================================================
   ACCORDION (FAQ)
   ========================================================================== */
.gov-accordion {
    border-bottom: 1px solid var(--border-01);
    padding: 24px 0;
}

.gov-accordion:first-child {
    border-top: 1px solid var(--border-01);
}

.gov-accordion-header {
    font-weight: var(--weight-semibold);
    font-size: 18px;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gov-accordion-header::-webkit-details-marker,
details > summary {
    list-style: none;
}
details > summary::-webkit-details-marker {
    display: none;
}

.gov-accordion-header::after {
    content: '+';
    font-size: 24px;
    font-weight: var(--weight-regular);
    color: var(--accent-primary);
}

details[open] .gov-accordion-header::after {
    content: '−';
}

.gov-accordion-body {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.6;
    max-width: 90%;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.gov-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.gov-table th, .gov-table td {
    padding: 24px;
    text-align: left;
    border-bottom: 1px solid var(--border-01);
}
.gov-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-01);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* ==========================================================================
   FOOTER OVERRIDES (Light background footer)
   ========================================================================== */
.ultra-footer {
    color: #374151 !important; /* Dark text on light background */
}

.ultra-footer h3,
.ultra-footer .footer-logo-link span {
    color: #111827 !important; /* Near-black for headers */
}

.ultra-footer a {
    color: #374151 !important;
    text-decoration: none;
}

.ultra-footer a:hover {
    color: #111827 !important;
    text-decoration: underline !important;
}

.ultra-footer ul li a,
.ultra-footer .contact-compact a,
.ultra-footer p,
.ultra-footer .legal-links a {
    font-size: 15px; /* 14-15px */
    line-height: 1.6; /* ~24px */
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-4 { margin-bottom: 24px !important; }
.mb-6 { margin-bottom: 48px !important; }
.p-4 { padding: 24px !important; }
.p-6 { padding: 48px !important; }
.mt-4 { margin-top: 24px !important; }
.mt-6 { margin-top: 48px !important; }
.h-100 { height: 100%; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.me-2 { margin-right: 8px; }
.me-3 { margin-right: 16px; }

/* Grid Helpers */
/* These utilities are intended for use inside the 12-column `.gov-grid`.
   Keeping them scoped prevents accidental stacking inside bespoke grids
   (e.g., `.hero-grid`, `.pricing-grid`) that are not 12-column. */
.gov-grid .gov-col-span-3 { grid-column: span 3; }
.gov-grid .gov-col-span-4 { grid-column: span 4; }
.gov-grid .gov-col-span-5 { grid-column: span 5; }
.gov-grid .gov-col-span-6 { grid-column: span 6; }
.gov-grid .gov-col-span-7 { grid-column: span 7; }
.gov-grid .gov-col-span-8 { grid-column: span 8; }
.gov-grid .gov-col-span-9 { grid-column: span 9; }
.gov-grid .gov-col-span-12 { grid-column: span 12; }

/* Responsive */
@media (max-width: 960px) {
    .gov-grid { grid-template-columns: 1fr; }
    .gov-grid .gov-col-span-3,
    .gov-grid .gov-col-span-4,
    .gov-grid .gov-col-span-5,
    .gov-grid .gov-col-span-6,
    .gov-grid .gov-col-span-7,
    .gov-grid .gov-col-span-8,
    .gov-grid .gov-col-span-9 { grid-column: span 1; }

    .gov-state-selector { flex-direction: column; }
    .gov-state-list { width: 100%; height: 200px; border-right: none; border-bottom: 1px solid var(--border-01); }

    .gov-hero-grid {
        grid-template-columns: 1fr;
    }
}
