/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* @import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Merriweather:wght@400;700&display=swap'); */ /* Uncomment to use Google Fonts */

:root {
    --primary-color: #005a9c; /* Deep Blue */
    --secondary-color: #f0f6fa; /* Lighter, softer blue accent */
    --text-color: #343a40; /* Darker gray for better contrast */
    --heading-color: #1a3a59; /* Dark Blue */
    --background-color: #ffffff;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --link-color: #005a9c;
    --link-hover-color: #003d6b;
    --focus-ring-color: rgba(0, 90, 156, 0.35); /* Slightly stronger focus ring */

    /* Uncomment the lines below if using Google Fonts */
    /* --font-family-sans: 'Lato', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; */
    /* --font-family-serif: 'Merriweather', Georgia, 'Times New Roman', Times, serif; */

    /* Use system fonts as a robust default */
    --font-family-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
    --font-family-serif: Georgia, 'Times New Roman', Times, serif; /* Keep serif simple or use Merriweather */

    --container-width: 1140px; /* Wider container for modern screens */
    --spacing-unit: 1rem; /* Approx 16px */
    --border-radius: 4px; /* Consistent border radius */
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-sans);
    line-height: 1.65; /* Slightly adjusted line height */
    color: var(--text-color);
    background-color: var(--background-color);
    font-size: 100%; /* Base font size (usually 16px) */
    -webkit-font-smoothing: antialiased; /* Smoother fonts on WebKit */
    -moz-osx-font-smoothing: grayscale; /* Smoother fonts on Firefox */
}

/* === Typography === */
h1, h2, h3 {
    font-family: var(--font-family-serif);
    color: var(--heading-color);
    line-height: 1.3;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    font-weight: 700; /* Slightly bolder headings */
}

h1 { /* Page Titles */
    font-size: clamp(2rem, 5vw, 2.6rem); /* Slightly adjusted clamp */
    margin-top: calc(var(--spacing-unit) * 1.5); /* More space above page title */
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: calc(var(--spacing-unit) * 0.5);
    display: inline-block; /* Keep inline-block for border effect */
}

h2 { /* Section Titles */
    font-size: clamp(1.5rem, 4vw, 1.9rem); /* Slightly adjusted */
    margin-top: calc(var(--spacing-unit) * 2.5); /* More space above section titles */
    color: var(--primary-color);
    font-family: var(--font-family-sans); /* Use sans-serif for section titles */
    font-weight: 700;
}

h3 { /* Sub-section Titles */
     font-size: clamp(1.15rem, 3vw, 1.4rem); /* Slightly adjusted */
     margin-top: calc(var(--spacing-unit) * 2); /* More space */
     color: var(--heading-color);
     font-family: var(--font-family-sans);
     font-weight: 600;
}


p {
    margin-bottom: var(--spacing-unit);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Add transition for focus */
    border-radius: 2px; /* Subtle radius for focus outline */
}

a:hover, a:focus {
    color: var(--link-hover-color);
    text-decoration: underline;
    outline: none; /* Remove default outline if using box-shadow */
}

a:focus-visible { /* Modern focus indicator */
    outline: 2px solid transparent; /* Fallback */
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    text-decoration: none; /* Avoid underline competing with focus ring */
}

strong {
    font-weight: 600;
}

blockquote {
    background: var(--secondary-color);
    border-left: 5px solid var(--primary-color);
    margin: calc(var(--spacing-unit) * 1.5) 0;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    font-style: italic;
    font-size: 1.1rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

blockquote footer {
    text-align: right;
    font-style: normal;
    margin-top: calc(var(--spacing-unit) * 0.5);
    font-weight: 600;
    color: var(--heading-color);
}

/* === Layout === */
.container {
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--spacing-unit);
    padding-right: var(--spacing-unit);
}

header {
    background: var(--primary-color);
    color: #fff;
    padding: calc(var(--spacing-unit) * 0.5) 0; /* Further reduced padding */
    margin-bottom: calc(var(--spacing-unit) * 2.5);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    position: sticky; /* Make header sticky */
    top: 0;
    z-index: 100;
}

header .container { /* Ensure header content aligns with main content */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
    gap: 0; /* Further reduced gap for vertical spacing */
    text-align: center; /* Center text within the container */
}


header h1 { /* Site Title in Header */
    font-size: clamp(1.6rem, 4vw, 2rem); /* Slightly smaller header title */
    margin: 0; /* Remove bottom margin */
    border: none;
    padding: 0;
    color: #fff;
    font-family: var(--font-family-sans); /* Consistent sans-serif */
    font-weight: 700;
}

