/**
 * Custom styles for 53024.org
 * Built on top of Pico CSS framework
 * Mobile-first, responsive design
 */

/* ================================
   ACCESSIBILITY
   ================================ */

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 1rem;
    background-color: var(--pico-primary);
    color: var(--pico-primary-inverse);
    text-decoration: none;
}

.skip-to-main:focus {
    left: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Focus indicators */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--pico-primary);
    outline-offset: 2px;
}

/* ================================
   HERO SECTION
   ================================ */

.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    margin-bottom: 2rem;
}

.hero hgroup {
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--pico-muted-color);
}

/* Responsive hero text */
@media (min-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.35rem;
    }
}

@media (min-width: 1024px) {
    .hero h1 {
        font-size: 3rem;
    }

    .hero p {
        font-size: 1.5rem;
    }
}

/* ================================
   NAVIGATION
   ================================ */

nav {
    padding: 1rem 0;
    position: relative;
}

nav ul {
    margin: 0;
}

nav a[aria-current="page"] {
    font-weight: bold;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background-color: var(--pico-secondary-hover-background);
}

.theme-toggle:focus {
    outline: 2px solid var(--pico-primary);
    outline-offset: 2px;
}

/* Show/hide icons based on theme */
.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Light mode: show moon (dark icon), hide sun */
[data-theme="light"] .theme-toggle {
    color: #1f2937; /* Dark gray for good contrast on light background */
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Dark mode: show sun (light icon), hide moon */
[data-theme="dark"] .theme-toggle {
    color: #f3f4f6; /* Light gray for good contrast on dark background */
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

/* Logo theme switching - show appropriate logo based on theme */
/* Light mode: show black logo, hide white logo */
[data-theme="light"] .logo-light {
    display: block;
}

[data-theme="light"] .logo-dark {
    display: none;
}

/* Dark mode: show white logo, hide black logo */
[data-theme="dark"] .logo-light {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

/* Hamburger menu button - hidden on desktop */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.hamburger span {
    width: 28px;
    height: 3px;
    background-color: var(--pico-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger animation when active */
.hamburger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Tablet and mobile navigation - show hamburger menu below 992px */
@media (max-width: 991px) {
    /* Show hamburger button on tablets and mobile */
    .hamburger {
        display: flex;
    }

    /* Hide navigation menu by default on tablets and mobile */
    #nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--pico-background-color);
        border-top: 1px solid var(--pico-muted-border-color);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 1rem 0;
        z-index: 9;
        animation: slideDown 0.3s ease-out;
    }

    /* Show menu when active */
    #nav-menu.active {
        display: block;
    }

    /* Stack menu items vertically on tablets and mobile */
    #nav-menu li {
        display: block;
        margin: 0;
        border-bottom: 1px solid var(--pico-muted-border-color);
    }

    #nav-menu li:last-child {
        border-bottom: none;
    }

    #nav-menu a {
        font-size: 1rem;
        padding: 1rem 1.5rem;
        display: block;
        min-height: 44px;
        text-align: left;
        width: 100%;
    }

    /* Theme toggle in mobile menu */
    #nav-menu .theme-toggle {
        margin: 0.5rem 1.5rem;
        width: auto;
    }

    /* Adjust nav container for tablets and mobile */
    nav.container-fluid {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }

    nav.container-fluid > ul:first-child {
        flex: 1;
    }
}

/* Slide down animation for mobile menu */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================
   TYPOGRAPHY
   ================================ */

/* Better spacing for articles */
article {
    margin-bottom: 3rem;
}

article h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--pico-muted-border-color);
    padding-bottom: 0.5rem;
}

