/*
 * Map loading state
 */

.homepage__map--loading::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1001;
    background: transparent;
    cursor: wait;
}

/*
 * Map location status
 */

.homepage__map-location-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.94);
    color: #27272a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    font-size: 12px;
    line-height: 1.3;
    pointer-events: none;
}

.homepage__map-location-status-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #D97706;
}

/* Neutral colour while acquiring location. */
.homepage__map-location-status--loading .homepage__map-location-status-icon {
    color: #71717a;
}

/* Respect the hidden attribute despite the component's display:flex. */
.homepage__map-location-status[hidden] {
    display: none;
}

/*
 * Map recenter control
 */

.homepage__map-recenter[hidden] {
    display: none;
}

.homepage__map-recenter {
    position: absolute;
    right: 12px;
    bottom: 36px;
    z-index: 1003;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #2563EB;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.homepage__map-recenter svg {
    width: 22px;
    height: 22px;
}

.homepage__map-recenter:hover {
    background: #FFFFFF;
}

.homepage__map-recenter:focus-visible {
    outline: 2px solid #2563EB;
    outline-offset: 2px;
}

/*
 * Mobile Homepage Layout
 *
 * Hide inactive views on mobile.
 * Visibility is controlled by the bottom navigation JavaScript.
 */
@media (max-width: 1023px) {
    .homepage__mobile-view--hidden,
    .homepage__content-cards--hidden {
        display: none !important;
    }

    .homepage .fixed.bottom-0 a[aria-current="page"] {
        color: #18181b;
        font-weight: 600;
    }

    .homepage .fixed.bottom-0 a[aria-current="page"] svg {
        color: #FFCC00;
        background-color: #27272a;
        border-radius: 9999px;
        padding: 4px;
    }

    /* Keep the map view between the fixed header and bottom navigation. */
    .homepage #nearby-places:not(.homepage__mobile-view--hidden) {
        position: fixed;
        top: calc(var(--dim-mobile-header-height) + env(safe-area-inset-top));
        right: 0;
        bottom: 63px;
        left: 0;
        z-index: 10;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    /* Hide the Nearby Places heading in the mobile map view. */
    .homepage #nearby-places:not(.homepage__mobile-view--hidden) > div:first-child {
        display: none;
    }

    /* Let the map wrapper take up all remaining space. */
    .homepage #nearby-places:not(.homepage__mobile-view--hidden) > div:last-child {
        display: flex;
        flex: 1;
        flex-direction: column;
        min-height: 0;
        padding-left: 0;
        padding-right: 0;
    }

    /* Make the map fill its wrapper without borders or rounded corners. */
    .homepage #nearby-places:not(.homepage__mobile-view--hidden) #homepage__map {
        flex: 1;
        height: auto;
        min-height: 0;
        border-radius: 0;
        box-shadow: none;
    }

    /* Hide redundant card titles on mobile; the bottom navigation identifies the view. */
    .homepage #top-5 > div > div:first-child,
    .homepage #latest-reviews > div > div:first-child {
        display: none;
    }

    /* Remove the card appearance from homepage lists on mobile. */
    .homepage #top-5 > div,
    .homepage #latest-reviews > div {
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    /* Let homepage lists use the full available width on mobile. */
    .homepage #homepage__content-cards {
        padding-top: 0;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    .homepage #top-5 > div > div:last-child,
    .homepage #latest-reviews > div > div:last-child {
        padding-left: 0;
        padding-right: 0;
    }

    /* Keep list content inset while allowing dividers to span full width. */
    .homepage #top-5 li > div,
    .homepage #latest-reviews li > div {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Make entire restaurant and review entries clickable. */
    .homepage #top-5 li,
    .homepage #latest-reviews li {
        position: relative;
    }

    .homepage #top-5 li a::after,
    .homepage #latest-reviews li a::after {
        content: "";
        position: absolute;
        inset: 0;
    }

    /* Prevent the stretched link from underlining on hover. */
    .homepage #top-5 li a:hover,
    .homepage #latest-reviews li a:hover {
        text-decoration: none;
    }

    /* The bottom navigation replaces the footer on mobile. */
    .base__footer {
        display: none;
    }
}
