/* ===================================
   ROVEABILITY WEBSITE - MAIN STYLESHEET
   ===================================
   
   Project: RoveAbility - Accessible Outdoor Trails Platform
   Description: Helping people with mobility needs discover accessible outdoor routes
   Version: 2.0
   Last Updated: 2025
   
   Architecture:
   - CSS Custom Properties (Variables) for design tokens
   - Mobile-first responsive design
   - Component-based organization
   - Semantic HTML5 structure
   - Accessibility-focused styling
   
   Browser Support: Modern browsers (ES2020+)
   =================================== */
@import url('https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/open-dyslexic.css');

/* ===================================
   GLOBAL RESET
   =================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

/* ===================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   =================================== */
:root {
    /* Primary Colors (Light mode defaults) */
    --primary-bg-color: #f5f6f7;
    --secondary-bg-color: #f9bb0115;
    --primary-color: #001727; /* Use primary color as body text color in light mode */
    --accent-color: #F9BB01;  /* Preserve brand accent separately */

    /* Body text color (default for light theme) */
    --body-text-color: #001727;

    /* Panel / UI surfaces */
    --panel-bg-color: #f8f9fb;
    --panel-text-color: #001727;
    --panel-border-color: #e6e6e6;

    /* Header */
    --header-bg-color: var(--panel-bg-color); /* use light grey panel color instead of white */
    --header-text-color: var(--body-text-color);
    
    /* Table Colors */
    --table-border-color: #8f6a00;
    --table-header-bg: #3d2d00;
    --table-header-text: #ffe494;
    
    /* Accessibility Rating Colors */
    --mustard-tint: #be8b1366;
    --mustard-highlight: #fff1b3;
    --yellow-tint: #b8920066;
    --yellow-highlight: #fff3a0;
    --orange-tint: #b45a0066;
    --orange-highlight: #ffd19a;
    --red-tint: #b71d3f66;
    --red-highlight: #ffc5d1;
    --green-tint: #1c630033;
    --green-highlight: #d4f1d4;
    
    /* Accessibility Scoring Colors */
    --score-green: #1c6300;
    --score-yellow: #ffc107;
    --score-orange: #ff9800;
    --score-red: #b71d3f;
    
    /* Typography */
    --font-family-primary: 'Inter', 'Segoe UI', 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    --line-height-base: 1.6;
    --border-radius-base: 8px;
    --transition-base: 0.3s ease;
    --shadow-base: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.15);
}





.centered {
    text-align: center;
}

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

body {
    background-color: var(--primary-bg-color);
    color: var(--body-text-color);
    font-family: var(--font-family-primary);
    margin: 0;
    line-height: var(--line-height-base);
    font-weight: 400;
    scroll-behavior: smooth;
}



/* ===================================
   MISSION STATEMENT
   =================================== */


.hero-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    max-width: 100%;
    margin: 2rem 0 3rem 0;
    line-height: 1.4;
    border: none;
    padding: 0 2rem;
    font-weight: 600;
}

.mission-statement p {
    max-width: 100% !important; /* Override global 65ch limit */
    margin-bottom: 2rem;
}

p {
    font-size: 1.8rem; /* Significantly increased base paragraph size */
    line-height: 1.7;
    margin: 1.5rem 0;
    max-width: 100%;
}

/* Improved readability for mission section */
.padding-box > p {
    font-size: 2rem; /* Significantly increased introductory paragraph size */
    line-height: 1.8;
    max-width: 100%;
    margin: 0 auto 1.5rem auto;
    font-weight: 400;
}

.padding-box > h2 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Box Components */
.margin-box {
    margin: 2rem auto;
    max-width: 1400px;
    width: 90%;
    padding: 3em;
    border-radius: 2em;
    font-size: 1.5em;
    display: flow-root;
}

.margin-label {
    margin: 2em auto;
    max-width: 1400px;
    width: 90%;
    padding: 1em;
    border-radius: 2em;
    font-size: 1em;
}

.padding-box {
    padding: 3em 5%; 
    margin: 2em auto; 
    max-width: 100%; 
    border-radius: 1.5em;
}

/* ===================================
   LAYOUT & GRID SYSTEM
   =================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    width: 100%;
    margin-top: 1.5rem;
}

.dashboard-card h3,
.dashboard-message h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    text-align: left;
}

.dashboard-card p,
.dashboard-message p {
    margin: 0;
    font-size: 1.1rem;
    text-align: left;
}

.dashboard-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-message {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    text-align: left;
}

.dashboard-message small {
    display: block;
    margin-top: 0.5rem;
    opacity: 0.85;
}

.route-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8.5rem;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: capitalize;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, rgba(249, 187, 1, 0.25), rgba(249, 187, 1, 0.4));
    color: #fff7d6;
}

.route-status-badge[data-state="needs_amendments"] {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.35), rgba(255, 140, 0, 0.45));
    color: #fff3d0;
    border-color: rgba(255, 193, 7, 0.5);
}

.route-status-badge[data-state="rejected"] {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.35), rgba(185, 28, 28, 0.45));
    color: #ffe2e6;
    border-color: rgba(220, 53, 69, 0.5);
}

.route-status-badge[data-state="pending"] {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.35), rgba(0, 123, 167, 0.45));
    color: #e8fcff;
    border-color: rgba(23, 162, 184, 0.5);
}

.route-status-badge[data-state="approved"] {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.35), rgba(21, 115, 46, 0.45));
    color: #ebfff0;
    border-color: rgba(40, 167, 69, 0.5);
}

/* Page layout: keep content centered and readable */
main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5em;
    display: flex;
    flex-direction: column;
    align-items: center;
}

main > * {
    width: 100%;
}

/* ===================================
   HEADER & NAVIGATION
   =================================== */


nav {
    width: auto;
    margin-top: 0;
}



/* --- ACCESSIBILITY: HIGH CONTRAST FOCUS --- 
   Ensures keyboard users can always see where the cursor is positioned.
*/
:focus-visible {
    outline: 4px solid var(--primary-color) !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--primary-bg-color), 0 0 0 7px #ffffff !important;
}

/* --- ACCESSIBILITY: SKIP LINK --- 
   Bypasses navigation for screen reader/keyboard users.
*/
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    color: var(--primary-bg-color);
    padding: 1rem 2rem;
    z-index: 10001;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 8px 8px;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Tooltip System */
.tooltip-trigger {
    position: relative;
    cursor: help;
    text-decoration: underline dotted;
}

.tooltip-box {
    visibility: hidden;
    width: 240px;
    background-color: var(--primary-bg-color);
    color: #ffffff;
    text-align: center;
    border: 2px solid var(--primary-color);
    padding: 12px;
    border-radius: 8px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: var(--shadow-elevated);
}

.tooltip-trigger:hover .tooltip-box {
    visibility: visible;
    opacity: 1;
}

/* Search History Chips */
.search-history {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.history-chip {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    background: var(--secondary-bg-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 2rem;
    cursor: pointer;
}

.history-chip.clear {
    border-style: dashed;
    opacity: 0.8;
}

/* A11y: Leaflet Marker Focus */
.leaflet-marker-icon:focus-visible {
    outline: 4px solid var(--primary-color) !important;
    outline-offset: 2px;
    border-radius: 50%;
    z-index: 1000 !important;
}

/* Default lists should be vertical, not flex */
ul {
    margin: 0;
    padding-left: 1.2em;
}

.other-links {
    display: flex;
    width: 100%; /* Changed from 40% to fill container for centering */
    align-items: center; 
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    padding-left: 0;
    margin: 3rem auto;
}

.other-links li {
    display: flex;
}

li {
    list-style-type: none;
}

#logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
    justify-self: start;
    padding: 0.3rem 0.75rem;
}

#logo a {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: #ffffff;
    transition: transform 180ms ease, color 180ms ease, text-shadow 180ms ease;
}

#logo img,
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Larger logo box to better fit the provided artwork */
    width: 7rem;
    height: 7rem;
    border-radius: 0.6rem;
    border: 2px solid rgba(249, 187, 1, 0.9);
    object-fit: cover; /* crop image edges so it fills the box */
    /* Move the focal area lower in the frame so the wheel sits closer to the bottom (30% vertically) */
    object-position: center 30%;
    background: rgba(255, 255, 255, 0.02);
    color: var(--primary-color);
    box-shadow: 0 0 0.6rem rgba(0,0,0,0.08);
}

/* Tablet override for logo positioning and sizing */
@media (max-width: 1024px) {
    #logo img, .logo-mark {
        object-position: center 30%;
        width: 6rem;
        height: 6rem;
    }
}

/* Mobile override for logo positioning and sizing */
@media (max-width: 768px) {
    #logo img, .logo-mark {
        object-position: center 30%;
        width: 4.2rem;
        height: 4.2rem;
    }
}

#logo a:hover,
#logo a:focus-visible {
    transform: scale(1.05);
    text-shadow: 0 0 15px var(--primary-color);
}

