/* maps.carol.rent: the map fills the page; everything else floats on it. */

:root {
    --primary: #323a46;   /* the landing's --primary */
    --text: #1f2937;
    --muted: #667085;
    --line: #d0d5dd;
    --surface: #ffffff;
    --shadow: 0 2px 10px rgba(16, 24, 40, 0.16);
    --radius: 10px;
    --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #f2f3f0;
    color: var(--text);
    font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Helvetica, Arial, sans-serif;
}

.map {
    position: fixed;
    inset: 0;
}

/* --- the bar: brand, mode, share, and the legend under them -------------- */

.bar {
    position: absolute;
    top: var(--gap);
    /* Physical left in every language: MapLibre's controls sit on the right
       and do not flip for right-to-left pages. */
    left: var(--gap);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(380px, calc(100% - 2 * var(--gap) - 44px));
    padding: 6px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* The carol.rent mark, the landing's own (landing/src/assets/images). */
.brand {
    flex: none;
    display: block;
    line-height: 0;
    border-radius: 50%;
}

.brand img { width: 32px; height: 32px; }

.mode {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.icon-button {
    flex: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.icon-button svg { width: 20px; height: 20px; fill: #344054; }
.icon-button:hover, .icon-button:focus-visible { background: #f2f4f7; }
.icon-button.is-done svg { fill: #1a9850; }

/* --- the status line ------------------------------------------------------ */

/* The status line and the load button share the bottom centre; the map
   shows one of them at a time. */
.status {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100% - 32px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    font-size: 13px;
}

.status[hidden] { display: none; }

.status-spinner {
    display: none;
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.status.is-busy .status-spinner { display: block; }

.status-retry {
    flex: none;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
    .status-spinner { animation-duration: 2.5s; }
}

.load-here {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 10px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
    font: inherit;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.load-here:hover, .load-here:focus-visible { background: #1f252e; }
.load-here[hidden] { display: none; }

/* --- the legend, the bar's second row ------------------------------------- */

.legend { padding: 2px 6px 0; }

/* An ordered scale: one gradient bar, a few values marked under it. Always
   low-to-high left-to-right, like the gradient itself, in RTL pages too. */
.scale { direction: ltr; }

.scale-bar {
    height: 8px;
    border-radius: 4px;
}

.scale-ticks {
    position: relative;
    height: 16px;
    margin-top: 4px;
    color: #475467;
    font-size: 11.5px;
    white-space: nowrap;
}

/* Each tick sits at its value; the two ends stay inside the bar's edges. */
.scale-ticks span {
    position: absolute;
    left: var(--at);
    transform: translateX(-50%);
}

.scale-ticks span:first-child { transform: none; }
.scale-ticks span:last-child { transform: translateX(-100%); }

/* Two values and no order (toll): a key rather than a scale. */
.legend-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12.5px;
}

.legend-keys:first-child { margin-top: 0; }

.legend-keys li { display: flex; align-items: center; gap: 8px; }

.swatch {
    flex: none;
    width: 20px;
    height: 5px;
    border-radius: 3px;
}


.density-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, rgba(0, 102, 204, 0), var(--density));
}

[dir="rtl"] .density-bar {
    background: linear-gradient(to left, rgba(0, 102, 204, 0), var(--density));
}

.density-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

/* --- popups --------------------------------------------------------------- */

.maplibregl-popup-content {
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.popup-title { display: block; margin-bottom: 4px; font-size: 14px; }
.popup p { margin: 0 0 4px; }
.popup a { color: #0b5cad; }

.noscript {
    position: absolute;
    inset: 40% 0 auto;
    text-align: center;
}

/* --- phones: the bar spans the width; the scale keeps only its ends -------- */

@media (max-width: 719px) {
    .bar {
        top: 8px;
        left: 8px;
        width: calc(100% - 16px - 44px);
    }

    .scale-ticks span:not(:first-child):not(:last-child) { display: none; }
}
