/* ===========================
   DirtRidesNZ — style.css
   Pure CSS layout (no Bootstrap)
   =========================== */

/* ---- Brand palette & tokens ---- */
:root{
    --deep-forest:#1B3B1A;   /* headers / footer */
    --clay-brown:#8A5A3D;    /* accents */
    --sky-blue:#2E9CCA;      /* links / active underline */
    --off-white:#F5F5F5;     /* page background */
    --charcoal:#222222;      /* text */
    --container: 1120px;     /* max content width */
    --radius: 12px;
    --shadow: 0 4px 16px rgba(0,0,0,.15);
}

/* ---- Global / layout ---- */
* { box-sizing: border-box; }
html, body {
    margin: 0;
    background-color: var(--deep-forest);
}
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--off-white);
    color: var(--charcoal);
    font: 16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
main {
    flex: 1;
    margin: 0 auto;
    width: 100%;
    max-width: var(--container);
    padding: 1rem 1.5rem;
}

/* ---- Container (custom, not Bootstrap) ---- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 16px;
}

/* Slightly more breathing room on small screens */
@media (max-width: 768px) {
    .container { padding-inline: 20px; }
}

/* ---- Header ---- */
header.site-header {
    background: var(--deep-forest);
    color: #fff;
}
.site-header__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}
.brand {
    font-weight: 800;
    letter-spacing: .3px;
    text-decoration: none;
    color: #fff;
    font-size: 1.25rem;
    white-space: nowrap;
}

/* ---- Primary nav (desktop) ---- */
nav.primary-nav ul {
    margin: 0; padding: 0;
    list-style: none;
    display: flex; gap: 18px;
}
nav.primary-nav a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    padding: 6px 2px;
    display: inline-block;
}
nav.primary-nav a:hover,
nav.primary-nav a:focus { color: #fff; }
nav.primary-nav a.active {
    color:#fff;
    border-bottom: 2px solid var(--sky-blue);
}

/* ---- Mobile menu (CSS-only hamburger) ---- */
.menu-toggle { display: none; } /* hidden checkbox */
.menu-icon {
    display: none;             /* shown only on mobile */
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    width: 28px; height: 28px;
    gap: 5px;
}
.menu-icon span {
    display: block;
    width: 100%; height: 2px;
    background: #fff; border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
}

/* Mobile layout */
@media (max-width: 768px) {
    .site-header__row { flex-wrap: wrap; }
    .menu-icon { display: flex; }
    .primary-nav { width: 100%; display: none; }
    nav.primary-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 8px 0;
        margin: 0;
    }

    /* Show nav when toggled */
    .menu-toggle:checked ~ .primary-nav { display: block; }

    /* Animate hamburger into X */
    .menu-toggle:checked + .menu-icon span:nth-child(1) {
        transform: rotate(45deg) translateY(7px);
    }
    .menu-toggle:checked + .menu-icon span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle:checked + .menu-icon span:nth-child(3) {
        transform: rotate(-45deg) translateY(-7px);
    }
}

/* Ensure header/footer content never hugs edges */
@media (max-width: 768px) {
    header.site-header,
    footer.site-footer { padding-inline: 12px; }
}

/* ---- Footer ---- */
footer.site-footer {
    background: var(--deep-forest);
    color: #cfe3cf;
    border-top: 1px solid rgba(255,255,255,.12);
}
.site-footer__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0;
}
.footer-links {
    display: flex; gap: 16px; flex-wrap: wrap;
}
.footer-links a {
    color: #cfe3cf;
    text-decoration: none;
    opacity: .9;
}
.footer-links a:hover,
.footer-links a:focus { opacity: 1; text-decoration: underline; }

/* ---- Utilities ---- */
.visually-hidden {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden; clip: rect(1px,1px,1px,1px);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Focus ring for accessibility */
a:focus, button:focus, input:focus, [tabindex]:focus {
    outline: 2px solid var(--sky-blue);
    outline-offset: 2px;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .menu-icon span { transition: none; }
}

/* ---- Optional: pretty map container (if used later) ---- */
#map-container {
    width: 100%;
    height: 70vh;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-block: 1rem 2rem;
}

/* Full-bleed section on mobile (remove container padding) */
.fullbleed-mobile {
    /* compensate for container padding on mobile */
    margin-left: 0px;
    margin-right: 0px;
}
@media (max-width: 768px) {
    .fullbleed-mobile {
        margin-left: -10px;
        margin-right: -10px;
        border-radius: 0;
        box-shadow: none;
    }
}


/* Loading overlay (shown while .is-loading is present) */
.map.is-loading .map-loading {
    opacity: 1;
    visibility: visible;
}

/** Once mapbox activated, swap over to absolute positioning */
.mapboxgl-map .map-loading {
    position: absolute;
}

.map-loading {
    height: 100%;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(2px);
    transition: opacity .25s ease, visibility .25s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 2;
}
.map-loading-inner {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.1rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow);
    color: var(--charcoal);
    font-weight: 600;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;   /* light ring */
    border-top-color: var(--sky-blue); /* accent */
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; border-top-color: #e5e7eb; }
}