/* Village District — Mobile-first, WCAG 2.1 AA compliant */

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

:root {
    --color-alert: #C0392B;
    --color-announcement: #1F5C99;
    --color-fyi: #555555;
    --color-primary: #1F5C99;
    --color-bg: #FAFAFA;
    --color-text: #222222;
    --color-border: #DDDDDD;
    --color-link: #1A5276;
    --color-focus: #2E86C1;
    --max-width: 48rem;
}

html {
    font-size: 100%;
    line-height: 1.6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0.5rem;
    background: var(--color-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 1000;
    border-radius: 0 0 4px 4px;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* Focus ring */
:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

/* Navigation */
.site-nav {
    background: var(--color-primary);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.site-nav .brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 700;
}
.nav-toggle {
    display: none;
    background: none;
    border: 2px solid #fff;
    color: #fff;
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}
.nav-links a {
    color: #fff;
    text-decoration: none;
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.9rem;
}
.nav-links a:hover,
.nav-links a:focus-visible {
    background: rgba(255,255,255,0.2);
}

@media (max-width: 640px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 0.5rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 0.5rem 0.65rem;
    }
}

/* Main content */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Headings */
h1 { font-size: 1.6rem; margin-bottom: 1rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1rem 0 0.5rem; }

/* Links */
a { color: var(--color-link); }

/* Priority badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    vertical-align: middle;
}
.badge-alert { background: var(--color-alert); }
.badge-announcement { background: var(--color-announcement); }
.badge-fyi { background: var(--color-fyi); }

/* Message cards */
.message-card {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fff;
}
.message-card .meta {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}
.message-card p {
    margin-top: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}
.form-group textarea {
    min-height: 6rem;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover, .btn:focus-visible {
    background: #174a7a;
}
.btn-danger {
    background: var(--color-alert);
}
.btn-danger:hover, .btn-danger:focus-visible {
    background: #a93226;
}
.btn-small {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

/* Alerts / flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-error { background: #f8d7da; color: #721c24; }

/* Document list */
.doc-list {
    list-style: none;
}
.doc-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.doc-list li:last-child { border-bottom: none; }
.doc-meta {
    font-size: 0.85rem;
    color: #666;
}

/* Filter / search bar */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: end;
}
.filter-bar .form-group {
    margin-bottom: 0;
}
.filter-bar select,
.filter-bar input[type="search"] {
    padding: 0.4rem 0.5rem;
}

/* Info page */
.info-section {
    margin-bottom: 2rem;
}
.commissioner-list {
    list-style: none;
}
.commissioner-list li {
    padding: 0.4rem 0;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: #666;
}
.site-footer a {
    color: var(--color-link);
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    list-style: none;
}

/* Tables (admin) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
th, td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}
th {
    font-weight: 600;
    background: #f5f5f5;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin-top: 1rem;
}
.pagination a {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    text-decoration: none;
}
.pagination .active a {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Tabs */
.tab-list {
    display: flex;
    gap: 0;
    list-style: none;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1rem;
}
.tab-list a {
    display: block;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--color-text);
}
.tab-list a.active,
.tab-list a[aria-selected="true"] {
    border-bottom-color: var(--color-primary);
    font-weight: 600;
    color: var(--color-primary);
}

/* Loading indicator */
.loading {
    display: none;
    font-size: 0.85rem;
    color: #666;
}
.loading.visible { display: inline; }

/* Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
