/* ==========================================================================
   Boone County, Illinois - global styles
   Palette sampled from the county seal. Text/background pairs are chosen to
   meet WCAG 2.2 AA contrast (4.5:1 text, 3:1 UI components).
   ========================================================================== */

:root {
    --forest-950: #0f2417;
    --forest-900: #193925; /* seal outer ring, deepest */
    --forest-800: #24402f;
    --forest-700: #2f5240;
    --forest-100: #e8f0ea;
    --forest-50: #f4f8f5;

    --leaf: #72d35c; /* seal inner ring */
    --gold: #c6d347; /* "County Fairgrounds" sign */
    --brick: #7a3b45; /* courthouse brick, darkened for contrast */

    --ink: #17241c;
    --ink-soft: #3d4a42;
    --link: #1b5e35;
    --link-hover: #123f24;
    --border: #cfdcd3;
    --focus: #ffbf47;
    --focus-dark: #0b3d91;

    --radius: 0.5rem;
    --shadow: 0 2px 10px rgba(15, 36, 23, 0.12);
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background: #fff;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4 {
    line-height: 1.25;
    color: var(--forest-900);
    margin: 0 0 0.75rem;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1rem; }

address {
    font-style: normal;
}

a {
    color: var(--link);
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--link-hover);
    text-decoration-thickness: 2px;
}

/* Visible focus for every interactive element (WCAG 2.4.7 / 2.4.13). */
:focus-visible {
    outline: 3px solid var(--focus-dark);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--focus);
    border-radius: 2px;
}

/* Programmatic focus targets (main, h1 via FocusOnNavigate) get no ring. */
main:focus,
h1:focus {
    outline: none;
    box-shadow: none;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 1.25rem;
}

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 2000;
    padding: 0.75rem 1.25rem;
    background: var(--gold);
    color: var(--forest-950);
    font-weight: 700;
    border-radius: 0 0 var(--radius) var(--radius);
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

/* ---------- Header ---------- */
.site-header {
    position: relative;
    z-index: 100;
    background: #fff;
    box-shadow: var(--shadow);
}

.utility-bar {
    background: var(--forest-900);
    color: #fff;
    font-size: 0.9375rem;
}

.utility-bar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1.5rem;
    padding-block: 0.35rem;
}

.utility-bar__tagline {
    margin: 0;
}

.utility-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.utility-list a {
    display: inline-block;
    padding: 0.5rem 0.6rem;
    color: #fff;
    text-decoration: none;
}

.utility-list a:hover {
    color: var(--gold);
    text-decoration: underline;
}

.utility-bar :focus-visible {
    outline-color: var(--gold);
    box-shadow: none;
}

.header-main {
    border-bottom: 4px solid var(--leaf);
}

.header-main__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding-block: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    color: var(--forest-900);
    text-decoration: none;
}

.brand:hover {
    color: var(--forest-900);
}

.brand img {
    width: 64px;
    height: 64px;
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand__name {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.brand__state {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--brick);
}

/* ---------- Primary navigation ---------- */
.menu-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--forest-900);
    border: 2px solid var(--forest-900);
    border-radius: var(--radius);
    cursor: pointer;
}

.menu-toggle:hover {
    background: var(--forest-700);
}

.nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-list > li {
    position: relative;
}

.nav-link,
.nav-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    font: inherit;
    font-weight: 700;
    color: var(--forest-900);
    background: transparent;
    border: 0;
    border-bottom: 4px solid transparent;
    border-radius: 0;
    text-decoration: none;
    cursor: pointer;
}

.nav-link:hover,
.nav-trigger:hover,
.nav-trigger[aria-expanded="true"] {
    color: var(--forest-950);
    background: var(--forest-100);
    border-bottom-color: var(--leaf);
}

.nav-link[aria-current="page"] {
    border-bottom-color: var(--brick);
}

.nav-trigger svg {
    transition: transform 0.15s ease;
}

.nav-trigger[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    min-width: 15rem;
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--border);
    border-top: 4px solid var(--leaf);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow);
}

.nav-trigger[aria-expanded="true"] + .submenu {
    display: block;
}

.submenu-link {
    display: block;
    padding: 0.65rem 1.1rem;
    color: var(--forest-900);
    font-weight: 600;
    text-decoration: none;
}

.submenu-link:hover {
    background: var(--forest-100);
    color: var(--forest-950);
    text-decoration: underline;
}

.submenu-link[aria-current="page"] {
    box-shadow: inset 4px 0 0 var(--brick);
}

/* ---------- Page banner (inner pages) ---------- */
.page-banner {
    padding-block: 2rem 2.25rem;
    color: #fff;
    background: linear-gradient(135deg, var(--forest-950), var(--forest-800));
    border-bottom: 4px solid var(--gold);
}

.page-banner h1 {
    margin-bottom: 0.5rem;
    color: #fff;
}

.page-banner .lead {
    max-width: 60ch;
    margin: 0;
    font-size: 1.2rem;
    color: #eef5ef;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    font-size: 0.95rem;
}

.breadcrumb li + li::before {
    content: "/";
    margin-right: 0.5rem;
    color: var(--gold);
}

.breadcrumb a {
    color: #fff;
    display: inline-block;
    min-height: 1.5rem;
    padding: 0.125rem 0.25rem;
}

.breadcrumb a:hover {
    color: var(--gold);
}

.page-banner :focus-visible {
    outline-color: var(--gold);
    box-shadow: none;
}

/* ---------- Page sections ---------- */
.section {
    padding-block: 3rem;
}

.section--tint {
    background: var(--forest-50);
}

.section-heading {
    margin-bottom: 1.5rem;
}

.prose {
    max-width: 70ch;
}

.prose h2 {
    margin-top: 2rem;
}