.logo-name {
    color: var(--body-text-color);
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.map-container {
    position: relative;
    z-index: 0;
    margin: 2em 0;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
}

.map-page-title {
    margin-top: 3.5rem;
    text-align: center;
}

.map-instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5em;
    margin: 2em 0;
    padding: 0 1em;
}

.instruction-card {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 1.5em;
    background: linear-gradient(135deg, var(--secondary-bg-color), transparent);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.instruction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 187, 1, 0.15);
}

.instruction-icon {
    font-size: 2em;
    min-width: 50px;
    text-align: center;
}

.instruction-text h4 {
    margin: 0 0 0.5em 0;
    color: var(--primary-color);
    font-size: 1.1em;
}

.instruction-text p {
    margin: 0;
    color: var(--primary-color);
    opacity: 0.9;
    font-size: 0.9em;
    line-height: 1.4;
}



.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(35em, 1fr));
    gap: 1.5rem;
    justify-items: center;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: rgba(0, 23, 39, 0.95);
    border-radius: 12px;
    border: 1px solid var(--primary-color);
    max-width: 40em;
    width: 100%;
}

.legend-icon {
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
    font-size: 0; /* Removes symbols from the legend markers */
}

.legend-icon.for-most {
    background-color: #1C6300; /* Green */
}

.legend-icon.for-many {
    background-color: #82CA66; /* Lime */
}

.legend-icon.for-some {
    background-color: #FFDB00; /* Yellow */
}

.legend-icon.for-few-suggested {
    background-color: #d16117; /* Orange */
}

.legend-icon.for-few-required {
    background-color: #FF8388; /* Light Red */
}

.legend-icon.for-very-few {
    background-color: #FF001C; /* Dark Red */
}

.legend-icon.user-location {
    background: var(--primary-color);
    border: 2px solid var(--primary-bg-color);
    color: var(--primary-bg-color);
    transform: none;
    border-radius: 50%;
}

.legend-item span:not(.legend-icon) {
    font-size: 1.6rem;
    font-weight: 700;
    display: inline-block;
    text-align: left;
    line-height: 1.2;
    color: var(--primary-color);
}

.legend-icon.unknown {
    background: var(--secondary-bg-color);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}



.error-content {
    text-align: center;
    padding: 2em;
}

.error-content h3 {
    margin-bottom: 1em;
    color: var(--red-highlight);
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
    padding: 2em;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--secondary-bg-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.btn-icon {
    margin-right: 0.5em;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5em;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--primary-color);
    margin: 3px 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    border-radius: 2px;
    transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(-45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(45deg);
}

#main-nav {
    transition: grid-template-rows 0.3s ease-out, visibility 0.3s, border-color 0.3s;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    .hero-images {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.2rem;
    }
    
    .hero-image {
        height: 220px;
    }
    
    header {
        padding: 1.2em 1.5em;
    }
    
    #logo {
        font-size: 2.5em;
    }
    /* Adjust logo image size on tablet */
    #logo img, .logo-mark {
        width: 6rem;
        height: 6rem;
    }
    
    section {
        margin: 3em 1.5em;
    }
    
    .padding-box {
        padding: 2.5em 10%;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    /* Header and Navigation */
    .mobile-menu-toggle {
        display: flex;
        position: absolute;
        top: 1.5em;
        right: 1em;
    }

    #main-nav {
        display: grid;
        grid-template-rows: 0fr;
        visibility: hidden;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-bg-color);
        border: 1px solid transparent;
        border-top: none;
        z-index: 1000;
        overflow: hidden;
    }

    #main-nav.active {
        grid-template-rows: 1fr;
        visibility: visible;
        border-color: var(--primary-color);
    }

    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1em;
        min-height: auto;
        position: relative;
    }

    #logo {
        font-size: 2em;
        margin: 0;
        text-align: center;
    }
    /* Mobile logo size */
    #logo img, .logo-mark {
        width: 4.2rem;
        height: 4.2rem;
    }

    header nav {
        width: 100%;
        min-width: auto;
    }

    header nav ul {
        flex-direction: column;
        gap: 0.5em;
        align-items: stretch;
        min-height: 0;
    }

    header nav li {
        padding: 0.5em;
        text-align: center;
        border-bottom: 1px solid var(--secondary-bg-color);
    }

    header nav li:not(:last-child)::after {
        display: none;
    }

    header nav a {
        display: block;
        padding: 0.8em;
        font-size: 1.3rem;
        font-weight: 700;
        font-family: var(--font-family-primary);
    }

    #logo {
        justify-self: start;
    }

    /* Hero Images */
    .hero-images {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
    
    .hero-image {
        height: 200px;
        border-radius: var(--border-radius-base);
    }
    
    .hero-image-left,
    .hero-image-right,
    .hero-image-center {
        border-radius: var(--border-radius-base);
    }
    
    /* Typography */
    h1 {
        font-size: 2.5rem;
        margin: 1em 0;
    }

    h2 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.4rem;
    }
    
    /* Sections */
    section {
        margin: 2em 1em;
    }

    .padding-box {
        padding: 2em 1em;
        margin: 1em 0;
    }
    
    /* Footer */
    footer {
        padding: 2em 1em;
        margin-top: 2em;
    }

    footer h2 {
        font-size: 1.3em;
        margin-bottom: 1em;
    }

    footer nav p {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8em;
        font-size: 0.9em;
    }
    
    /* Buttons */
    .highlight-link,
    .border-link {
        width: 100%;
        max-width: 300px;
        margin: 0.5em auto;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    header {
        padding: 0.8em;
    }

    #logo {
        font-size: 1.8em;
    }
    
    .hero-image {
        height: 180px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    section {
        margin: 1.5em 0.8em;
    }

    .padding-box {
        padding: 1.5em 0.8em;
    }

    footer {
        padding: 1.5em 0.8em;
    }
}

.map-element {
    width: 100%;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 23, 39, 0.3);
}

.location-error {
    background-color: var(--red-tint);
    border: 2px solid var(--red-highlight);
    border-radius: 8px;
    padding: 2em;
    text-align: center;
    margin: 1em 0;
}

.location-error h3 {
    color: var(--red-highlight);
    margin-bottom: 1em;
}

.location-error p {
    color: var(--primary-color);
    margin-bottom: 1em;
}

