/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --primary-blue: #233E7D;
    --primary-green: #5C7F39;
    --light-gray: #DADADA;
    --white: #ffffff;
    --dark-text: #333333;
    --description-text: #242C39;
    --section-height: 500px;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: var(--white);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Scroll lock for mobile menu */
body.noscroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Arial', sans-serif;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
}

/* Ensure images in stats sections maintain aspect ratio */
.stats-image {
    object-fit: cover;
    object-position: center;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: transparent;
    color: var(--primary-blue);
    padding: 6px 10px;
    text-decoration: none;
    z-index: 2000;
    border-radius: 0 0 var(--border-radius) 0;
    font-weight: 600;
    border: 2px solid var(--primary-blue);
    font-family: 'Arial', sans-serif;
    font-size: 0.875rem;
    transition: top 0.3s ease;
    clip-path: none;
    width: auto;
    height: auto;
    overflow: visible;
    white-space: nowrap;
}

.skip-link:focus {
    top: 0;
    background: var(--primary-blue);
    color: white;
    outline: 2px solid var(--primary-green);
    outline-offset: 1px;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Focus styles */
button:focus,
a:focus:not(.skip-link),
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--primary-green);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
    button:focus,
    a:focus:not(.skip-link) {
        transition: outline 0.2s ease, transform 0.2s ease;
    }
}

/* Enhanced mobile focus styles */
@media (max-width: 768px) {
    .skip-link {
        padding: 5px 8px;
        font-size: 0.8rem;
        top: -35px;
    }
    
    .skip-link:focus {
        top: 0;
        box-shadow: 0 0 0 2px var(--primary-green), 0 2px 4px rgba(0,0,0,0.2);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #000080;
        --primary-green: #006400;
        --dark-text: #000000;
    }
    
    .skip-link {
        background: transparent;
        color: #000000;
        border: 2px solid #000000;
    }
    
    .skip-link:focus {
        background: #000000;
        color: #ffffff;
        border: 2px solid #ffffff;
    }
    
    .cta-gradient,
    .social-gradient {
        background: linear-gradient(135deg, #000080, #006400) !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .skip-link {
        transition: none;
    }
    
    .skip-link:focus {
        transition: none;
    }
}

/* ==========================================================================
   Typography
   ========================================================================== */
.hero-heading {
    font-size: 3rem;
    line-height: 1.2;
}

.hero-subheading {
    font-size: 1.8rem;
}

.hero-description {
    font-size: 1.3rem;
}

/* ==========================================================================
   Components
   ========================================================================== */
.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
}

.stat-highlight {
    background: linear-gradient(135deg, var(--primary-green), #4a6d2f);
}

.cta-gradient {
    background: linear-gradient(135deg, var(--primary-green), #4a6d2f) !important;
}

.cta-gradient:hover {
    background: linear-gradient(135deg, #4a6d2f, var(--primary-green)) !important;
}

.social-gradient {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-green) 100%);
}

.custom-shadow {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Form Styles
   ========================================================================== */
.form-message.success {
    color: var(--primary-green);
}

.form-message.error {
    color: #D8000C;
}

/* Enhanced form input styling */
input, textarea {
    font-family: 'Arial', sans-serif;
    transition: var(--transition);
}

input:focus, textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(92, 127, 57, 0.2);
}

/* Loading state for buttons */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.mobile-nav-item {
    position: relative;
    border-bottom: 1px solid var(--light-gray);
}

.mobile-nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-green));
    transition: width 0.3s ease;
}

.mobile-nav-item:hover::after,
.mobile-nav-item:focus::after {
    width: 100%;
}

/* Remove gradient for sub-items in mobile view */
@media (max-width: 1024px) {
    .mobile-dropdown-content .mobile-nav-item::after {
        display: none;
    }
}

/* ==========================================================================
   Icons
   ========================================================================== */
.bluesky-icon {
    fill: white !important;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer-modern {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1a2d5a 100%);
}

.footer-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   JotForm Responsive Container
   ========================================================================== */
.jotform-iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.jotform-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ==========================================================================
   Alpine.js
   ========================================================================== */
[x-cloak] {
    display: none !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .hero-heading {
        font-size: 2.5rem;
    }
    
    .hero-subheading {
        font-size: 1.5rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }

    .jotform-iframe-container {
        padding-bottom: 120%; /* Taller aspect ratio for mobile */
    }
}

@media (max-width: 576px) {
    .hero-heading {
        font-size: 2rem;
    }
    
    .hero-subheading {
        font-size: 1.2rem;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.font-heading {
    font-family: 'Arial', sans-serif;
}

.font-body {
    font-family: 'Georgia', serif;
}

.rounded-custom {
    border-radius: var(--border-radius);
}

/* ==========================================================================
   Animations
   ========================================================================== */
.mobile-menu-enter {
    transform: translateX(-100%);
}

.mobile-menu-enter-active {
    transform: translateX(0);
    transition: transform 0.3s ease;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .skip-link,
    .mobile-menu-button,
    .cta-gradient,
    .social-gradient {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000 !important;
        background: #fff !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
    
    .hero-heading,
    .hero-subheading,
    h1, h2, h3, h4, h5, h6 {
        color: #000 !important;
    }
    
    /* Ensure good contrast for printed text */
    .text-primary-blue,
    .text-primary-green,
    .text-description-text {
        color: #000 !important;
    }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .feature-icon,
    .cta-gradient,
    .social-gradient,
    .mobile-nav-item::after,
    .custom-shadow {
        transition: none !important;
    }
    
    .hover\\:scale-105:hover,
    .hover\\:-translate-y-1:hover,
    .hover\\:translate-x-1:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Reduced motion for loading animations */
@media (prefers-reduced-motion: reduce) {
    .loading::after {
        animation: none;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}