header p { /* Tagline */
    font-size: 0.95rem; /* Slightly smaller tagline */
    margin-bottom: 0; /* Remove bottom margin */
    opacity: 0.9;
    flex-basis: 100%; /* Make tagline take full width initially */
    text-align: center; /* Center tagline below title on small screens */
}

header .container .header-logo {
    height: 75px; /* Ensure consistent height */
    width: auto; /* Maintain aspect ratio */
    display: block; /* Ensure block behavior */
    margin-top: calc(var(--spacing-unit) * 0.5);
    margin-bottom: 0; /* Adjusted space below logo to match top padding minus tagline margin */
    margin-right: 0; /* Remove right margin */
    flex-shrink: 0; /* Prevent shrinking */
    flex-grow: 0; /* Prevent growing */
}


header h1, header p {
    /* Removed inline-block and vertical-align for flex column layout */
    margin: 0; /* Keep margin reset */
}

header h1 {
    font-size: clamp(1.6rem, 4vw, 2rem);
    color: #fff;
    font-family: var(--font-family-sans);
    font-weight: 700;
}

header p {
    font-size: 0.95rem;
    opacity: 0.9;
    /* flex-basis: 100%; /* Removed to allow it to sit next to h1 */
    text-align: left; /* Align text left */
    margin-top: calc(var(--spacing-unit) * 0.15); /* Add slight space above tagline */
    margin-left: 0; /* Remove left margin */
}

header nav {
    margin-top: calc(var(--spacing-unit) * 0.15); /* Adjust margin */
}

main {
    padding-bottom: calc(var(--spacing-unit) * 2);
    margin-top: calc(var(--spacing-unit) * 2); /* Add space below sticky header */
}

section {
    margin-bottom: calc(var(--spacing-unit) * 2.5);
}

footer.site-footer {
    background-color: var(--light-gray);
    color: #666;
    text-align: center;
    padding: calc(var(--spacing-unit) * 1.5) 0;
    margin-top: calc(var(--spacing-unit) * 3);
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* === Navigation === */
header nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center; /* Center nav items */
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit) * 1.25); /* Adjusted gap */
    margin: 0; /* Remove default margin */
}

header nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 0.25rem; /* Adjust padding */
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease; /* Add background transition for focus */
    font-size: 0.95rem;
    border-radius: var(--border-radius); /* Add radius for focus */
}

header nav ul li a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--secondary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

header nav ul li a:hover,
header nav ul li a:focus,
header nav ul li a.active /* Style for active link */
{
    color: #fff; /* Keep color white */
    text-decoration: none; /* Remove underline on hover/focus */
    outline: none;
}

header nav ul li a:hover::after,
header nav ul li a:focus::after,
header nav ul li a.active::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Clearer focus style for keyboard navigation */
header nav ul li a:focus-visible {
    outline: 2px solid transparent; /* Hide default outline */
    background-color: rgba(255, 255, 255, 0.15); /* Subtle background highlight */
    box-shadow: none; /* Don't need box-shadow here */
}


/* === Components === */
.hero-image {
    width: 100%;
    max-height: 263px; /* Increased display height by 50% */
    object-fit: contain; /* Scale image down to fit within container */
    border-radius: var(--border-radius); /* Consistent radius */
    margin-bottom: calc(var(--spacing-unit) * 2.5); /* More space below image */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Adjusted shadow */
}

.action-section {
    background-color: var(--secondary-color);
    padding: calc(var(--spacing-unit) * 2); /* More padding */
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-top: calc(var(--spacing-unit) * 2.5); /* More space */
    background-color: var(--secondary-color); /* Use updated secondary color */
    text-align: center; /* Center content within the action section */
}

/* Styles for the CAF Donate Widget Container */
#CAFDonateWidgetContainer {
    margin: 2.5rem auto; /* Top/bottom margin, auto left/right for centering */
    width: 100%; /* Ensure it takes full width up to max-width */
    max-width: 500px; /* Reduced max width for the widget */
    border: 1px solid var(--border-color); /* Subtle border */
    border-radius: var(--border-radius); /* Match site's border-radius */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    background-color: var(--background-color); /* Ensure white background */
    text-align: center; /* Center content horizontally within the widget */
}

/* Responsive adjustments for the widget container */
@media (max-width: 767.98px) {
    #CAFDonateWidgetContainer {
        margin: 2rem auto;
    }
}

@media (max-width: 575.98px) {
    #CAFDonateWidgetContainer {
        margin: 1.5rem auto;
    }
}

.action-section h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-family: var(--font-family-sans);
    font-size: 1.4rem; /* Slightly larger */
    margin-bottom: calc(var(--spacing-unit) * 0.75);
}