.loading-indicator {
    background-color: var(--secondary-bg-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 2em;
    text-align: center;
    margin: 1em 0;
}

.loading-indicator p {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.map-controls {
    display: flex;
    gap: 1em;
    margin-top: 1.5em;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.8em 1em;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background-color: var(--primary-bg-color);
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.search-input::placeholder {
    color: var(--primary-color);
    opacity: 0.7;
}

.search-btn, .location-btn {
    padding: 0.8em 1.5em;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background-color: var(--primary-bg-color);
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.search-btn:hover, .location-btn:hover {
    background-color: var(--primary-color);
    color: var(--primary-bg-color);
    transform: translateY(-2px);
}

.search-btn.icon-only {
    min-width: 48px;
    width: 48px;
    padding: 0.8em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-btn.icon-only .btn-icon {
    margin: 0;
}

.search-container button {
    flex-shrink: 0;
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7em 1em;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background-color: var(--primary-bg-color);
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.filter-checkbox input {
    accent-color: var(--primary-color);
    width: 1rem;
    height: 1rem;
}

.search-btn:focus, .location-btn:focus {
    outline: none;
    box-shadow: 0 0 10px var(--primary-color);
}

.map-error {
    background-color: var(--red-tint);
    border: 2px solid var(--red-highlight);
    border-radius: 8px;
    padding: 2em;
    text-align: center;
    height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.map-error h3 {
    color: var(--red-highlight);
    margin-bottom: 1em;
}

.map-error p {
    color: var(--primary-color);
    margin-bottom: 1em;
}

.route-info {
    padding: 1em;
    background-color: var(--primary-bg-color);
    border-radius: 6px;
    border: 1px solid var(--primary-color);
    max-width: 250px;
}

.route-info h4 {
    color: var(--primary-color);
    margin: 0 0 0.5em 0;
    font-size: 1.1rem;
}

.route-info p {
    color: var(--primary-color);
    margin: 0.5em 0;
    font-size: 0.9rem;
}

.route-info a {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
    font-size: 0.9rem;
}

.route-info a:hover {
    text-shadow: 0 0 10px var(--primary-color);
}

.map-placeholder {
    background-color: var(--secondary-bg-color);
    padding: 4em 2em;
    text-align: center;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.map-placeholder h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 1em;
}

.map-placeholder p {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 1em;
    max-width: 600px;
}

.map-placeholder a {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
}

.map-placeholder a:hover {
    text-shadow: 0 0 10px var(--primary-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

#logo {
    font-size: 3em;
    font-weight: bold;
}

main {
    /* overridden above (kept for backwards compatibility) */
    justify-items: center;
}

article {
    display: block;
    margin: auto;
}

.team-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5em;
    width: min(70em, 94vw);
}

.team-grid figure {
    margin: 0;
    flex: 0 1 calc((100% - 3em) / 3);
}

.team-grid figure > img {
    width: 100%;
    height: auto;
}

@media (max-width: 900px) {
    .team-grid figure {
        flex-basis: calc((100% - 1.5em) / 2);
    }
}

@media (max-width: 560px) {
    .team-grid figure {
        flex-basis: 100%;
    }
}

figure {
    text-align: center;
}

figcaption {
    font-size: 1.5em;
}

figure > img {
    border: var(--secondary-bg-color) solid;
    border-radius: 2em;
}

/* Global Utilities */

svg {
    fill: var(--primary-color);
}

section {
    margin: 4em auto;
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3em 2em;
    margin: 0 auto;
    border-top: none;
    max-width: 1600px;
    width: 100%;
}

footer h2,
footer nav {
    width: fit-content;
    margin-bottom: 1em;
}

footer nav p {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45em;
}

footer nav svg {
    display: block;
}

table {
    border-collapse: collapse;
    border-radius: 1em;
    border-style: hidden;
    box-shadow: 0 0 0 2px var(--table-border-color);
    margin: 2em auto;
}


table tr:first-child th:first-child {
    border-top-left-radius: 1em;
}

table tr:first-child th:last-child {
    border-top-right-radius: 1em;
}

th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    border-bottom: var(--table-border-color) solid;
}

/* Route link styling for the Sites table */
.route-link {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed var(--primary-color);
    transition: color 0.2s ease, border-bottom-style 0.2s ease;
}

.route-link:hover {
    color: #ffd64f;
    border-bottom-style: solid;
}

th, td {
    padding: 2em;
}

.for-most {
    background-color: #1C6300; /* Solid green */
    padding: 0.5em;
    color: #ffffff; /* White text for contrast */
    border: solid #1f7a54 1px;
    border-radius: 1em;
}

.for-many {
    background-color: #82CA66; /* Lime */
    padding: 0.5em;
    color: #0d4426; /* Dark green text for contrast */
    border: solid #228B22 1px;
    border-radius: 1em;
}

.for-some {
    background-color: #FFDB00; /* Yellow */
    padding: 0.5em;
    color: #5d4300; /* Dark brown text for contrast */
    border: solid #b89200 1px;
    border-radius: 1em;
}

.for-few-suggested {
    background-color: #d16117; /* Orange */
    padding: 0.5em;
    color: #5a3200; /* Dark orange text for contrast */
    border: solid #b45a00 1px;
    border-radius: 1em;
}

.for-few-required {
    background-color: #FF8388; /* Light Red */
    padding: 0.5em;
    color: #660016; /* Dark red text for contrast */
    border: solid #b71d3f 1px;
    border-radius: 1em;
}

.for-very-few {
    background-color: #0E0E0E; /* Dark Red */
    padding: 0.5em;
    color: #ffffff;
    border: solid #7a0f1f 1px;
    border-radius: 1em;
}

.background-tint {
    background-color: var(--panel-bg-color);
    border-radius: 12px;
    box-shadow: var(--shadow-base);
}

/* Light-mode high-contrast variant: keep panels solid light grey but enforce strong borders */
body.a11y-high-contrast-light .background-tint {
    background-color: var(--panel-bg-color) !important;
    border: 2px solid #000000 !important;
}

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

/* High Contrast Mode */
body.a11y-high-contrast {
    --primary-bg-color: #000000;
    --primary-color: #ffffff;
    --secondary-bg-color: #000000;
    --table-header-bg: #ffffff;
    --table-header-text: #000000;
    --table-border-color: #ffffff;
}

body.a11y-high-contrast .background-tint {
    background-color: #000000;
    border: 2px solid #ffffff;
}

/* Reading Aloud Highlight */
.a11y-reading-highlight {
    background-color: rgba(249, 187, 1, 0.35);
    outline: 2px solid var(--primary-color);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

body.a11y-high-contrast .a11y-reading-highlight {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Large Text Mode — site-wide scaling via CSS custom property */
:root {
    --prefs-text-scale: 1;
}

body.a11y-large-text {
    font-size: calc(1rem * var(--prefs-text-scale, 1.15));
}

body.a11y-large-text p, 
body.a11y-large-text li,
body.a11y-large-text td,
body.a11y-large-text th,
body.a11y-large-text span,
body.a11y-large-text a,
body.a11y-large-text label,
body.a11y-large-text button,
body.a11y-large-text input,
body.a11y-large-text select,
body.a11y-large-text textarea,
body.a11y-large-text figcaption,
body.a11y-large-text blockquote,
body.a11y-large-text dt,
body.a11y-large-text dd {
    font-size: calc(1em * var(--prefs-text-scale, 1.15));
}

body.a11y-large-text h1 { font-size: calc(2.5rem * var(--prefs-text-scale, 1.15)); }
body.a11y-large-text h2 { font-size: calc(2.2rem * var(--prefs-text-scale, 1.15)); }
body.a11y-large-text h3 { font-size: calc(1.8rem * var(--prefs-text-scale, 1.15)); }
body.a11y-large-text h4 { font-size: calc(1.5rem * var(--prefs-text-scale, 1.15)); }
body.a11y-large-text h5 { font-size: calc(1.3rem * var(--prefs-text-scale, 1.15)); }
body.a11y-large-text h6 { font-size: calc(1.2rem * var(--prefs-text-scale, 1.15)); }

/* Text scale controls */
.prefs-text-scale-controls {
    display: none;
    margin: 10px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.prefs-text-scale-controls label {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.prefs-text-scale-controls input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

.prefs-hint {
    font-size: 0.8rem;
    color: rgba(249, 187, 1, 0.6);
    margin: 8px 0 0 0;
    text-align: left;
    font-style: italic;
}

/* Dyslexic Font Mode */
body.a11y-dyslexic-font {
    font-family: var(--a11y-font-family, 'OpenDyslexic', 'Segoe UI', sans-serif) !important;
    font-size: calc(1rem * var(--a11y-font-size-scale, 1)) !important;
    line-height: var(--a11y-line-height, 1.6) !important;
    letter-spacing: var(--a11y-letter-spacing, 0.01em) !important;
    word-spacing: var(--a11y-word-spacing, 0.04em) !important;
}

body.a11y-dyslexic-font p,
body.a11y-dyslexic-font li,
body.a11y-dyslexic-font td,
body.a11y-dyslexic-font span,
body.a11y-dyslexic-font a {
    font-family: inherit;
    letter-spacing: inherit;
    word-spacing: inherit;
}

.a11y-dyslexia-controls {
    display: none;
    margin-top: 0.8rem;
    padding: 0.8rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
}

.a11y-dyslexia-controls.is-active {
    display: block;
}

.a11y-dyslexia-controls label {
    display: block;
    margin: 0.65rem 0 0.25rem;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
}

.a11y-dyslexia-controls input,
.a11y-dyslexia-controls select {
    width: 100%;
    margin-bottom: 0.25rem;
    padding: 0.45rem;
    border-radius: 6px;
    border: 1px solid #ffffff;
}

.a11y-dyslexia-controls button {
    margin-top: 0.6rem;
    padding: 0.7rem;
    font-size: 0.95rem;
}

/* Accessibility Panel Styling */
#a11y-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

#a11y-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--primary-bg-color);
    font-size: 32px;
    border: 3px solid #ffffff;
    cursor: pointer;
    box-shadow: var(--shadow-elevated);
}

#a11y-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: var(--primary-bg-color);
    border: 2px solid var(--primary-color);
    padding: 20px;
    border-radius: 12px;
    width: 300px;
    border: 3px solid #ffffff;
    box-shadow: var(--shadow-elevated);
}

#a11y-menu h3 { margin-top: 0; font-size: 1.4rem; color: #ffffff; }
#a11y-menu button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 14px;
    background: transparent;
    color: #ffffff;
    border: 2px solid var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
}
#a11y-menu button[aria-pressed="true"] {
    background: var(--primary-color);
    color: var(--primary-bg-color);
}



.padding-box > ul {
    font-size: 1.6rem;
    line-height: 1.8;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    list-style-type: none;
}

.padding-box > ul > li {
    text-align: left;
}

/* ===================================
   MENU BUTTONS ENHANCEMENT
   =================================== */

.highlight-link {
    background: linear-gradient(135deg, var(--primary-color), #ffd64f);
    padding: 0.875rem 1.75rem;
    color: var(--primary-bg-color);
    font-weight: 700;
    border-radius: var(--border-radius-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.2rem;
    transition: transform var(--transition-base), box-shadow var(--transition-base), filter var(--transition-base);
    text-decoration: none;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(249, 187, 1, 0.25);
    letter-spacing: 0.01em;
}

.highlight-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.highlight-link:hover::before {
    left: 100%;
}

.border-link {
    border: 2px solid var(--primary-color);
    padding: 0.875rem 1.75rem;
    border-radius: var(--border-radius-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3.2rem;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
    text-decoration: none;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.border-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(249, 187, 1, 0.1), transparent);
    transition: left 0.6s ease;
}

.border-link:hover::before {
    left: 100%;
}

.highlight-link:hover,
.highlight-link:focus-visible {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 28px rgba(249, 187, 1, 0.35);
    filter: brightness(1.1);
}

.border-link:hover,
.border-link:focus-visible {
    transform: translateY(-4px) scale(1.02);
    background-color: var(--secondary-bg-color);
    box-shadow: 0 12px 28px rgba(249, 187, 1, 0.25);
    border-color: #ffd64f;
    color: var(--primary-color);
}

/* Enhanced focus states */
.highlight-link:focus-visible,
.border-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

/* Responsive menu buttons */
@media (max-width: 768px) {
    .highlight-link,
    .border-link {
        width: 100%;
        max-width: 320px;
        margin: 0.5em auto;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        min-height: 3rem;
    }
}

@media (max-width: 480px) {
    .highlight-link,
    .border-link {
        padding: 0.675rem 1.25rem;
        font-size: 0.95rem;
        min-height: 2.8rem;
    }
}

/* ===================================
   CONTACT SECTION & EMAIL BUTTON
   =================================== */

.contact-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1rem;
    width: 100%;
}

.contact-main-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.newsletter-signup {
    margin: 1rem 0;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.newsletter-signup h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.newsletter-form input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-base);
    background: var(--primary-bg-color);
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
}


.email-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, var(--primary-color), #ffd64f);
    color: var(--primary-bg-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: var(--border-radius-base);
    border: none;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), filter var(--transition-base);
    box-shadow: 0 4px 12px rgba(249, 187, 1, 0.2);
    position: relative;
    overflow: hidden;
}

.email-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.email-button:hover::before {
    left: 100%;
}

.email-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(249, 187, 1, 0.3);
    filter: brightness(1.05);
}

.email-button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.email-button svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-bg-color);
    transition: transform var(--transition-base);
}

.email-button:hover svg {
    transform: scale(1.1);
}

/* Responsive email button */
@media (max-width: 768px) {
    .contact-section {
        gap: 1.5rem;
    }
    
    .email-button {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-form button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .email-button {
        padding: 0.675rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* ===================================
   SOCIAL MEDIA LINKS
   =================================== */

.social-media-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.social-media-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(249, 187, 1, 0.1);
    border: 2px solid var(--primary-color);
    transition: transform var(--transition-base), background-color var(--transition-base), box-shadow var(--transition-base);
    padding: 8px;
}

.social-media-links a:hover {
    transform: translateY(-3px) scale(1.1);
    background: var(--primary-color);
    box-shadow: 0 8px 24px rgba(249, 187, 1, 0.3);
}

.social-media-links a:hover svg {
    fill: var(--primary-bg-color);
}

.social-media-links svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-color);
    transition: fill var(--transition-base);
}

/* Responsive social media links */
@media (max-width: 768px) {
    .social-media-links {
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .social-media-links a {
        width: 44px;
        height: 44px;
    }
    
    .social-media-links svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .social-media-links {
        gap: 0.8rem;
    }
    
    .social-media-links a {
        width: 40px;
        height: 40px;
    }
    
    .social-media-links svg {
        width: 18px;
        height: 18px;
    }
}
.user-badge {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.9;
    text-align: right;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
}

/* Role-based badge colors matching login screen */
.role-admin { background-color: #f8d7da; color: #721c24; border: 1px solid #dc3545; }

/* Override: make Sign In button a single solid color (primary) and remove gradient sheen */
.highlight-link {
    background: var(--primary-color) !important;
    color: #ffffff !important; /* ensure readable by default */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* In dark theme, prefer the panel/background color as text (dark on light-ish accent) */
.theme-dark .highlight-link {
    color: var(--primary-bg-color) !important;
}

.highlight-link::before {
    display: none !important; /* remove animated sheen */
}

.highlight-link:hover,
.highlight-link:focus-visible {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    filter: none;
}

/* Tidy auth-card: subtle border, no harsh shadow so it matches the site panels */
.auth-card {
    background-color: var(--panel-bg-color) !important;
    border: 1px solid var(--panel-border-color) !important;
    box-shadow: none !important;
    padding: 2rem !important;
    max-width: 720px;
    margin: 0 auto;
}

/* Ensure high-contrast light keeps the button readable */
body.a11y-high-contrast-light .highlight-link {
    background: #000000 !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

body.a11y-high-contrast-light .highlight-link::before { display: none !important; }

/* Force button text visible at the highest specificity */
button.highlight-link,
a.highlight-link,
input[type="submit"].highlight-link {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: 0 1px 0 rgba(0,0,0,0.35) !important;
    font-weight: 800 !important;
    text-align: center !important;
    overflow: visible !important;
}

/* Minor responsive tweak to maintain full-width feel on small screens */
@media (max-width: 768px) {
    .auth-card { padding: 1.25rem !important; }
    .highlight-link, .border-link { width: 100%; max-width: 100%; }
}
.role-pro { background-color: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.role-standard { background-color: #d1ecf1; color: #0c5460; border: 1px solid #17a2b8; }
.role-advanced { background-color: #fff3cd; color: #856404; border: 1px solid #ffc107; }

/* Tier-based badge colors matching Tier List page */
.tier-free { background-color: #d4ebe8; color: #2b7a78; border: 1px solid #2b7a78; }
.tier-basic { background-color: #d4dff0; color: #3f64a8; border: 1px solid #3f64a8; }
.tier-ultimate { background-color: #ead9c8; color: #a26128; border: 1px solid #a26128; }
.tier-admin { background-color: #f8d7da; color: #721c24; border: 1px solid #dc3545; }

.nav-auth-link {
    display: inline-block;
    padding: 0.4em 0.3em;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-family: var(--font-family-primary);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    transition: transform 180ms ease, color 180ms ease, text-shadow 180ms ease;
}

.nav-auth-link:hover,
.nav-auth-link:focus-visible {
    color: #ffd64f;
    transform: translateY(-2px) scale(1.04);
    text-shadow: 0 0 10px rgba(249, 187, 1, 0.4);
}

/* Auth page layout - larger card and darker outer background in light mode */
:root:not(.theme-dark) body.auth-page,
:root:not(.theme-dark) .auth-page {
    background-color: #d0d4d8 !important; /* darker grey outside the auth card in light mode */
}

/* Ensure this wins over broader selectors that used !important */
:root:not(.theme-dark) body.auth-page header,
:root:not(.theme-dark) body.auth-page footer,
:root:not(.theme-dark) .auth-page header,
:root:not(.theme-dark) .auth-page footer,
:root:not(.theme-dark) body.auth-page #main-content,
:root:not(.theme-dark) .auth-page #main-content,
:root:not(.theme-dark) body.auth-page main,
:root:not(.theme-dark) .auth-page main,
:root:not(.theme-dark) body.auth-page .padding-box,
:root:not(.theme-dark) .auth-page .padding-box {
    background-color: #d0d4d8 !important; /* match outer area in light mode */
    color: var(--body-text-color) !important;
}

/* Dark mode auth page layout */
.theme-dark body.auth-page,
.theme-dark .auth-page,
.theme-dark body.auth-page header,
.theme-dark body.auth-page footer,
.theme-dark .auth-page header,
.theme-dark .auth-page footer,
.theme-dark body.auth-page #main-content,
.theme-dark .auth-page #main-content,
.theme-dark body.auth-page main,
.theme-dark .auth-page main,
.theme-dark body.auth-page .padding-box,
.theme-dark .auth-page .padding-box {
    background-color: var(--primary-bg-color) !important;
    color: var(--body-text-color) !important;
}

.theme-dark .auth-page .auth-card {
    background-color: var(--panel-bg-color) !important;
    color: var(--panel-text-color) !important;
    border-color: var(--panel-border-color) !important;
}



.auth-page main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 160px); /* allow header/footer space */
    padding: 3rem 1rem;
}
.auth-page .auth-card {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 3rem !important;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.06);
}
.auth-page .auth-card h1 { font-size: 3rem; margin-top: 0; }

.auth-subtitle {
    max-width: 650px;
    margin: 0 auto 1.5em auto;
    text-align: center;
    display: block;
    line-height: 1.5;
}

.auth-form,
.admin-form {
    display: grid;
    gap: 0.8em;
    max-width: 500px;
    margin: 0 auto;
}

.auth-form input,
.admin-form input,
.admin-form select,
.admin-form textarea {
    padding: 0.8em 1em;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background-color: var(--primary-bg-color);
    color: var(--primary-color);
    font-family: inherit;
    font-size: 1rem;
}

.auth-error {
    margin: 0.5em auto 0 auto;
    max-width: 500px;
    color: var(--red-highlight);
}

.auth-hint {
    margin: 2em auto 0 auto;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-hint h2 {
    font-size: 1.4em;
}

.auth-hint ul {
    display: block;
    padding-left: 1.2em;
    line-height: 1.8;
}

.show-password-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--primary-color);
    user-select: none;
    padding: 0.4em 0;
}

.show-password-label input[type="checkbox"] {
    display: none;
}

.show-password-toggle {
    width: 44px;
    height: 24px;
    background-color: rgba(255,255,255,0.15);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.show-password-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.show-password-label input:checked + .show-password-toggle {
    background-color: rgba(249, 187, 1, 0.3);
    border-color: var(--primary-color);
}

.show-password-label input:checked + .show-password-toggle::after {
    transform: translateX(20px);
}

.auth-switch-btn {
    display: flex !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 1.1rem !important;
    padding: 0.875rem 1.75rem !important;
    min-height: 3.2rem !important;
    margin: 0 !important;
}

/* ---------- Changing Places Toggle Switch ---------- */
.changing-places-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    user-select: none;
    padding: 0.4em 0.8em;
    border-radius: 8px;
    background: rgba(249, 187, 1, 0.08);
    border: 1px solid rgba(249, 187, 1, 0.2);
    transition: background-color 0.2s ease;
}

.changing-places-toggle:hover {
    background: rgba(249, 187, 1, 0.15);
}

.changing-places-toggle input[type="checkbox"] {
    display: none;
}

.cp-toggle-switch {
    width: 44px;
    height: 24px;
    background-color: rgba(255,255,255,0.15);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}

.cp-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background-color: var(--primary-color);
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.changing-places-toggle input:checked + .cp-toggle-switch {
    background-color: rgba(249, 187, 1, 0.3);
    border-color: var(--primary-color);
}

.changing-places-toggle input:checked + .cp-toggle-switch::after {
    transform: translateX(20px);
}

.cp-toggle-label {
    white-space: nowrap;
}

/* ---------- Sites controls / Admin table actions ---------- */
.sites-controls {
    margin: 1.5em auto 0 auto;
    max-width: 900px;
}

.admin-actions {
    display: flex;
    gap: 0.6em;
    justify-content: center;
    align-items: center;
}

/* ===================================
   PREFERENCES PULL-OUT DRAWER
   =================================== */
#prefs-tab {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), #ffd64f);
    color: var(--primary-bg-color);
    border: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-size: 24px;
    z-index: 10001;
    box-shadow: -4px 0 12px rgba(0,0,0,0.3);
    transition: width 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#prefs-tab:hover {
    width: 56px;
    box-shadow: -6px 0 18px rgba(249, 187, 1, 0.4);
}

#prefs-tab.open {
    display: none;
}

/* Dark-mode preferences tab uses a softer gold for the visible control. */
.theme-dark #prefs-tab {
    background: #f3df9b;
    color: #001727;
}

.theme-dark #prefs-tab:hover {
    box-shadow: -6px 0 18px rgba(243, 223, 155, 0.45);
}

/* Keep search text readable against the light input surface in dark mode. */
.theme-dark .search-input {
    color: #000000;
}

.theme-dark .search-input::placeholder {
    color: #000000;
    opacity: 0.7;
}

/* Core dark theme palette — drives the main background/text everywhere */
html.theme-dark {
    --primary-bg-color: #001727;
    --secondary-bg-color: #f9bb0122;
    --primary-color: #F9BB01;
    --accent-color: #F9BB01;
    --body-text-color: #fff7d6;
    --panel-bg-color: #012136;
    --panel-text-color: #fff7d6;
    --panel-border-color: #3d2d00;
    --header-bg-color: #001727;
    --header-text-color: #fff7d6;
    --table-border-color: #8f6a00;
    --table-header-bg: #3d2d00;
    --table-header-text: #ffe494;
    --bg-color: #001727;
}

html.theme-dark,
html.theme-dark body,
html.theme-dark main,
body.theme-dark {
    background-color: var(--primary-bg-color) !important;
    color: var(--body-text-color) !important;
}

/* Light-mode: make the prefs cog black for better contrast on light backgrounds */
:root:not(.theme-dark) #prefs-tab {
    background: #000000 !important;
    color: #ffffff !important;
    box-shadow: -4px 0 12px rgba(0,0,0,0.4) !important;
}
:root:not(.theme-dark) #prefs-tab:hover {
    width: 56px;
    box-shadow: -6px 0 18px rgba(0,0,0,0.5) !important;
}

#prefs-drawer {
    position: fixed;
    top: 0;
    right: -340px;
    width: 340px;
    height: 100vh;
    background: var(--panel-bg-color);
    border-left: 3px solid var(--primary-color);
    box-shadow: -8px 0 32px rgba(0,0,0,0.4);
    z-index: 10002;
    overflow-y: auto;
    transition: right 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--panel-bg-color);
}

#prefs-drawer::-webkit-scrollbar {
    width: 6px;
}