.prose ul {
    padding-left: 1.25rem;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    padding-block: clamp(3rem, 8vw, 5.5rem);
    color: #fff;
    background:
        radial-gradient(circle at 85% 20%, rgba(114, 211, 92, 0.25), transparent 45%),
        linear-gradient(135deg, var(--forest-950), var(--forest-800) 70%, var(--forest-700));
    border-bottom: 6px solid var(--gold);
}

.hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 2.5rem;
    align-items: center;
}

.eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
}

.hero h1 {
    color: #fff;
}

.hero .lead {
    max-width: 52ch;
    font-size: 1.25rem;
    color: #eef5ef;
}

.hero__seal {
    justify-self: center;
}

.hero__seal img {
    width: min(320px, 70vw);
    border-radius: 50%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.hero :focus-visible {
    outline-color: var(--gold);
    box-shadow: none;
}

/* ---------- Buttons ---------- */
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.6rem 1.4rem;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius);
}

.btn--primary {
    color: var(--forest-950);
    background: var(--gold);
    border-color: var(--gold);
}

.btn--primary:hover {
    color: var(--forest-950);
    background: #d7e46a;
    border-color: #d7e46a;
}

.btn--outline {
    color: #fff;
    background: transparent;
    border-color: #fff;
}

.btn--outline:hover {
    color: var(--forest-950);
    background: #fff;
}

.btn--dark {
    color: #fff;
    background: var(--forest-900);
    border-color: var(--forest-900);
}

.btn--dark:hover {
    color: #fff;
    background: var(--forest-700);
    border-color: var(--forest-700);
}

/* ---------- Quick links + cards ---------- */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.quick-link {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1.25rem;
    color: var(--forest-900);
    text-decoration: none;
    background: #fff;
    border: 2px solid var(--border);
    border-top: 5px solid var(--leaf);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.quick-link:hover {
    color: var(--forest-950);
    border-color: var(--forest-700);
    border-top-color: var(--leaf);
    box-shadow: var(--shadow);
}

.quick-link strong {
    font-size: 1.15rem;
}

.quick-link span {
    color: var(--ink-soft);
    font-size: 0.975rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    padding: 1.5rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 0.5rem;
}

.card p:last-child {
    margin-bottom: 0;
}

.card--accent {
    border-left: 6px solid var(--brick);
}

.news-date {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brick);
}

.notice {
    padding: 1rem 1.25rem;
    background: #fbfbe8;
    border-left: 6px solid var(--gold);
    border-radius: var(--radius);
}

.notice p:last-child {
    margin-bottom: 0;
}

.anchor-section {
    scroll-margin-top: 1.5rem;
}

/* ---------- Footer ---------- */
.site-footer {
    color: #fff;
    background: var(--forest-900);
    border-top: 6px solid var(--leaf);
}

.site-footer a {
    color: #fff;
}

.site-footer a:hover {
    color: var(--gold);
}

.site-footer :focus-visible {
    outline-color: var(--gold);
    box-shadow: none;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 2.8fr;
    gap: 2rem;
    padding-block: 3rem 2rem;
}

.footer-brand img {
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.footer-brand p {
    margin-bottom: 0.25rem;
}

.footer-title {
    font-size: 1.25rem;
    font-weight: 800;
}

.footer-heading {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}

.footer-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-list a {
    display: inline-block;
    padding-block: 0.3rem;
}

.footer-address {
    font-style: normal;
}

.footer-bottom {
    background: var(--forest-950);
    font-size: 0.95rem;
}

.footer-bottom__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-block: 1rem;
}

.footer-bottom p {
    margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 62rem) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .footer-contact {
        grid-column: 1 / -1;
    }

    .hero__inner {
        grid-template-columns: 1fr;
    }

    .hero__seal {
        order: -1;
    }

    .hero__seal img {
        width: 180px;
    }

    /* Menu is only collapsed once JavaScript can toggle it. */
    html.js .menu-toggle {
        display: inline-flex;
    }

    html.js .primary-nav {
        display: none;
    }

    html.js .primary-nav.is-open {
        display: block;
    }

    .primary-nav {
        flex-basis: 100%;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        border-top: 1px solid var(--border);
    }

    .nav-list > li {
        border-bottom: 1px solid var(--border);
    }

    .nav-link,
    .nav-trigger {
        width: 100%;
        justify-content: space-between;
        border-bottom: 0;
        border-left: 4px solid transparent;
    }

    .nav-link:hover,
    .nav-trigger:hover,
    .nav-trigger[aria-expanded="true"] {
        border-left-color: var(--leaf);
    }

    .nav-link[aria-current="page"] {
        border-left-color: var(--brick);
    }

    .submenu {
        position: static;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        background: var(--forest-50);
        padding: 0;
    }

    .submenu-link {
        padding-left: 2rem;
    }
}

@media (max-width: 40rem) {
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .utility-bar__tagline {
        display: none;
    }

    .brand__name {
        font-size: 1.3rem;
    }
}

/* ---------- User preference support ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}

@media (forced-colors: active) {
    .btn,
    .quick-link,
    .card,
    .menu-toggle {
        border: 2px solid ButtonText;
    }

    .nav-link[aria-current="page"] {
        border-bottom-color: Highlight;
    }
}

@media print {
    .skip-link,
    .utility-bar,
    .primary-nav,
    .menu-toggle {
        display: none !important;
    }
}

/* ---------- Blazor defaults (kept accessible) ---------- */
.valid.modified:not([type=checkbox]) {
    outline: 2px solid #1b5e35;
}

.invalid {
    outline: 2px solid #b00020;
}

.validation-message {
    color: #b00020;
}

.blazor-error-boundary {
    padding: 1rem;
    color: #fff;
    background: #b00020;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
