/* Special Real Estate: the few effects Tailwind utilities cannot express. */

/* ------------------------------------------------------------------
   Page edges
   No rubber-band bounce above the header or below the footer. The page
   canvas is split light / navy as a fallback for older browsers, so any
   edge that still shows matches the header on top and the footer below.
   ------------------------------------------------------------------ */
html {
    overscroll-behavior: none;
    scroll-behavior: smooth;
    background: linear-gradient(
        to bottom,
        hsl(var(--background)) 0 50%,
        hsl(var(--primary)) 50% 100%
    );
}

body {
    overscroll-behavior: none;
}

/* ------------------------------------------------------------------
   Smooth scrolling (the script takes over the wheel when it runs)
   ------------------------------------------------------------------ */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

[data-lenis-prevent] {
    overscroll-behavior: contain;
}

/* ------------------------------------------------------------------
   Scrollbar in the brand navy
   ------------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: hsl(var(--muted));
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--primary) / 0.85);
    border: 2px solid hsl(var(--muted));
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary));
}

::-webkit-scrollbar-corner {
    background: hsl(var(--muted));
}

@supports not selector(::-webkit-scrollbar) {
    html {
        scrollbar-width: thin;
        scrollbar-color: hsl(var(--primary)) hsl(var(--muted));
    }
}

/* ------------------------------------------------------------------
   No dragging, no accidental selection on controls and images
   ------------------------------------------------------------------ */
img,
a,
svg {
    -webkit-user-drag: none;
}

img {
    -webkit-touch-callout: none;
}

button,
label,
img,
svg,
summary,
header,
nav,
[role='button'],
a.inline-flex {
    -webkit-user-select: none;
    user-select: none;
}

input,
textarea,
select {
    -webkit-user-select: text;
    user-select: text;
}

/* Anything marked hidden stays hidden, even when it also has a display utility */
[hidden] {
    display: none !important;
}

/* Text selection in the brand navy */
::selection {
    background: hsl(var(--primary) / 0.92);
    color: hsl(var(--primary-foreground));
}

/* Fine dot texture taken from the logo background, used on navy surfaces */
.bg-dots {
    background-image: radial-gradient(
        hsl(var(--primary-foreground) / 0.08) 1px,
        transparent 1.3px
    );
    background-size: 14px 14px;
}

/* Header gets a soft shadow once the page scrolls */
[data-site-header].is-scrolled {
    box-shadow: 0 12px 32px -20px hsl(var(--foreground) / 0.4);
}

/* Skyline outline at the bottom of the hero keeps a thin stroke at any width */
.skyline rect,
.skyline line {
    vector-effect: non-scaling-stroke;
}

/* Entrance reveals.
   Content is fully visible by default. The hidden start state only applies
   after the script has armed the observer on the page. */