#prefs-drawer::-webkit-scrollbar-track {
    background: var(--panel-bg-color);
}

#prefs-drawer::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

#prefs-drawer.open {
    right: 0;
}

#prefs-drawer-content {
    padding: 20px;
}

.prefs-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(249, 187, 1, 0.2);
}

.prefs-drawer-header h2 {
    font-size: 1.6rem;
    margin: 0;
    text-align: left;
    background: linear-gradient(135deg, var(--primary-color), #ffd64f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.prefs-close-btn {
    background: none;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.0.2s ease;
    line-height: 1;
    padding: 0;
}

.prefs-close-btn:hover {
    background: var(--primary-color);
    color: var(--primary-bg-color);
}

.prefs-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(249, 187, 1, 0.05);
    border: 1px solid rgba(249, 187, 1, 0.15);
    border-radius: 12px;
}

.prefs-section h3 {
    font-size: 1.2rem;
    margin: 0 0 8px 0;
    text-align: left;
    color: var(--primary-color);
}

.prefs-desc {
    font-size: 0.85rem;
    margin: 0 0 15px 0;
    text-align: left;
    color: rgba(249, 187, 1, 0.7);
    line-height: 1.4;
}

/* Language Grid */
.prefs-language-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.prefs-lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(249, 187, 1, 0.2);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.prefs-lang-btn:hover {
    background: rgba(249, 187, 1, 0.1);
    border-color: var(--primary-color);
}