.button, button[type="submit"] {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.8); /* Slightly larger padding */
    border: none;
    border-radius: var(--border-radius); /* Consistent radius */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease; /* Faster transitions */
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid transparent; /* Add border for focus consistency */
}

.button:hover, button[type="submit"]:hover {
    background-color: var(--link-hover-color);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.button:focus-visible, button[type="submit"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color), 0 4px 8px rgba(0, 0, 0, 0.15); /* Combine focus ring and hover shadow */
    border-color: var(--link-hover-color); /* Add border color on focus */
}

/* === Forms === */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 1.25);
}

.form__label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) * 0.4);
    font-weight: 600;
    color: var(--heading-color);
    font-size: 0.95rem;
}

.form__label-required {
    color: #dc3545; /* Red for required */
    margin-left: 0.25rem;
}

.form__input,
.form__input--textarea {
    width: 100%;
    padding: calc(var(--spacing-unit) * 0.75); /* Consistent padding */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius); /* Consistent radius */
    font-size: 1rem;
    font-family: var(--font-family-sans);
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
}

.form__input:focus,
.form__input--textarea:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px var(--focus-ring-color); /* Use variable */
}

.form__input--textarea {
    resize: vertical;
    min-height: 120px;
}

input[type="file"].form__input {
    padding: calc(var(--spacing-unit) * 0.5);
    /* Specific styling for file input if needed */
    border: 1px solid var(--border-color); /* Use solid border */
    background-color: var(--background-color); /* Standard background */
}
input[type="file"].form__input:hover,
input[type="file"].form__input:focus {
    border-color: var(--primary-color);
}


/* === Responsive === */

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
    :root {
        --container-width: 720px; /* Adjust container for tablets */
    }
    /* Tablet adjustments for header */
    header p { /* Tagline */
       text-align: center;
       flex-basis: 100%; /* Ensure tagline is below title */
       margin-top: calc(var(--spacing-unit) * 0.5);
    }
    header nav {
        margin-top: 0; /* Reduced space between title/tagline and nav */
        width: 100%; /* Allow nav to take full width */
    }
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
    :root {
        --container-width: 540px; /* Adjust container */
    }
    body {
        font-size: 95%; /* Slightly smaller base font */
    }
    /* Small device adjustments for header */
    header h1 { /* Site Title */
        margin-bottom: 0; /* Removed space below heading on small screens */
    }
    header p { /* Tagline */
       margin-top: 0;
    }
    header nav ul {
        /* Ensure single row layout */
        /* flex-wrap: wrap; /* Removed */
        /* justify-content: center; /* Removed */
        gap: calc(var(--spacing-unit) * 0.5) var(--spacing-unit); /* Keep gap for spacing between items */
    }
    header nav ul li a {
        /* Adjustments for single row */
        /* flex-basis: 31%; /* Removed */
        /* text-align: center; /* Removed */
        font-size: 0.9em; /* Reduced font size */
        padding: 0.5rem 0.15rem; /* Reduced horizontal padding */
    }
    header nav {
        margin-top: 0; /* Further reduced space above nav on small screens */
    }
    main {
         margin-top: calc(var(--spacing-unit) * 1.5); /* Adjust space below sticky header */
    }
    h1 { font-size: clamp(1.8rem, 5vw, 2.2rem); }
    h2 { font-size: clamp(1.4rem, 4vw, 1.7rem); }
    h3 { font-size: clamp(1.1rem, 3vw, 1.3rem); }

    .hero-image {
        margin-bottom: calc(var(--spacing-unit) * 2);
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    :root {
        /* Container is effectively full width due to padding */
        --container-width: 100%;
    }
    body {
        font-size: 90%; /* Further reduce base font size */
        line-height: 1.6;
    }
     header nav ul li a {
        font-size: 0.8rem; /* Further reduced font size */
        padding: 0.4rem 5px; /* Further reduced horizontal padding */
        flex-basis: 31%; /* Try slightly larger basis for 3 items per row */
        text-align: center; /* Center text within the item */
     }
     header nav ul {
        /* Ensure flex properties are explicitly set for mobile */
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: calc(var(--spacing-unit) * 0.4) calc(var(--spacing-unit) * 0.8); /* Tighter gap */
     }
     .button, button[type="submit"] {
        width: 100%; /* Make buttons full width */
        padding: calc(var(--spacing-unit) * 0.9) calc(var(--spacing-unit) * 1.5); /* Adjust padding */
        font-size: 0.95rem;
     }
     .form__input, .form__input--textarea {
        padding: calc(var(--spacing-unit) * 0.65);
     }
} /* Closing brace for the @media (max-width: 575.98px) query */