article h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Improve blockquote styling */
blockquote {
    border-left: 4px solid var(--pico-primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
}

blockquote strong {
    font-style: normal;
}

/* ================================
   TABLES
   ================================ */

table {
    width: 100%;
    font-size: 0.9rem;
}

/* Mobile table responsiveness with horizontal scroll */
@media (max-width: 767px) {
    figure {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.8rem;
        min-width: 100%;
    }

    table th,
    table td {
        padding: 0.5rem 0.25rem;
    }
}

/* ================================
   DETAILS/ACCORDION
   ================================ */

details {
    margin: 1rem 0;
}

details summary {
    cursor: pointer;
    font-weight: bold;
    padding: 1rem;
    background-color: var(--pico-card-background-color);
    border-radius: var(--pico-border-radius);
    transition: background-color 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

details summary:hover {
    background-color: var(--pico-secondary-hover-background);
}

details[open] summary {
    margin-bottom: 1rem;
}

/* ================================
   STATISTICS GRID
   ================================ */

.grid {
    margin: 2rem 0;
}

.grid h1 {
    margin: 0;
    font-size: 3rem;
    font-weight: bold;
}

.grid p {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    color: var(--pico-muted-color);
}

/* Mobile grid adjustments */
@media (max-width: 767px) {
    .grid {
        display: block;
    }

    .grid > * {
        margin-bottom: 2rem;
    }

    .grid h1 {
        font-size: 2.5rem;
    }
}

/* ================================
   MAP SECTION
   ================================ */

#map {
    border-radius: var(--pico-border-radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
    z-index: 1;
}

/* Mobile map height - increased for better usability */
@media (max-width: 767px) {
    #map {
        height: 500px !important;
    }
}

/* Leaflet popup customization */
.leaflet-popup-content {
    margin: 1rem;
}

.leaflet-popup-content h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.leaflet-popup-content p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.leaflet-popup-content .notes {
    color: var(--pico-muted-color);
    font-style: italic;
}

/* ================================
   SUMMARY BOXES (TL;DR)
   ================================ */

.summary-box {
    background: var(--pico-primary-background);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--pico-primary);
    border-radius: var(--pico-border-radius);
}

/* Light mode: white/light text for contrast against dark primary background */
[data-theme="light"] .summary-box {
    color: #ffffff !important;
}

[data-theme="light"] .summary-box * {
    color: #ffffff !important;
}

[data-theme="light"] .summary-box strong {
    color: #ffffff !important;
    font-weight: bold;
}

[data-theme="light"] .summary-box em {
    color: rgba(255, 255, 255, 0.9) !important;
    font-style: italic;
}

[data-theme="light"] .summary-box a {
    color: #93c5fd !important;
    text-decoration: underline;
}

/* Dark mode: use default theme colors */
[data-theme="dark"] .summary-box {
    color: var(--pico-color);
}

/* ================================
   FORMS
   ================================ */

form label {
    margin-bottom: 0.5rem;
}

form input[type="text"],
form input[type="email"],
form textarea {
    margin-bottom: 1rem;
}

/* Turnstile CAPTCHA container */
.cf-turnstile {
    margin: 1.5rem 0;
    min-height: 65px; /* Standard Turnstile widget height */
    display: block;
}

/* Ensure Turnstile is visible in both themes */
[data-theme="light"] .cf-turnstile,
[data-theme="dark"] .cf-turnstile {
    opacity: 1;
    visibility: visible;
}