.prefs-lang-btn.active {
    background: rgba(249, 187, 1, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(249, 187, 1, 0.3);
}

.prefs-lang-flag {
    font-size: 1.3rem;
    line-height: 1;
}

.prefs-lang-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Access Feature Toggles */
.prefs-toggle-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.04);
    border: 2px solid var(--panel-border-color);
    border-radius: 8px;
    color: var(--panel-text-color);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    text-align: left;
}

.prefs-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0,0,0,0.12);
}

.prefs-toggle-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #000; /* keep label readable on accent */
}

.prefs-toggle-track {
    width: 52px;
    height: 28px;
    background-color: rgba(0,0,0,0.06);
    border: 2px solid var(--panel-border-color);
    border-radius: 999px; /* pill */
    position: relative;
    flex-shrink: 0;
    padding: 2px;
    box-sizing: border-box;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.prefs-toggle-knob {
    position: absolute;
    top: 50%;
    left: 6px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: var(--panel-text-color);
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: transform 0.18s cubic-bezier(.22,.9,.32,1), background-color 0.18s ease;
}

.prefs-toggle-btn.active .prefs-toggle-track {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.prefs-toggle-btn.active .prefs-toggle-knob {
    transform: translate(24px, -50%);
    background-color: #ffffff; /* knob becomes white on accent */
}

/* Decorative end-ball on active toggles: a small black circle at the far right of the track */
.prefs-toggle-btn.active .prefs-toggle-track::after {
    content: '';
    position: absolute;
    right: 6px; /* sit near the end of the pill */
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #000000;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.06) inset;
}

/* Ensure the ball is visible in light-high-contrast (white panels) by adding a thin white ring */
body.a11y-high-contrast-light .prefs-toggle-btn.active .prefs-toggle-track::after {
    box-shadow: 0 0 0 2px #ffffff; /* white ring to separate from white panel */
}

/* Ensure the ball is visible in dark high-contrast by adding subtle outline if needed */
body.a11y-high-contrast-dark .prefs-toggle-btn.active .prefs-toggle-track::after,
body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-track::after {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.06), 0 1px 2px rgba(0,0,0,0.2);
}

/* Ensure track keeps pill shape in dark mode too */
.theme-dark .prefs-toggle-track {
    border: 2px solid rgba(249,187,1,0.15);
    background-color: rgba(255,255,255,0.06);
}

.theme-dark .prefs-toggle-btn.active .prefs-toggle-knob {
    background-color: var(--primary-color);
}

.prefs-toggle-label {
    flex: 1;
}

/* High-contrast toggle — explicit light-mode styling for clarity */
:root:not(.theme-dark) .prefs-toggle-btn[data-prefs-setting="highContrast"] {
    background: #ffffff;
    border: 2px solid #000000;
    color: #000000;
}
:root:not(.theme-dark) .prefs-toggle-btn[data-prefs-setting="highContrast"] .prefs-toggle-track {
    background: #f0f0f0;
    border-color: #000000;
}
:root:not(.theme-dark) .prefs-toggle-btn[data-prefs-setting="highContrast"].active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}
:root:not(.theme-dark) .prefs-toggle-btn[data-prefs-setting="highContrast"].active .prefs-toggle-track {
    background: #000000;
    border-color: #000000;
}
:root:not(.theme-dark) .prefs-toggle-btn[data-prefs-setting="highContrast"].active .prefs-toggle-knob {
    transform: translate(24px, -50%);
    background-color: #ffffff;
}

