:root {
    color-scheme: light;
    --ink: #1c2530;
    --muted: #667180;
    --surface: #fff;
    --accent: #1f6feb;
    --radius: 12px;
    --gutter: 12px;
    --shadow: 0 1px 2px rgb(0 0 0 / .14), 0 4px 14px rgb(0 0 0 / .18);
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
}

#map {
    position: fixed;
    inset: 0;
    background: #dde2e8;
}

.leaflet-container {
    font-family: inherit;
}

/* The orthophoto is softened so the dots and the parcel outline read on top of it. */
.ortho {
    filter: saturate(.55) brightness(1.08) contrast(.95);
}

/* Links in running text are underlined, not told apart by colour alone. */
.leaflet-control-attribution a {
    text-decoration: underline;
}

.leaflet-bar, .leaflet-touch .leaflet-bar {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.bar {
    position: fixed;
    z-index: 1000;
    top: var(--gutter);
    left: var(--gutter);
    width: min(380px, calc(100vw - 2 * var(--gutter)));
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#search-form {
    margin: 0;
}

#controls {
    display: flex;
    gap: 8px;
}

#search {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    outline: none;
}

#search::placeholder {
    color: var(--muted);
}

#search:focus-visible {
    border-color: var(--accent);
    box-shadow: var(--shadow), 0 0 0 3px rgb(31 111 235 / .25);
}

#search:disabled {
    background: #f1f3f5;
    cursor: progress;
}

