/**
 * WeatherMap — premium marine confirmation chrome (Azure dark identity).
 */

.weather-map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: clamp(260px, 34vh, 420px);
    width: 100%;
    align-self: stretch;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.weather-map-wrap.wm-root,
.wm-root {
    position: relative;
    inset: auto;
    width: 100%;
    height: 100%;
    min-height: inherit;
    border-radius: inherit;
    overflow: hidden;
    background: #07111f;
    display: flex;
    flex-direction: column;
}

.wm-root--marine {
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.08);
}

.wm-map,
.wm-map.leaflet-container {
    position: relative !important;
    inset: auto !important;
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    min-height: 240px;
    z-index: 0;
    background: #d7e0ea;
    font: inherit;
}

.wm-map .leaflet-wmWindArrowPane {
    z-index: 650 !important;
}

.wm-map .leaflet-control-zoom {
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    border-radius: 10px !important;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.wm-map .leaflet-control-zoom a {
    background: rgba(15, 23, 42, 0.92) !important;
    color: #e2e8f0 !important;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-bottom-color: rgba(148, 163, 184, 0.18) !important;
}

.wm-map .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.72) !important;
    color: #94a3b8 !important;
    font-size: 0.58rem !important;
    margin: 0 0.4rem 0.35rem 0 !important;
    border-radius: 6px;
    padding: 0.15rem 0.35rem !important;
}

.wm-map img.leaflet-tile,
.leaflet-container img.leaflet-tile {
    mix-blend-mode: normal !important;
    max-width: none !important;
    max-height: none !important;
}

.leaflet-owmWeatherPane,
.wm-map .leaflet-owmWeatherPane {
    z-index: 350 !important;
    pointer-events: none;
}

/* —— Wind / wave field overlays (inside Leaflet map container) —— */
.wm-map .wm-wind-shade,
.wm-map .wm-wave-shade,
.wm-wind-shade,
.wm-wave-shade {
    position: absolute;
    inset: 0;
    z-index: 450;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.45s ease;
}

.wm-map .wm-wind-canvas,
.wm-wind-canvas {
    position: absolute;
    inset: 0;
    z-index: 460;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.wm-map .wm-wind-hud,
.wm-map .wm-wave-hud,
.wm-wind-hud,
.wm-wave-hud {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 480;
    pointer-events: none;
    min-width: 7rem;
    max-width: 11rem;
    padding: 0.4rem 0.55rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    color: #e2e8f0;
    font-size: 0.7rem;
    line-height: 1.3;
    letter-spacing: 0.02em;
    transition: transform 0.2s ease-out, opacity 0.25s ease;
}

.wm-wind-hud strong,
.wm-wave-hud strong {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
}

.wm-wind-hud__gust,
.wm-wave-hud span {
    display: block;
    margin-top: 0.15rem;
    color: #94a3b8;
    font-size: 0.66rem;
}

.wm-wave-hud {
    border-color: rgba(34, 211, 238, 0.3);
}

/* —— Leaflet wind arrow markers —— */
.wm-wind-arrow-wrap {
    background: transparent !important;
    border: none !important;
}

.wm-wind-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    color: var(--wm-color, #38bdf8);
    transform: scale(var(--wm-scale, 1));
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.75));
    pointer-events: none;
}

.wm-wind-arrow__glyph {
    width: 28px;
    height: 28px;
    transform: rotate(var(--wm-rot, 0deg));
    transform-origin: 50% 50%;
}

.wm-wind-arrow--hub .wm-wind-arrow__glyph {
    width: 38px;
    height: 38px;
}

.wm-wind-arrow--swell {
    color: #22d3ee;
    filter: drop-shadow(0 1px 3px rgba(8, 47, 73, 0.85));
}