/* Quick bar button match */
:root:not(.theme-dark) .prefs-quick-btn[data-prefs-setting="highContrast"] {
    background: #ffffff;
    border: 2px solid #000000;
    color: #000000;
}
:root:not(.theme-dark) .prefs-quick-btn[data-prefs-setting="highContrast"].active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

/* Dark-mode specific tweaks: restore gold styling */
.theme-dark .prefs-toggle-btn {
    background: rgba(0,0,0,0.06);
    border: 2px solid rgba(249,187,1,0.15);
    color: var(--panel-text-color);
}

.theme-dark .prefs-toggle-btn:hover {
    background: rgba(249, 187, 1, 0.06);
}

.theme-dark .prefs-toggle-btn.active {
    background: rgba(249,187,1,0.15);
    border-color: var(--primary-color);
    color: var(--panel-text-color);
}

.theme-dark .prefs-toggle-track {
    background-color: rgba(255,255,255,0.08);
    border: 2px solid rgba(249,187,1,0.2);
}

.theme-dark .prefs-toggle-knob {
    background-color: rgba(249,187,1,0.5);
}

.theme-dark .prefs-toggle-btn.active .prefs-toggle-knob {
    background-color: var(--primary-color);
}

/* Action Button */
.prefs-action-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, rgba(249, 187, 1, 0.15), rgba(249, 187, 1, 0.05));
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    margin-top: 8px;
}

/* Quick-access mini bar (top-right) - removed: controls are now in the preferences drawer */
#prefs-quickbar {
    display: none !important;
}

.prefs-quick-btn {
    display: none !important;
}

.prefs-action-btn:hover {
    background: linear-gradient(135deg, rgba(249, 187, 1, 0.25), rgba(249, 187, 1, 0.1));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 187, 1, 0.2);
}

/* Google Translate — hide banner and tooltip */
.goog-te-banner-frame.skiptranslate,
.goog-te-gadget-icon,
.goog-logo-link,
.goog-te-balloon-frame {
    display: none !important;
}

body {
    top: 0 !important;
}

.goog-tooltip,
.goog-tooltip:hover {
    display: none !important;
}

.goog-text-highlight {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Responsive */
@media (max-width: 480px) {
    #prefs-drawer {
        width: 100%;
        right: -100%;
    }

    #prefs-drawer.open {
        right: 0;
    }

    .prefs-language-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   BACK TO TOP BUTTON
   =================================== */
#back-to-top {
    position: fixed;
    bottom: 100px; /* Positioned above the accessibility toggle */
    right: 27px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: var(--primary-bg-color);
    border: 3px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    box-shadow: var(--shadow-elevated);
}

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

#back-to-top:hover {
    transform: scale(1.1);
    background-color: #ffd64f;
}

.admin-small-btn {
    padding: 0.4em 0.8em;
    min-height: auto;
    border-radius: 0.8em;
}

/* ===================================
   HIGH CONTRAST MODE OVERRIDES
   Ensures a single explicit high-contrast palette that applies consistently
   across light and dark themes when the accessibility toggle is enabled.
   =================================== */
body.a11y-high-contrast {
    --primary-bg-color: #000000 !important;        /* page background */
    --panel-bg-color: #000000 !important;          /* panels/drawers */
    --body-text-color: #ffffff !important;         /* main text */
    --primary-color: #ffffff !important;           /* headings / primary */
    --accent-color: #ffff00 !important;            /* accents (high visibility yellow) */
    --panel-text-color: #ffffff !important;
    --panel-border-color: #ffffff !important;
    --header-bg-color: #000000 !important;
    --header-text-color: #ffffff !important;
}

/* Make sure body uses the high contrast background and text */
body.a11y-high-contrast,
body.a11y-high-contrast * {
    background-color: transparent !important; /* avoid accidental colored backgrounds on components */
    color: var(--body-text-color) !important;
    fill: var(--body-text-color) !important;
    border-color: var(--panel-border-color) !important;
}

/* Panels and surface elements should have an explicit panel background to separate content blocks */
body.a11y-high-contrast #prefs-drawer,
body.a11y-high-contrast .padding-box,
body.a11y-high-contrast .background-tint,
body.a11y-high-contrast .prefs-lang-btn,
body.a11y-high-contrast .margin-box,
body.a11y-high-contrast .map-placeholder,
body.a11y-high-contrast .route-info {
    background-color: var(--panel-bg-color) !important;
    color: var(--panel-text-color) !important;
    border-color: var(--panel-border-color) !important;
}

/* Links and interactive elements use high-visibility accent */
body.a11y-high-contrast a,
body.a11y-high-contrast header nav a,
body.a11y-high-contrast .highlight-link,
body.a11y-high-contrast .border-link,
body.a11y-high-contrast .email-button {
    color: var(--accent-color) !important;
}

/* Toggle and quickbar appearance in high contrast */
body.a11y-high-contrast .prefs-toggle-btn,
body.a11y-high-contrast .prefs-quick-btn {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

body.a11y-high-contrast .prefs-toggle-btn.active,
body.a11y-high-contrast .prefs-quick-btn.active {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}

/* Ensure active toggle knob is visible */
body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-knob,
body.a11y-high-contrast .prefs-quick-btn.active {
    background-color: #000000 !important;
}

/* Reading highlight used by accessibility features */
body.a11y-high-contrast .a11y-reading-highlight {
    background: var(--accent-color) !important;
    color: #000 !important;
}

/* Ensure header background and text follow high-contrast vars */
body.a11y-high-contrast header,
body.a11y-high-contrast footer {
    background-color: var(--header-bg-color) !important;
    color: var(--header-text-color) !important;
}

/* Keep focus outlines extremely visible */
body.a11y-high-contrast :focus-visible {
    outline: 4px solid var(--accent-color) !important;
    outline-offset: 3px !important;
}

/* -------------------------------
   Ensure high-contrast appearance when dark theme is active
   This forces the same black/white/yellow palette and control styles
   whether light or dark base theme is selected.
   ------------------------------- */
.theme-dark body.a11y-high-contrast,
.theme-dark body.a11y-high-contrast * {
    /* set the canonical high-contrast variables */
    --primary-bg-color: #000000 !important;
    --panel-bg-color: #000000 !important;
    --body-text-color: #ffffff !important;
    --primary-color: #ffffff !important;
    --accent-color: #ffff00 !important;
    --panel-text-color: #ffffff !important;
    --panel-border-color: #ffffff !important;
    --header-bg-color: #000000 !important;
    --header-text-color: #ffffff !important;
    color: var(--body-text-color) !important;
    fill: var(--body-text-color) !important;
    border-color: var(--panel-border-color) !important;
}

/* Ensure the page background uses the high-contrast primary background */
body.a11y-high-contrast {
    background-color: var(--primary-bg-color) !important;
}

/* Make sure generic elements inherit readable text and borders (avoid forcing transparent backgrounds) */
body.a11y-high-contrast *,
.theme-dark body.a11y-high-contrast * {
    color: var(--body-text-color) !important;
    fill: var(--body-text-color) !important;
    border-color: var(--panel-border-color) !important;
}

/* Force headings to use solid, readable text (remove gradient fills) */
body.a11y-high-contrast h1,
body.a11y-high-contrast h2,
body.a11y-high-contrast h3,
body.a11y-high-contrast .prefs-drawer-header h2,
.theme-dark body.a11y-high-contrast h1,
.theme-dark body.a11y-high-contrast h2,
.theme-dark body.a11y-high-contrast h3,
.theme-dark body.a11y-high-contrast .prefs-drawer-header h2 {
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: var(--body-text-color) !important;
    color: var(--body-text-color) !important;
}

/* Controls & quickbar in dark+high-contrast */
.theme-dark body.a11y-high-contrast .prefs-toggle-btn,
.theme-dark body.a11y-high-contrast .prefs-quick-btn,
body.a11y-high-contrast .prefs-toggle-btn,
body.a11y-high-contrast .prefs-quick-btn {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

.theme-dark body.a11y-high-contrast .prefs-toggle-btn.active,
.theme-dark body.a11y-high-contrast .prefs-quick-btn.active,
body.a11y-high-contrast .prefs-toggle-btn.active,
body.a11y-high-contrast .prefs-quick-btn.active {
    background: #ffffff !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}

.theme-dark body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-knob,
.theme-dark body.a11y-high-contrast .prefs-quick-btn.active .prefs-toggle-knob,
body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-knob,
body.a11y-high-contrast .prefs-quick-btn.active .prefs-toggle-knob {
    background-color: #000000 !important;
}

.theme-dark body.a11y-high-contrast header,
.theme-dark body.a11y-high-contrast footer,
body.a11y-high-contrast header,
body.a11y-high-contrast footer {
    background-color: var(--header-bg-color) !important;
    color: var(--header-text-color) !important;
}

/* Enforce pill-shaped toggle tracks and visible labels in high-contrast modes */

/* Stronger: target drawer-specific toggles to override any earlier attribute-based rules */
body.a11y-high-contrast #prefs-drawer .prefs-toggle-btn,
.theme-dark body.a11y-high-contrast #prefs-drawer .prefs-toggle-btn {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    padding: 10px 12px !important;
    pointer-events: auto !important;
}

body.a11y-high-contrast #prefs-drawer .prefs-toggle-track,
.theme-dark body.a11y-high-contrast #prefs-drawer .prefs-toggle-track {
    width: 52px !important;
    height: 28px !important;
    flex: 0 0 auto !important;
    display: inline-block !important;
    padding: 2px !important;
    border-radius: 999px !important;
    box-sizing: border-box !important;
    background-color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

body.a11y-high-contrast #prefs-drawer .prefs-toggle-track .prefs-toggle-knob,
.theme-dark body.a11y-high-contrast #prefs-drawer .prefs-toggle-track .prefs-toggle-knob,
body.a11y-high-contrast #prefs-drawer .prefs-toggle-knob,
.theme-dark body.a11y-high-contrast #prefs-drawer .prefs-toggle-knob {
    width: 20px !important;
    height: 20px !important;
    left: 6px !important;
    background-color: #000000 !important;
}

body.a11y-high-contrast #prefs-drawer .prefs-toggle-btn .prefs-toggle-label,
.theme-dark body.a11y-high-contrast #prefs-drawer .prefs-toggle-btn .prefs-toggle-label {
    color: #ffffff !important;
    margin-left: 6px !important;
}