[data-reveal] {
    transition:
        opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal-armed [data-reveal]:not(.is-visible) {
    opacity: 0;
    transform: translateY(24px);
}

/* Horizontal photo strip without a visible scrollbar */
.no-scrollbar {
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ------------------------------------------------------------------
   Form fields: no browser spinners or clear buttons
   ------------------------------------------------------------------ */
input[type='number'] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-decoration {
    -webkit-appearance: none;
}

/* ------------------------------------------------------------------
   Property explorer: filters, list and map
   ------------------------------------------------------------------ */
.filters-panel {
    display: none;
}

.filters-panel.is-open {
    display: block;
}

.explorer-map-pane {
    display: none;
}

.explorer.is-map .explorer-map-pane {
    display: block;
}

.explorer.is-map .explorer-list-pane {
    display: none;
}

.explorer .explorer-map {
    position: relative;
    height: calc(100svh - var(--explorer-top, 12rem) - 2.5rem);
    min-height: 22rem;
}

@media (min-width: 1024px) {
    .explorer-map-pane,
    .explorer.is-map .explorer-list-pane {
        display: block;
    }

    /* On large screens the extra filters sit in the same row as the search box */
    .filters-panel,
    .filters-panel.is-open {
        display: contents;
    }

    .explorer .explorer-map {
        position: sticky;
        top: calc(var(--explorer-top, 13rem) + 2rem);
        height: calc(100vh - var(--explorer-top, 13rem) - 4rem);
        min-height: 26rem;
    }
}

/* Floating list / map switch on phones */
.view-toggle {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 1.25rem);
    transition:
        opacity 0.3s ease,
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.2s ease;
}

.view-toggle.is-shown {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.view-toggle:hover {
    background-color: hsl(var(--primary) / 0.92);
}

/* ------------------------------------------------------------------
   Map in the site colours
   ------------------------------------------------------------------ */
.map-skin.leaflet-container {
    font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
    background: hsl(var(--muted));
    outline-offset: -2px;
}

/* Softer, calmer map colours so the price pins stand out */
.map-skin .leaflet-tile-pane {
    filter: saturate(0.55) contrast(0.95) brightness(1.03);
}

.map-skin .leaflet-control-zoom {
    border: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 24px -12px hsl(var(--foreground) / 0.45);
}

.map-skin .leaflet-control-zoom a {
    width: 38px;
    height: 38px;
    line-height: 36px;
    font-size: 20px;
    font-weight: 400;
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
}

.map-skin .leaflet-control-zoom a:last-child {
    border-bottom: 0;
}

.map-skin .leaflet-control-zoom a:hover {
    background: hsl(var(--muted));
}

.map-skin .leaflet-control-zoom a:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: -2px;
}

.map-skin .leaflet-control-zoom a.leaflet-disabled {
    color: hsl(var(--muted-foreground) / 0.5);
    background: hsl(var(--card));
}

.map-skin .leaflet-control-attribution {
    padding: 2px 8px;
    font-size: 10px;
    color: hsl(var(--muted-foreground));
    background: hsl(var(--card) / 0.85);
    border-top-left-radius: var(--radius);
}

.map-skin .leaflet-control-attribution a {
    color: inherit;
}

/* Price pins */
.map-pin-wrap,
.map-cluster-wrap {
    background: none;
    border: 0;
}

.map-pin-wrap:focus,
.map-cluster-wrap:focus {
    outline: none;
}

.map-pin {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 7px 11px;
    border-radius: 999px;
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    box-shadow:
        0 0 0 1px hsl(var(--foreground) / 0.1),
        0 6px 16px -6px hsl(var(--foreground) / 0.45);
    transform: translate(-50%, -50%);
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.map-pin:hover,
.map-pin.is-active,
.map-pin-wrap:focus-visible .map-pin {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    transform: translate(-50%, -50%) scale(1.08);
}

.map-pin-wrap:focus-visible .map-pin {
    box-shadow: 0 0 0 3px hsl(var(--accent));
}

/* Groups of nearby properties */
.map-cluster {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    font-size: 14px;
    font-weight: 700;
    box-shadow:
        0 0 0 6px hsl(var(--primary) / 0.2),
        0 10px 22px -8px hsl(var(--foreground) / 0.55);
    transform: translate(-50%, -50%);
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.map-cluster:hover,
.map-cluster.is-active,
.map-cluster-wrap:focus-visible .map-cluster {
    background: hsl(var(--accent));
    color: hsl(var(--foreground));
    transform: translate(-50%, -50%) scale(1.08);
}

/* Single property marker on the property page */
.map-home {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow:
        0 0 0 10px hsl(var(--primary) / 0.18),
        0 12px 26px -10px hsl(var(--foreground) / 0.6);
    transform: translate(-50%, -50%);
}

/* Property card that opens from a pin */
.map-skin .leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: calc(var(--radius) + 6px);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow:
        0 1px 2px hsl(var(--foreground) / 0.06),
        0 22px 44px -16px hsl(var(--foreground) / 0.5);
}

.map-skin .leaflet-popup-content {
    width: 264px !important;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.map-skin .leaflet-popup-content p {
    margin: 0;
}

.map-skin .leaflet-popup-content a {
    color: inherit;
}

.map-skin .leaflet-popup-tip {
    background: hsl(var(--card));
    box-shadow: none;
}

.map-skin .leaflet-popup-close-button {
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    font: 400 20px/1 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
    color: hsl(var(--foreground));
    background: hsl(var(--card) / 0.94);
    box-shadow: 0 4px 12px -4px hsl(var(--foreground) / 0.45);
}

.map-skin .leaflet-popup-close-button:hover,
.map-skin .leaflet-popup-close-button:focus-visible {
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--primary));
}

/* ------------------------------------------------------------------
   Google Maps: price pins and the property card in the site design
   ------------------------------------------------------------------ */
.gmap-skin {
    background: hsl(var(--muted));
}

.gmap-skin .gm-style {
    font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
}

.gmap-marker {
    position: absolute;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
}

.gmap-marker:focus {
    outline: none;
}

.gmap-card {
    position: absolute;
    width: 0;
    height: 0;
}

/* Small arrow under the card, pointing at the pin */
.gmap-card::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 21px;
    width: 12px;
    height: 12px;
    background: hsl(var(--card));
    transform: translateX(-50%) rotate(45deg);
}

.gmap-card-box {
    position: absolute;
    left: 0;
    bottom: 26px;
    z-index: 1;
    width: 264px;
    overflow: hidden;
    border-radius: calc(var(--radius) + 6px);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-family: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    cursor: default;
    box-shadow:
        0 1px 2px hsl(var(--foreground) / 0.06),
        0 22px 44px -16px hsl(var(--foreground) / 0.5);
    transform: translateX(-50%);
    animation: gmap-card-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.gmap-card-box a {
    color: inherit;
    text-decoration: none;
}

.gmap-card-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    color: hsl(var(--foreground));
    background: hsl(var(--card) / 0.94);
    box-shadow: 0 4px 12px -4px hsl(var(--foreground) / 0.45);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.gmap-card-close:hover,
.gmap-card-close:focus-visible {
    background: hsl(var(--card));
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--primary));
}

@keyframes gmap-card-in {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .view-toggle,
    .map-pin,
    .map-cluster {
        transition: none;
    }

    .gmap-card-box {
        animation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    [data-reveal] {
        transition: none;
    }

    .reveal-armed [data-reveal]:not(.is-visible) {
        opacity: 1;
        transform: none;
    }
}