.wm-wind-arrow__label {
    margin-top: 0.12rem;
    padding: 0.14rem 0.4rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #f8fafc;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* —— Chrome / mode switch —— */
.wm-chrome {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    right: 0.7rem;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 0.55rem;
    pointer-events: none;
}

.wm-chrome > * {
    pointer-events: auto;
}

.wm-layer-control {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    margin-left: auto;
}

.wm-mode-switch {
    display: inline-flex;
    padding: 0.18rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(8, 15, 30, 0.88);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
}

.wm-mode-switch--floating {
    position: absolute;
    top: 0.7rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    pointer-events: auto;
}

.wm-mode-switch__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.wm-mode-switch__btn:hover {
    color: #e2e8f0;
}

.wm-mode-switch__btn.is-active {
    background: rgba(56, 189, 248, 0.18);
    color: #f0f9ff;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.wm-layer-control__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    background: rgba(8, 15, 30, 0.9);
    color: #e2e8f0;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.wm-layer-control__btn:hover,
.wm-layer-control--open .wm-layer-control__btn {
    border-color: rgba(56, 189, 248, 0.45);
    color: #f8fafc;
}

.wm-layer-control__icon {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 2px;
    border: 1.5px solid currentColor;
    box-shadow: inset 0 -0.35rem 0 -0.2rem currentColor;
    opacity: 0.85;
}

.wm-layer-control__panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    min-width: min(15.5rem, calc(100vw - 2.5rem));
    max-height: min(16.5rem, 48vh);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.55rem 0.65rem 0.7rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(8, 15, 30, 0.96);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    animation: wm-panel-in 0.18s ease-out;
    z-index: 1200;
}

.wm-layer-control__panel[hidden] {
    display: none !important;
}

@keyframes wm-panel-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wm-layer-control__head {
    margin: 0 0 0.35rem;
    padding: 0 0.15rem 0.4rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
}

.wm-layer-control__group {
    margin: 0.55rem 0 0.2rem;
    padding: 0 0.15rem;
    font-size: 0.6rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #64748b;
}

.wm-layer-control__row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.25rem;
    font-size: 0.82rem;
    color: #e2e8f0;
    cursor: pointer;
    user-select: none;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.wm-layer-control__row:hover {
    background: rgba(56, 189, 248, 0.08);
}

.wm-layer-control__row input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: #38bdf8;
    flex-shrink: 0;
}

/* —— Bottom legends —— */
.wm-legends {
    position: absolute;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.55rem;
    z-index: 900;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    pointer-events: none;
}

.wm-legend {
    padding: 0.45rem 0.55rem 0.4rem;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(8, 15, 30, 0.86);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    transition: border-color 0.25s ease, opacity 0.25s ease;
}

.wm-legends[data-mode="wind"] .wm-legend[data-kind="wind"],
.wm-legends[data-mode="waves"] .wm-legend[data-kind="wave"] {
    border-color: rgba(56, 189, 248, 0.35);
}

.wm-legend__head {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.wm-legend__title {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e2e8f0;
}

.wm-legend__unit {
    font-size: 0.58rem;
    color: #64748b;
    letter-spacing: 0.04em;
}

.wm-legend__value {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #7dd3fc;
}

.wm-legend__track {
    position: relative;
    height: 6px;
    border-radius: 999px;
    overflow: visible;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.wm-legend__marker {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-left: -4.5px;
    border-radius: 50%;
    background: #f8fafc;
    border: 2px solid #0f172a;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.55);
    transform: translateY(-50%);
    transition: left 0.35s ease;
}

.wm-legend__scale {
    display: flex;
    justify-content: space-between;
    margin-top: 0.22rem;
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    color: #64748b;
}

.wm-status {
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 4.6rem;
    z-index: 880;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.35;
    text-align: center;
}

@media (max-width: 720px) {
    /* Compact side-by-side legends — leave map readable */
    .wm-legends {
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem;
        left: 0.4rem;
        right: 0.4rem;
        bottom: 0.4rem;
    }

    .wm-legend {
        padding: 0.28rem 0.4rem 0.25rem;
        border-radius: 8px;
        background: rgba(8, 15, 30, 0.72);
        backdrop-filter: blur(6px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
    }

    .wm-legend__head {
        margin-bottom: 0.15rem;
        gap: 0.2rem;
    }

    .wm-legend__title {
        font-size: 0.55rem;
        letter-spacing: 0.08em;
    }

    .wm-legend__unit {
        font-size: 0.5rem;
    }

    .wm-legend__value {
        font-size: 0.62rem;
    }

    .wm-legend__track {
        height: 4px;
    }

    .wm-legend__marker {
        width: 7px;
        height: 7px;
        margin-left: -3.5px;
    }

    .wm-legend__scale {
        margin-top: 0.12rem;
        font-size: 0.48rem;
    }

    .wm-status {
        bottom: 3.1rem;
        left: 0.45rem;
        right: 0.45rem;
        padding: 0.3rem 0.45rem;
        font-size: 0.65rem;
    }

    .wm-chrome {
        top: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
    }

    .wm-mode-switch__btn {
        padding: 0.38rem 0.7rem;
        font-size: 0.68rem;
    }

    .wm-layer-control {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .wm-layer-control__panel {
        /* Keep all OpenWeather options reachable inside the short mobile map */
        max-height: min(14rem, calc(100dvh - 12rem));
        right: 0;
        left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wm-wind-canvas,
    .wm-wind-shade,
    .wm-wave-shade,
    .wm-mode-switch__btn,
    .wm-legend__marker,
    .wm-layer-control__panel {
        transition: none !important;
        animation: none !important;
    }
}
