/* ============================================================
   QSpot Website — Core Stylesheet
   Brand palette (from the QSpot logo):
     Aubergine  #3F1842  (primary)
     Steel blue #4D72A0  (secondary / accent — the logo's drop-shadow)
     White      #FFFFFF  (wordmark)
   Gold (#F0B429) is reserved exclusively as the QSpot Premium accent.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #3F1842;
    --primary-dark: #2A0F2D;
    --primary-light: #7A3A7C;
    --secondary: #4D72A0;
    --secondary-dark: #3A5A82;
    --gold: #F0B429;
    --gold-text: #8A6A0B; /* AA-contrast gold for text on light backgrounds */
    --text-primary: #1a1a2e;
    --text-secondary: #555;
    --text-light: #888;
    --bg-white: #ffffff;
    --bg-light: #f8f7fc;
    --bg-dark: #1a1a2e;
    --border: #e0e0e0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --max-width: 1200px;
    --transition: 0.3s ease;
}

html {
    scroll-behavior: smooth;
    color-scheme: light dark;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-primary);
    background: var(--bg-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Accessibility --- */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 16px;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    z-index: 9999;
    font-weight: 600;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 8px;
}

/* Focus-visible styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Hide outline for mouse clicks */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
    outline: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    line-height: 1.2;
    font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: 1.3rem; }

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Layout --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    margin-bottom: 12px;
}

.section-header p {
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
}

/* --- Navigation --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    /* iOS safe area: account for notch/Dynamic Island */
    padding-top: env(safe-area-inset-top, 0px);
}

.navbar.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.nav-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
}