/* Mobile form improvements */
@media (max-width: 767px) {
    form input,
    form textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

/* ================================
   FOOTER
   ================================ */

footer {
    margin-top: 4rem;
    padding: 2rem 0;
    background-color: var(--pico-card-background-color);
}

footer h3 {
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

footer p,
footer ul {
    font-size: 0.9rem;
}

footer hr {
    margin: 2rem 0;
}

/* ================================
   BUTTONS & LINKS
   ================================ */

/* Track external link clicks */
a.track-click {
    /* Styling handled by Pico CSS */
}

/* Button group spacing */
.grid [role="button"],
.grid button {
    margin: 0;
}

/* Mobile button improvements */
@media (max-width: 767px) {
    [role="button"],
    button {
        width: 100%;
        margin-bottom: 1rem;
    }

    .grid [role="button"],
    .grid button {
        width: 100%;
    }
}

/* ================================
   UTILITIES
   ================================ */

/* Warning/Alert colors */
.text-warning {
    color: var(--pico-del-color);
}

.text-success {
    color: var(--pico-ins-color);
}

/* Center text utility */
.text-center {
    text-align: center;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ================================
   PRINT STYLES
   ================================ */

@media print {
    nav,
    footer,
    [role="button"],
    button,
    .cf-turnstile {
        display: none;
    }

    article {
        page-break-inside: avoid;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    blockquote,
    table {
        page-break-inside: avoid;
    }
}

/* ================================
   DARK MODE ENHANCEMENTS
   ================================ */

/* Pico CSS handles dark mode automatically,
   but we can add specific enhancements here if needed */

@media (prefers-color-scheme: dark) {
    #map {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

/* ================================
   DEFLOCK MAP INTEGRATION
   ================================ */

/* Map loading state */
.map-loading {
    padding: 4rem 2rem;
    text-align: center;
    background: var(--pico-background-color);
    border-radius: 8px;
}

.map-loading p {
    font-size: 1.1rem;
    color: var(--pico-muted-color);
}

/* Map error state */
.map-error {
    padding: 2rem;
    background: #fee;
    border: 2px solid #c00;
    border-radius: 8px;
    text-align: center;
    margin: 2rem 0;
}

.map-error strong {
    color: #c00;
}

/* Camera statistics */
#camera-stats {
    margin: 2rem 0;
    padding: 2rem;
    background: var(--pico-background-color);
    border-radius: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    padding: 1.5rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: 8px;
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--pico-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stats breakdown lists */
.stats-breakdown {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--pico-card-background-color);
    border-radius: 8px;
}

.stats-breakdown h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--pico-primary);
}

.stats-breakdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.stats-breakdown li {
    padding: 0.5rem;
    background: var(--pico-background-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.stats-meta {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pico-card-border-color);
    text-align: center;
}

.stats-meta p {
    margin: 0;
    color: var(--pico-muted-color);
}

/* Enhanced camera popup */
.camera-popup {
    min-width: 250px;
}

.camera-popup h3 {
    margin: 0 0 1rem 0;
    color: var(--pico-primary);
    font-size: 1.1rem;
}

.camera-popup .camera-details {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.camera-popup .camera-details td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    vertical-align: top;
}

.camera-popup .camera-details td:first-child {
    width: 40%;
    color: var(--pico-muted-color);
}

.camera-popup .camera-notes {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border-left: 3px solid var(--pico-primary);
    font-size: 0.85rem;
    font-style: italic;
}

.camera-popup .camera-type {
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

.camera-popup .camera-source {
    margin: 1rem 0 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid #ddd;
    font-size: 0.8rem;
    color: #666;
    text-align: center;
}

.camera-popup .camera-source a {
    color: var(--pico-primary);
    text-decoration: none;
}

.camera-popup .camera-source a:hover {
    text-decoration: underline;
}

/* Map container improvements */
#map {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 2rem 0;
}

/* DeFlock attribution */
.deflock-attribution {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--pico-background-color);
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.deflock-attribution a {
    color: var(--pico-primary);
    text-decoration: none;
    font-weight: 500;
}

.deflock-attribution a:hover {
    text-decoration: underline;
}

/* Community CTA */
.community-cta {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, var(--pico-primary) 0%, var(--pico-primary-hover) 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
}

.community-cta h3 {
    margin: 0 0 1rem 0;
    color: white;
}

.community-cta p {
    margin: 0 0 1.5rem 0;
    color: rgba(255,255,255,0.9);
}

.community-cta .button {
    background: white;
    color: var(--pico-primary);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s;
}

.community-cta .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Responsive adjustments for DeFlock features */
@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stats-breakdown ul {
        grid-template-columns: 1fr;
    }

    .camera-popup {
        min-width: 200px;
    }

    #camera-stats {
        padding: 1rem;
    }
}

/* ============================================
   DeFlock-Style Directional Camera Markers
   ============================================ */

/* Small circular camera marker with directional wedge */
.camera-marker-dot {
    background: none !important;
    border: none !important;
}

.camera-marker-dot div {
    width: 24px;
    height: 24px;
    transform-origin: center center;
    cursor: pointer;
}

.camera-marker-dot svg {
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* Tooltip styling */
.leaflet-tooltip {
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.leaflet-tooltip-top:before {
    border-top-color: rgba(0, 0, 0, 0.85);
}

/* Direction indicator in popup */
.direction-indicator {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-left: 5px;
}

/* Enhanced popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}

.leaflet-popup-content {
    margin: 16px;
    font-size: 14px;
    min-width: 250px;
}

.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}

/* Mobile responsiveness for markers */
@media (max-width: 768px) {
    .camera-marker-dot div,
    .camera-marker-dot svg {
        width: 20px;
        height: 20px;
    }

    .leaflet-tooltip {
        font-size: 12px;
        padding: 5px 10px;
    }

    .direction-indicator {
        width: 20px;
        height: 20px;
    }
}

/* ================================
   DOCUMENTS PAGE
   ================================ */

/* Lead paragraph styling */
p.lead {
    font-size: 1.25rem;
    color: var(--pico-muted-color);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Document sections */
article.document {
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

article.document header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--pico-primary);
}

article.document h3 {
    margin: 0 0 1rem 0;
    color: var(--pico-primary);
    font-size: 1.5rem;
}

article.document h4 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--pico-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Document download buttons */
article.document .button {
    margin: 0 0.5rem 0.5rem 0;
    display: inline-block;
}

article.document .button.secondary {
    background: var(--pico-secondary);
}

@media (max-width: 767px) {
    article.document .button {
        width: 100%;
        margin: 0 0 0.5rem 0;
    }
}

/* Blockquote styling in documents */
article.document blockquote {
    background: var(--pico-background-color);
    border-left: 4px solid var(--pico-primary);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

article.document blockquote p {
    margin: 0.5rem 0;
}

article.document blockquote footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--pico-muted-border-color);
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    font-style: italic;
}

/* Mark/highlight text */
mark {
    background-color: rgba(255, 237, 160, 0.8);
    color: inherit;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

@media (prefers-color-scheme: dark) {
    mark {
        background-color: rgba(255, 200, 0, 0.3);
    }
}

/* Document key details lists */
article.document ul {
    margin: 1rem 0;
    line-height: 1.8;
}

article.document ul li {
    margin-bottom: 0.5rem;
}

/* Mobile document styling */
@media (max-width: 767px) {
    article.document {
        padding: 1.5rem;
    }

    p.lead {
        font-size: 1.1rem;
    }

    article.document h3 {
        font-size: 1.25rem;
    }
}

/* ================================
   AGENCIES SEARCH/FILTER
   ================================ */

.agencies-search-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

.agencies-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--pico-background-color);
    border-radius: var(--pico-border-radius);
}

.stat-box {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

.stat-box .number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--pico-primary);
    line-height: 1;
}

.stat-box .label {
    display: block;
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#agency-search {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.agencies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.state-group {
    background: var(--pico-background-color);
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
}

.state-group h4 {
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--pico-primary);
    color: var(--pico-primary);
    font-size: 1.1rem;
}

.state-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.state-group li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.state-group li:last-child {
    border-bottom: none;
}

/* Mobile agencies view */
@media (max-width: 767px) {
    .agencies-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .agencies-stats {
        gap: 1rem;
    }

    .stat-box {
        min-width: 100px;
    }

    .stat-box .number {
        font-size: 1.75rem;
    }
}

/* ================================
   RETURN TO TOP BUTTON
   ================================ */

#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--pico-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top::before {
    content: "↑";
    font-weight: bold;
}

@media (max-width: 767px) {
    #back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
}