/* Shown instead of the search box when JavaScript is off. */
.notice {
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Blazor shows this element after an unhandled exception. */
#blazor-error-ui {
    display: none;
    position: fixed;
    z-index: 2000;
    left: var(--gutter);
    right: var(--gutter);
    bottom: var(--gutter);
    padding: 10px 44px 10px 14px;
    color: #8a1c1c;
    background: #fff4f4;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#blazor-error-ui .reload {
    color: inherit;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: 4px;
    right: 8px;
    padding: 4px 8px;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

/* ---- The page over the map (App.razor and Components/) ---------------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* The radius and period chips under the search box: static in index.html, labelled by their visible text. */
.choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 4px 0 12px;
    font-size: 14px;
    color: var(--muted);
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.choice:focus-within {
    box-shadow: var(--shadow), 0 0 0 2px var(--accent);
}

.choice select {
    height: 100%;
    padding: 0 26px 0 2px;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23667180' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 0;
    appearance: none;
    cursor: pointer;
}

.choice select:focus-visible {
    outline: none;
}

.choice select:disabled {
    color: var(--muted);
    cursor: progress;
}

.panel {
    color: var(--ink);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.muted {
    color: var(--muted);
}

.hint {
    position: fixed;
    z-index: 900;
    left: 50%;
    bottom: 64px;
    margin: 0;
    padding: 10px 18px;
    font-size: 15px;
    color: var(--ink);
    white-space: nowrap;
    background: rgb(255 255 255 / .94);
    border-radius: 999px;
    box-shadow: var(--shadow);
    transform: translateX(-50%);
    pointer-events: none;
}

/* The geocoder's matches, dropped under the search box over the chips. */
.candidates {
    position: fixed;
    z-index: 1100;
    top: calc(var(--gutter) + 52px);
    left: var(--gutter);
    width: min(380px, calc(100vw - 2 * var(--gutter)));
    max-height: min(60vh, 420px);
    overflow: auto;
    padding: 6px;
    box-sizing: border-box;
}

.candidates-note {
    margin: 4px 10px 6px;
    font-size: 13px;
    color: var(--muted);
}

.candidates ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.candidates button {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 44px;
    padding: 7px 10px;
    font: inherit;
    text-align: left;
    color: inherit;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.candidates button:hover, .candidates button:focus-visible {
    background: #eef3fb;
}

.candidates button:focus-visible {
    outline-offset: -2px;
}

.candidate-sub {
    font-size: 13px;
    color: var(--muted);
}

/* The price card: bottom right on a desktop, above the map's attribution line. */
.card {
    position: fixed;
    z-index: 1000;
    right: var(--gutter);
    bottom: 30px;
    width: 360px;
    max-height: calc(100vh - 30px - 2 * var(--gutter) - 90px);
    overflow: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    padding: 14px 16px 12px 18px;
    font-size: 14px;
}

.card p {
    margin: 0 0 6px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.card-title {
    min-width: 0;
}

.card h2 {
    margin: 2px 0;
    font-size: 17px;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.card-head .icon {
    margin: -6px -8px 0 0;
}

.card-body {
    margin-top: 10px;
}

.card .lead {
    font-size: 15px;
}

.figure {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.figure strong {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.15;
}

.note {
    color: #7a4b00;
}

.parcel {
    overflow-wrap: anywhere;
}

/* An indeterminate line along the top edge of the card while a search runs. */
.progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.busy .progress::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background: var(--accent);
    animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
    from { left: -40%; }
    to { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .busy .progress::after {
        left: 0;
        width: 100%;
        opacity: .5;
        animation: none;
    }
}

button.icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    font: inherit;
    font-size: 20px;
    line-height: 1;
    color: var(--ink);
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

button.icon:hover:not(:disabled) {
    background: #f1f3f5;
}

button.icon:disabled {
    color: #b4bcc6;
    cursor: default;
}

.button {
    height: 40px;
    margin-top: 4px;
    padding: 0 18px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.button:hover {
    background: #1a5fcc;
}

button.link {
    padding: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

.legend {
    margin: 10px 0;
}

.legend figcaption {
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--muted);
}

.legend ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    vertical-align: -1px;
    background: var(--swatch);
    border: 1.5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgb(0 0 0 / .18);
}

.swatch.hollow {
    background: #fff;
    border-color: var(--swatch);
    box-shadow: none;
}

/* The sales at one dot, inside the card. */
.sales {
    margin: 10px -16px 10px -18px;
    padding: 8px 16px 4px 18px;
    background: #f6f8fa;
    border-block: 1px solid #e6e9ee;
}

.sales-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.sales h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
}

.sales-nav {
    display: flex;
    align-items: center;
    margin-right: -8px;
    font-size: 13px;
    white-space: nowrap;
}

.sales ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sale {
    padding: 8px 0;
    border-top: 1px solid #e6e9ee;
}

.sale:first-child {
    border-top: 0;
}

.sale-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.sale-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
}

.sale-price strong {
    font-size: 15px;
}

.sale.excluded .sale-price {
    color: var(--muted);
}

.footer {
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
}

.footer a {
    color: inherit;
}

.card .footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e6e9ee;
}

.footer.floating {
    position: fixed;
    z-index: 900;
    left: var(--gutter);
    bottom: 8px;
    max-width: 520px;
    padding: 6px 10px;
    background: rgb(255 255 255 / .9);
    border-radius: 8px;
}

/* A phone: the card docks to the bottom edge (above the attribution line) and scrolls inside; two fingers zoom the map. */
@media (max-width: 640px) {
    .leaflet-control-zoom {
        display: none;
    }

    .card {
        left: 8px;
        right: 8px;
        bottom: 22px;
        width: auto;
        max-height: 45vh;
        padding: 12px 14px 10px 16px;
    }

    .sales {
        margin-inline: -14px;
        padding-inline: 16px 14px;
    }

    .hint {
        bottom: 104px;
    }

    .footer.floating {
        right: var(--gutter);
        bottom: 24px;
        max-width: none;
    }
}

/* Forced colours (Windows High Contrast) drop box-shadows and force border colours, so the search box and the two chips, which show focus by a
   shadow only, would show none. Every other control keeps the outline of the :focus-visible rule above; these two get one back. */
@media (forced-colors: active) {
    #search:focus-visible,
    .choice:focus-within {
        outline: 2px solid CanvasText;
        outline-offset: 2px;
    }
}