/* Logo PNG image — replaces the text "Q" icon */
.logo-img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Larger logo in footer */
.footer .logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.nav-cta {
    background: var(--primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

.nav-cta:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.nav-cta::after {
    display: none !important;
}

/* Mobile menu toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-teal {
    background: var(--secondary);
    color: var(--bg-dark);
}

.btn-teal:hover {
    background: var(--secondary-dark);
    color: white;
    transform: translateY(-2px);
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    min-height: 100svh; /* iOS Safari: excludes collapsible address bar */
    display: flex;
    align-items: center;
    padding-top: 64px;
    background: linear-gradient(135deg, var(--bg-light) 0%, #efe7f3 50%, #e3ecf6 100%);
    overflow: hidden;
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Gradient text for hero accent — design refresh */
.hero-content h1 span {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: var(--primary); /* fallback for browsers that don't support background-clip: text */
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 32px;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-map-preview {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 4/3;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 3px solid rgba(98, 0, 238, 0.1);
}

.hero-map-preview img,
.hero-map-preview .placeholder-map {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-map {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #efe7f3, #e3ecf6);
    color: var(--text-light);
    font-size: 1.1rem;
}

/* --- Features Section --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.feature-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 32px;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.feature-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.feature-card h3 {
    margin-bottom: 10px;
}

/* Colored feature icons — design refresh (light mode) */
.feature-card:nth-child(1) .feature-icon { background: #ede7f6; }
.feature-card:nth-child(2) .feature-icon { background: #e0f7fa; }
.feature-card:nth-child(3) .feature-icon { background: #fce4ec; }
.feature-card:nth-child(4) .feature-icon { background: #fff8e1; }
.feature-card:nth-child(5) .feature-icon { background: #f3e5f5; }
.feature-card:nth-child(6) .feature-icon { background: #e8f5e9; }

/* Dark mode overrides — muted tones that sit well on dark cards */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .feature-card:nth-child(1) .feature-icon { background: #2d1f45; }
    html:not([data-theme="light"]) .feature-card:nth-child(2) .feature-icon { background: #0d2d2f; }
    html:not([data-theme="light"]) .feature-card:nth-child(3) .feature-icon { background: #3a1525; }
    html:not([data-theme="light"]) .feature-card:nth-child(4) .feature-icon { background: #2d2510; }
    html:not([data-theme="light"]) .feature-card:nth-child(5) .feature-icon { background: #2a1535; }
    html:not([data-theme="light"]) .feature-card:nth-child(6) .feature-icon { background: #102515; }
}

html[data-theme="dark"] .feature-card:nth-child(1) .feature-icon { background: #2d1f45; }
html[data-theme="dark"] .feature-card:nth-child(2) .feature-icon { background: #0d2d2f; }
html[data-theme="dark"] .feature-card:nth-child(3) .feature-icon { background: #3a1525; }
html[data-theme="dark"] .feature-card:nth-child(4) .feature-icon { background: #2d2510; }
html[data-theme="dark"] .feature-card:nth-child(5) .feature-icon { background: #2a1535; }
html[data-theme="dark"] .feature-card:nth-child(6) .feature-icon { background: #102515; }

/* --- How It Works Section --- */
.how-it-works {
    background: var(--bg-light);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
    counter-reset: step;
}

.step-card {
    text-align: center;
    padding: 32px 24px;
    counter-increment: step;
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 auto 20px;
}

.step-card h3 {
    margin-bottom: 10px;
}

/* Steps connecting line between cards — desktop only */
@media (min-width: 769px) {
    .steps-grid {
        position: relative;
    }
    .steps-grid::before {
        content: '';
        position: absolute;
        top: 24px; /* vertically centred on the number circle */
        left: calc(50% / 3 + 24px); /* rough midpoint of first circle */
        right: calc(50% / 3 + 24px);
        height: 2px;
        background: linear-gradient(90deg, var(--primary-light), var(--secondary));
        opacity: 0.4;
        z-index: 0;
        pointer-events: none;
    }
    .step-number {
        position: relative;
        z-index: 1;
    }
}

/* --- App Store Badge Buttons — design refresh --- */
.btn-appbadge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.3);
    transition: var(--transition);
    background: rgba(0,0,0,0.75);
    color: white;
    min-width: 155px;
    backdrop-filter: blur(4px);
}

.btn-appbadge:hover {
    background: rgba(0,0,0,0.92);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(255,255,255,0.5);
}

.btn-appbadge .badge-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.btn-appbadge .badge-label {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-appbadge .badge-store {
    font-size: 1rem;
    font-weight: 700;
}

/* --- Mobile sticky download bar --- */
.mobile-download-bar {
    display: none; /* shown only on mobile via media query below */
}

/* --- CTA Banner --- */
.cta-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-align: center;
    padding: 80px 24px;
}

.cta-banner h2 {
    color: white;
    margin-bottom: 16px;
}

.cta-banner p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.15rem;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Map Page --- */
body.page-map {
    overflow: hidden;
}

/* Prevent any page CSS from interfering with MapLibre's transform-based
   marker positioning. MapLibre sets transform via JS on every render frame;
   any CSS transition on that property causes the marker to animate away
   from its coordinate to position (0,0) — the "jumps to corner" bug. */
.maplibregl-marker {
    transition: none !important;
}

/* Spot marker base styles.
   NO CSS transitions or :hover rules here — any CSS transition on a child
   element inside a will-change:transform compositor layer (which MapLibre
   applies to .maplibregl-marker) forces a re-rasterization of that layer.
   During re-rasterization the browser momentarily reverts to the CSS default
   transform:translate(0,0), making the marker flash to the top-left corner.
   Hover effects are handled in JS via mouseenter/mouseleave instead. */
.spot-marker {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-page {
    padding-top: 64px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.map-toolbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.map-toolbar h2 {
    font-size: 1.2rem;
    white-space: nowrap;
}

.spot-count {
    background: var(--bg-light);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map popup */
.spot-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 220px;
    max-width: 280px;
}

.spot-popup-image {
    width: calc(100% + 20px);
    height: 120px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    margin: -10px -10px 10px -10px;
}

.spot-popup h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.spot-popup-category {
    display: inline-block;
    background: var(--bg-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.spot-popup-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.spot-popup-rating {
    font-size: 0.85rem;
    color: var(--text-light);
}

.spot-popup-cta {
    display: block;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
}

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-white);
    padding: 20px 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.map-empty-state,
.map-error-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 32px;
    z-index: 5;
}

.map-empty-state .icon,
.map-error-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.map-empty-state h3,
.map-error-state h3 {
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.map-empty-state p,
.map-error-state p {
    font-size: 0.95rem;
    max-width: 320px;
}

.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-retry:hover {
    background: var(--primary-dark);
}

/* --- About Page --- */
.about-hero {
    padding-top: 120px;
    padding-bottom: 60px;
    background: var(--bg-light);
    text-align: center;
}

.about-hero p {
    max-width: 700px;
    margin: 16px auto 0;
    font-size: 1.15rem;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

.about-content h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.about-content p {
    margin-bottom: 16px;
}

.values-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.values-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
}

.values-list .icon {
    width: 32px;
    height: 32px;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

/* Contact form */
.contact-section {
    background: var(--bg-light);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

.contact-info h3 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.contact-detail {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.contact-detail .icon {
    font-size: 1.2rem;
}

.contact-form {
    background: var(--bg-white);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-white);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(98, 0, 238, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* --- Footer --- */
.footer {
    background: var(--bg-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 60px 0 24px;
    /* iOS safe area: account for home indicator */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .nav-logo {
    margin-bottom: 12px;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.footer h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--secondary);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.35);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    /* Layout */
    .section {
        padding: 48px 0;
    }

    .container {
        padding: 0 20px;
    }

    .section-header {
        margin-bottom: 32px;
    }

    /* Nav */
    .nav-toggle {
        display: flex;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
    }

    .dark-mode-toggle {
        min-width: 40px;
        min-height: 40px;
    }

    .nav-links {
        position: fixed;
        top: calc(64px + env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 24px 20px;
        gap: 20px;
        box-shadow: var(--shadow-md);
        transform: translateY(-110%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links a {
        font-size: 1rem;
        padding: 8px 0;
        display: block;
    }

    /* Hero */
    .hero {
        padding-top: calc(64px + env(safe-area-inset-top, 0px));
        align-items: flex-start;
        padding-bottom: 48px;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 32px;
    }

    .hero-content p {
        margin-left: auto;
        margin-right: auto;
        font-size: 1.05rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    /* Shrink the hero map preview on mobile */
    .hero-map-preview {
        max-width: 340px;
        margin: 0 auto;
        aspect-ratio: 16/10;
    }

    /* Features */
    .features-grid {
        gap: 20px;
    }

    .feature-card {
        padding: 24px;
    }

    /* Steps */
    .steps-grid {
        gap: 24px;
    }

    /* About & Contact */
    .about-content,
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .footer {
        padding-top: 48px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    /* Map toolbar */
    .map-toolbar {
        flex-wrap: wrap;
        padding: 10px 16px;
        gap: 8px;
    }

    .map-toolbar h2 {
        font-size: 1rem;
    }

    /* Forms — prevent iOS auto-zoom on input focus (requires font-size >= 16px) */
    .form-group input,
    .form-group textarea {
        font-size: 16px;
    }

    /* App badge buttons on mobile: full-width stack */
    .btn-appbadge {
        justify-content: center;
        width: 100%;
        max-width: 260px;
    }

    /* Sticky download bar: shown on mobile */
    .mobile-download-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 998;
        background: rgba(255, 255, 255, 0.97);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 12px 20px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        gap: 12px;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
        transition: transform 0.3s ease;
    }

    .mobile-download-bar.hidden {
        transform: translateY(120%);
    }

    .mobile-download-bar-text {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
        flex: 1;
    }

    .mobile-download-bar-text span {
        display: block;
        font-size: 0.75rem;
        font-weight: 400;
        color: var(--text-secondary);
    }

    .mobile-download-bar-btns {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
    }

    .mobile-download-bar-btns a {
        background: var(--primary);
        color: white;
        padding: 8px 14px;
        border-radius: var(--radius-sm);
        font-size: 0.8rem;
        font-weight: 700;
        transition: var(--transition);
        white-space: nowrap;
    }

    .mobile-download-bar-btns a:hover,
    .mobile-download-bar-btns a:active {
        background: var(--primary-dark);
    }

    .mobile-download-bar-close {
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-light);
        font-size: 1.2rem;
        padding: 4px;
        line-height: 1;
        flex-shrink: 0;
    }

    /* Extra body bottom padding so content isn't hidden behind the bar */
    body.has-download-bar {
        padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    h1 { font-size: clamp(1.75rem, 8vw, 2.4rem); }
    h2 { font-size: clamp(1.4rem, 6vw, 2rem); }

    .section-header p {
        font-size: 1rem;
    }

    .feature-card {
        padding: 20px;
    }

    .cta-banner {
        padding: 56px 16px;
    }

    .about-hero {
        padding-top: 96px;
        padding-bottom: 40px;
    }

    .contact-form {
        padding: 24px 16px;
    }

    /* Map toolbar: stack title and count vertically */
    .map-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* ============================================================
   Dark Mode
   Google recognizes dark mode support via:
   1. <meta name="color-scheme" content="light dark"> in HTML
   2. css color-scheme: light dark on :root/html
   3. @media (prefers-color-scheme: dark) rules below
   Manual toggle via html[data-theme="dark"|"light"]
   ============================================================ */

/* --- Shared dark theme variable set --- */
.dark-theme-vars,
html[data-theme="dark"] {
    --gold-text: #F0B429;
    --text-primary: #e1e1f0;
    --text-secondary: #a8a8bc;
    --text-light: #6a6a82;
    --bg-white: #121218;
    --bg-light: #1c1c2a;
    --bg-dark: #09090f;
    --border: #2a2a3e;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.65);
}

/* --- Auto dark mode (OS preference) --- */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --gold-text: #F0B429;
        --text-primary: #e1e1f0;
        --text-secondary: #a8a8bc;
        --text-light: #6a6a82;
        --bg-white: #121218;
        --bg-light: #1c1c2a;
        --bg-dark: #09090f;
        --border: #2a2a3e;
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
        --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.55);
        --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.65);
        color-scheme: dark;
    }

    /* Element-specific dark overrides (OS preference) */
    html:not([data-theme="light"]) .navbar {
        background: rgba(18, 18, 24, 0.96);
        border-bottom-color: #2a2a3e;
    }

    html:not([data-theme="light"]) .nav-links {
        background: #1c1c2a;
        border-bottom: 1px solid #2a2a3e;
    }

    html:not([data-theme="light"]) .hero {
        background: linear-gradient(135deg, #1c1c2a 0%, #2a1530 50%, #0d1626 100%);
    }

    html:not([data-theme="light"]) .placeholder-map {
        background: linear-gradient(135deg, #221830, #101a28);
        color: #6a6a82;
    }

    html:not([data-theme="light"]) .nav-toggle span {
        background: #e1e1f0;
    }

    html:not([data-theme="light"]) .form-group input,
    html:not([data-theme="light"]) .form-group textarea {
        color: var(--text-primary);
    }

    html:not([data-theme="light"]) .map-toolbar {
        background: var(--bg-light);
        border-bottom-color: var(--border);
    }

    html:not([data-theme="light"]) .map-loading {
        background: var(--bg-light);
    }

    html:not([data-theme="light"]) .contact-form {
        background: var(--bg-light);
    }

    html:not([data-theme="light"]) .hero-map-preview {
        background: var(--bg-light);
        border-color: rgba(123, 160, 204, 0.18);
    }
}

/* --- Dark mode: new elements --- */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .nav-links {
        background: #1c1c2a;
    }
    html:not([data-theme="light"]) .mobile-download-bar {
        background: rgba(28, 28, 42, 0.97);
        border-top-color: #2a2a3e;
    }
}

html[data-theme="dark"] .mobile-download-bar {
    background: rgba(28, 28, 42, 0.97);
    border-top-color: #2a2a3e;
}

/* --- Manual dark mode element overrides --- */
html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] .navbar {
    background: rgba(18, 18, 24, 0.96);
    border-bottom-color: #2a2a3e;
}

html[data-theme="dark"] .nav-links {
    background: #1c1c2a;
    border-bottom: 1px solid #2a2a3e;
}

html[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #1c1c2a 0%, #1e1530 50%, #0c1f20 100%);
}

html[data-theme="dark"] .placeholder-map {
    background: linear-gradient(135deg, #221830, #101a28);
    color: #6a6a82;
}

html[data-theme="dark"] .nav-toggle span {
    background: #e1e1f0;
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group textarea {
    color: var(--text-primary);
}

html[data-theme="dark"] .map-toolbar {
    background: var(--bg-light);
    border-bottom-color: var(--border);
}

html[data-theme="dark"] .map-loading {
    background: var(--bg-light);
}

html[data-theme="dark"] .contact-form {
    background: var(--bg-light);
}

html[data-theme="dark"] .hero-map-preview {
    background: var(--bg-light);
    border-color: rgba(187, 134, 252, 0.15);
}

/* --- Manual light mode (overrides OS dark preference) --- */
html[data-theme="light"] {
    color-scheme: light;
}

/* --- Dark mode toggle button --- */
.dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    line-height: 0;
}

.dark-mode-toggle:hover {
    color: var(--primary);
    background: var(--bg-light);
}

.dark-mode-toggle:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Default: show moon (light mode → click to go dark) */
.dark-mode-toggle .icon-sun { display: none; }
.dark-mode-toggle .icon-moon { display: block; }

/* Dark mode active: show sun (dark mode → click to go light) */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .dark-mode-toggle .icon-sun { display: block; }
    html:not([data-theme="light"]) .dark-mode-toggle .icon-moon { display: none; }
}

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

html[data-theme="light"] .dark-mode-toggle .icon-sun { display: none; }
html[data-theme="light"] .dark-mode-toggle .icon-moon { display: block; }