/* Also ensure quickbar-hosted toggles match */
body.a11y-high-contrast #prefs-quickbar .prefs-quick-btn,
.theme-dark body.a11y-high-contrast #prefs-quickbar .prefs-quick-btn {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
}

body.a11y-high-contrast #prefs-quickbar .prefs-quick-btn .prefs-toggle-track,
.theme-dark body.a11y-high-contrast #prefs-quickbar .prefs-quick-btn .prefs-toggle-track {
    width: 36px !important;
    height: 20px !important;
}

/* End stronger overrides */

/* Ensure toggle tracks retain fixed pill shape and size even when theme/contrast overrides are active */
body.a11y-high-contrast .prefs-toggle-track,
.theme-dark body.a11y-high-contrast .prefs-toggle-track,
body.a11y-high-contrast .prefs-quick-btn .prefs-toggle-track,
.theme-dark body.a11y-high-contrast .prefs-quick-btn .prefs-toggle-track {
    width: 52px !important;
    height: 28px !important;
    padding: 2px !important;
    border-radius: 999px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    background-color: #ffffff !important; /* light track so knob is visible */
    border: 2px solid #ffffff !important;
}

/* Knob visibility and placement */
body.a11y-high-contrast .prefs-toggle-knob,
.theme-dark body.a11y-high-contrast .prefs-toggle-knob {
    width: 20px !important;
    height: 20px !important;
    left: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background-color: #000000 !important;
    box-shadow: none !important;
}

/* Active knob position */
body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-knob,
.theme-dark body.a11y-high-contrast .prefs-toggle-btn.active .prefs-toggle-knob {
    transform: translate(24px, -50%) !important;
    background-color: #000000 !important;
}

/* Make sure labels are visible and laid out next to the track */
body.a11y-high-contrast .prefs-toggle-btn,
.theme-dark body.a11y-high-contrast .prefs-toggle-btn {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 12px !important;
}

body.a11y-high-contrast .prefs-toggle-label,
.theme-dark body.a11y-high-contrast .prefs-toggle-label {
    color: var(--panel-text-color) !important;
    font-weight: 600 !important;
}

/* Ensure quickbar buttons keep a consistent small track look */
body.a11y-high-contrast .prefs-quick-btn,
.theme-dark body.a11y-high-contrast .prefs-quick-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
}

/* LIGHT-MODE HIGH CONTRAST VARIANT */
/* A readable, light-background high-contrast palette tied to the light theme.
   Keeps the pleasant light grey page feel but enforces strong text and borders. */
body.a11y-high-contrast-light {
    --primary-bg-color: #f5f6f7 !important; /* page background: light grey */
    --panel-bg-color: #ffffff !important;   /* panels: white */
    --body-text-color: #000000 !important;  /* main text: black */
    --primary-color: #000000 !important;    /* headings / primary */
    --accent-color: #ffd64f !important;     /* high-visibility yellow accent */
    --panel-text-color: #000000 !important;
    --panel-border-color: #000000 !important;
    --header-bg-color: #f5f6f7 !important;
    --header-text-color: #000000 !important;
}

/* Controls for light high-contrast */
body.a11y-high-contrast-light .prefs-toggle-btn,
body.a11y-high-contrast-light .prefs-quick-btn {
    background: #ffffff !important;
    border-color: #000000 !important;
    color: #000000 !important;
}

body.a11y-high-contrast-light .prefs-toggle-btn.active,
body.a11y-high-contrast-light .prefs-quick-btn.active {
    background: var(--accent-color) !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

body.a11y-high-contrast-light .prefs-toggle-track {
    background: #ffffff !important;
    border-color: #000000 !important;
}

body.a11y-high-contrast-light .prefs-toggle-btn .prefs-toggle-knob {
    background-color: #000000 !important;
}

body.a11y-high-contrast-light header,
body.a11y-high-contrast-light footer {
    background-color: var(--header-bg-color) !important;
    color: var(--header-text-color) !important;
}

/* Ensure headings are solid in the light high-contrast variant */
body.a11y-high-contrast-light h1,
body.a11y-high-contrast-light h2,
body.a11y-high-contrast-light h3,
body.a11y-high-contrast-light .prefs-drawer-header h2 {
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: var(--body-text-color) !important;
    color: var(--body-text-color) !important;
}

/* Keep the existing dark high-contrast rules as-is (they apply when 'a11y-high-contrast-dark' or generic 'a11y-high-contrast' is present) */

/* Favorites Button Styling */
.fav-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s ease;
}
.fav-btn:hover {
    transform: scale(1.2);
}

.route-name-link {
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-decoration: none;
    transition: color 180ms ease;
}

.route-name-link:hover,
.route-name-link:focus-visible {
    color: #ffd64f;
}

.pro-locked-link {
    cursor: not-allowed;
}

.pro-locked-route {
    opacity: 0.82;
}

.routes-load-more {
    display: flex;
    width: 100%;
    align-items: center;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.25rem auto 0;
}

.routes-load-more[hidden] {
    display: none;
}

.routes-load-more-button {
    min-width: 14rem;
}

.pro-route-note {
    margin: 0;
    color: #ffe494;
    font-size: 1rem;
}

.routes-total-note {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.05rem;
    font-weight: 800;
}

.submitted-routes-section {
    margin-top: 2rem;
}

.submitted-routes-section > p {
    margin-top: -0.5rem;
    font-size: 1.15rem;
}

.routes-table-scroll {
    width: 100%;
    overflow-x: auto;
}

#submitted-routes-table {
    width: 100%;
    min-width: 1000px;
    margin-top: 1rem;
}
/* ===================================
   ABOUT PAGE ENHANCEMENTS
   =================================== */
.about-intro-split {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    margin: 4rem auto;
    max-width: 1100px;
    width: 100%;
}

.intro-text-content {
    flex: 1.2;
}

.intro-text-content p {
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1.5rem;
}

.intro-image-wrapper {
    flex: 1;
    width: 100%;
    max-width: 600px;
}

.about-hero-image {
    width: 100%;
    height: auto;
    border-radius: 2rem;
    box-shadow: var(--shadow-elevated);
    border: 3px solid var(--primary-color);
}

.stats-row {
    display: flex;
    justify-content: space-around;
    padding: 3rem;
    border-radius: 2rem;
    margin: 4rem auto;
    max-width: 1100px;
    width: 100%;
    border: 1px solid var(--secondary-bg-color);
    background-color: rgba(249, 187, 1, 0.03);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), #ffd64f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 700;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

@media (max-width: 768px) {
    .stats-row {
        flex-direction: column;
        gap: 2.5rem;
        padding: 2rem;
    }
}

/* ===================================
   CONTACT MODAL
   =================================== */
.contact-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.contact-modal.active {
    display: flex;
}

.contact-modal-content {
    background: var(--primary-bg-color);
    border: 3px solid var(--primary-color);
    border-radius: 1.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 550px;
    position: relative;
    box-shadow: var(--shadow-elevated);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
}

.contact-modal h2 {
    margin-top: 0;
    text-align: left;
}

.contact-modal textarea {
    resize: vertical;
}

/* ===================================
   CUSTOM MAP PINS
   =================================== */
.custom-div-icon {
    background: none !important;
    border: none !important;
}

.custom-pin-marker {
    width: 30px;
    height: 42px;
    position: relative;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    display: flex;
    justify-content: center;
}

.pin-head {
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    margin-top: 2px;
}

.custom-pin-marker.for-most .pin-head { background-color: #2f9d6b; }
.custom-pin-marker.for-many .pin-head { background-color: #32CD32; }
.custom-pin-marker.for-some .pin-head { background-color: #FFFF00; }
.custom-pin-marker.for-few-suggested .pin-head { background-color: #FFA500; }
.custom-pin-marker.for-few-required .pin-head { background-color: #FF6666; }
.custom-pin-marker.for-very-few .pin-head { background-color: #8B0000; }
.custom-pin-marker.unknown .pin-head { background-color: #666; }

/* Use a softer gold for yellow map markers in dark mode. */
.theme-dark .custom-pin-marker.for-some .pin-head {
    background-color: #f3df9b;
}

.theme-dark .user-marker > div,
.theme-dark .facility-marker > div > div {
    background-color: #f3df9b !important;
}

/* ===================================
   ROUTE DETAILS PAGE
   =================================== */
.route-details-page {
    max-width: 1400px;
    gap: 1.5rem;
    padding-bottom: 4rem;
}

/* Route submission form */
.route-submission-form {
    max-width: 1100px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.5rem;
    align-items: start;
    text-align: left;
}

.route-form-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.45rem;
}

.route-form-field label,
.route-image-field > label {
    margin: 0;
    color: #ffe494;
    font-size: 1rem;
    font-weight: 750;
}

.route-form-field input,
.route-form-field select,
.route-form-field textarea {
    width: 100%;
    margin: 0;
}

.route-form-field textarea {
    min-height: 7rem;
    resize: vertical;
}

.route-form-wide,
.route-submission-form > button[type="submit"],
.route-submission-form > .route-form-cancel,
.route-submission-form > .auth-error {
    grid-column: 1 / -1;
}

.route-image-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(249, 187, 1, 0.35);
    border-radius: var(--border-radius-base);
}

.route-terms-panel {
    padding: 1.5rem;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius-base);
    font-size: 0.95rem;
}

.route-terms-panel p {
    margin: 0 0 1rem;
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
}

.route-terms-panel label {
    margin: 0;
}

.route-location-picker {
    padding: 1.25rem;
    border: 1px solid rgba(249, 187, 1, 0.45);
    border-radius: var(--border-radius-base);
    background: rgba(0, 23, 39, 0.65);
}

.route-location-picker-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.route-location-picker-heading h3 {
    margin: 0;
    font-size: 1.35rem;
    text-align: left;
}

.route-location-picker-heading p {
    margin: 0.25rem 0 0;
    color: #fff7d6;
    font-size: 1rem;
    text-align: left;
}

#route-picker-map {
    width: 100%;
    min-height: 430px;
    border: 2px solid var(--primary-color);
    border-radius: 0.75rem;
    background: #d9e6ea;
    overflow: hidden;
}

.route-submission-form > button[type="submit"] {
    justify-self: center;
    min-width: min(100%, 16rem);
}

.route-submission-form > .route-form-cancel {
    display: none;
    justify-self: center;
}

.route-submission-form > .auth-error {
    width: 100%;
    min-height: 1.5rem;
    margin: 0;
    text-align: center;
}

@media (max-width: 760px) {
    .route-submission-form {
        grid-template-columns: 1fr;
    }

    .route-form-wide,
    .route-submission-form > button[type="submit"],
    .route-submission-form > .route-form-cancel,
    .route-submission-form > .auth-error {
        grid-column: 1;
    }

    .route-image-field {
        align-items: stretch;
        flex-direction: column;
    }

    .route-location-picker-heading {
        align-items: stretch;
        flex-direction: column;
    }

    #route-picker-map {
        min-height: 340px;
    }
}

.route-details-actions {
    width: 100%;
    margin-top: 2rem;
}

.route-back-link {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: 999px;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.route-back-link:hover,
.route-back-link:focus-visible {
    background: var(--primary-color);
    color: var(--primary-bg-color);
    transform: translateY(-2px);
}

.route-details-hero {
    padding: clamp(2rem, 6vw, 5rem);
    border: 2px solid rgba(249, 187, 1, 0.45);
    border-radius: 2rem;
    background:
        radial-gradient(circle at top right, rgba(249, 187, 1, 0.18), transparent 40%),
        rgba(249, 187, 1, 0.04);
    box-shadow: var(--shadow-elevated);
    text-align: center;
}

.route-details-eyebrow {
    margin: 0;
    color: #ffe494;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.route-details-hero h1 {
    max-width: 1000px;
    margin: 0.8rem auto 1rem;
}

.route-details-location,
.route-details-description {
    max-width: 850px;
}

.route-details-location {
    margin: 0.5rem auto;
    color: #fff1b3;
    font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.route-details-description {
    margin: 1rem auto 0;
    color: #fff7d6;
    font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.route-details-section {
    width: 100%;
    padding: clamp(1.5rem, 4vw, 3rem);
    border-radius: 1.5rem;
}

.route-details-section h2 {
    margin-top: 0;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.route-details-section-tinted {
    background: rgba(249, 187, 1, 0.07);
    border: 1px solid rgba(249, 187, 1, 0.25);
}

.route-details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.route-details-grid-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.route-details-grid-ratings {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.route-detail-card,
.route-access-notes article {
    min-width: 0;
    padding: 1.5rem;
    border: 2px solid rgba(249, 187, 1, 0.45);
    border-radius: 1.25rem;
    background: rgba(0, 23, 39, 0.85);
    box-shadow: var(--shadow-base);
}

.route-detail-card h3,
.route-access-notes h3 {
    margin: 0.35rem 0 0.6rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    text-align: left;
}

.route-detail-card p,
.route-access-notes p {
    margin: 0;
    color: #fff7d6;
    font-size: 1.05rem;
    line-height: 1.6;
    text-align: left;
}

.route-detail-icon {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--primary-bg-color);
    font-size: 1.4rem;
    font-weight: 900;
}

.route-rating-card p {
    display: inline-flex;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    background: rgba(249, 187, 1, 0.12);
    color: #fff1b3;
    font-weight: 800;
}

.route-access-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.consent-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    color: #fff7d6;
}

.consent-tag {
    display: inline-flex;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--primary-color);
    border-radius: 999px;
    background: rgba(249, 187, 1, 0.12);
    color: #fff1b3;
    font-weight: 700;
}

@media (max-width: 800px) {
    .route-details-grid,
    .route-details-grid-wide,
    .route-details-grid-ratings,
    .route-access-notes {
        grid-template-columns: 1fr;
    }

    .route-details-page {
        padding-inline: 1rem;
    }

    .route-details-hero {
        border-radius: 1.25rem;
    }
}

/* ===================================
   ACCESSIBILITY SCORE UTILITY CLASSES
   =================================== */

/* Score Color Classes for Route Assessment */
.score-green {
    background-color: var(--score-green);
    color: #ffffff;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(28, 99, 0, 0.3);
}

.score-yellow {
    background-color: var(--score-yellow);
    color: #5d4300;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.score-orange {
    background-color: var(--score-orange);
    color: #5a3200;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.score-red {
    background-color: var(--score-red);
    color: #ffffff;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(183, 29, 63, 0.3);
}

/* Admin Assessment Table */
.admin-assessment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: rgba(0, 23, 39, 0.5);
    border: 1px solid var(--primary-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.admin-assessment-table tbody tr {
    border-bottom: 1px solid rgba(249, 187, 1, 0.2);
}

.admin-assessment-table td {
    padding: 1rem;
    text-align: left;
    color: #fff7d6;
}

.admin-assessment-table td:last-child {
    text-align: right;
    font-weight: 700;
    color: var(--primary-color);
}

/* Tier Label Classes */
.tier-for-most {
    color: var(--score-green);
    font-weight: 700;
}

.tier-for-many {
    color: #82CA66;
    font-weight: 700;
}

.tier-for-some {
    color: var(--score-yellow);
    font-weight: 700;
}

.tier-for-few-suggested {
    color: var(--score-orange);
    font-weight: 700;
}

.tier-for-few-required {
    color: #FF8388;
    font-weight: 700;
}

.tier-for-very-few {
    color: #b71d3f;
    font-weight: 700;
}
