/* ==========================================================
   07-map.css
   Block #62 Ruby Neighborhood Map (rs_map)
   Matches the VEXOS "Location / Explore the surroundings." map.
   Behaviour: js/rs-map.js
   ========================================================== */

.rs-map {
    background: var(--rs-cream-3);
    padding: 6vh 0
}

.rs-map__header {
    text-align: center;
    padding: 0 clamp(20px, 4vw, 72px);
    margin-bottom: 4vh
}

.rs-map .rs-map__title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(34px, 3.5vw, 52px);
    line-height: 1;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--rs-brown)
}

.rs-map .rs-map__subtitle {
    margin-top: 1.6vh;
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--rs-brown-2)
}

/* Map stage */
.rs-map__stage {
    position: relative;
    height: 80vh;
    overflow: hidden;
    background: #ece8e1
}

.rs-map__stage .rs-map__canvas {
    position: absolute;
    inset: 0
}

/* Master-theme link underline must not reach Mapbox or card links */
.rs-map a:not(.button)::after {
    display: none
}

/* Time-of-day slider (day → dusk → night) */
.rs-map__mode {
    --k: clamp(30px, 3.8vh, 40px);
    --p: 0;
    position: absolute;
    top: 2vh;
    left: 16px;
    z-index: 3;
    width: clamp(160px, 14vw, 220px);
    height: calc(var(--k) + 12px);
    border-radius: 100px;
    background: linear-gradient(90deg, #4d9cf0, #a9d4ff);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none
}

.rs-map__mode.is-dragging {
    cursor: grabbing
}

.rs-map__mode:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .8), 0 6px 20px rgba(0, 0, 0, .15)
}

.rs-map__mode-line {
    position: absolute;
    top: 50%;
    left: calc(var(--k) / 2 + 6px);
    right: calc(var(--k) / 2 + 6px);
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .45);
    transform: translateY(-50%);
    pointer-events: none
}

.rs-map__mode-knob {
    position: absolute;
    top: 6px;
    left: calc(6px + (100% - var(--k) - 12px) * var(--p));
    width: var(--k);
    height: var(--k);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    border: 1.5px solid rgba(255, 255, 255, .9);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
    pointer-events: none;
    transition: background .3s, border-color .3s
}

.rs-map__mode-knob svg {
    display: none;
    width: 60%;
    height: 60%;
    fill: none;
    stroke: #fff;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round
}

.rs-map__stage.is-day .rs-map__sun,
.rs-map__stage.is-dusk .rs-map__sunset,
.rs-map__stage.is-night .rs-map__moon {
    display: block
}

.rs-map__stage.is-dusk .rs-map__mode-knob {
    background: #fff;
    border: 2px solid rgba(110, 90, 210, .65)
}

.rs-map__stage.is-dusk .rs-map__mode-knob svg {
    stroke: #2b2f3a
}

.rs-map__stage.is-night .rs-map__mode-knob {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .8)
}

/* Bottom buttons */
.rs-map__bar {
    position: absolute;
    left: 50%;
    bottom: 3vh;
    z-index: 3;
    transform: translateX(-50%);
    display: flex;
    gap: 10px
}

.rs-map__explore {
    position: relative
}

.rs-map .rs-map__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: clamp(40px, 5vh, 50px);
    padding: 0 22px;
    border-radius: 12px;
    background: #fff;
    color: var(--rs-ui-ink);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 400;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .14);
    cursor: pointer;
    transition: background .2s, color .2s
}

.rs-map__btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round
}

.rs-map .rs-map__btn[aria-pressed="true"] {
    background: var(--rs-ui-brand);
    color: #fff
}

/* Explore list (opens upward) */
.rs-map__menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    min-width: 100%;
    width: max-content;
    max-width: 90vw;
    max-height: 50vh;
    overflow-y: auto;
    padding: 1vh 0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s, transform .25s, visibility .25s
}

.rs-map__stage.is-menu-open .rs-map__menu {
    opacity: 1;
    visibility: visible;
    transform: none
}

.rs-map__menu-group {
    padding: 1.2vh 18px .4vh;
    font-family: var(--font-ui);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--rs-brown-3)
}

.rs-map .rs-map__menu button {
    display: block;
    width: 100%;
    padding: .9vh 18px;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.3;
    color: var(--rs-ui-ink);
    cursor: pointer
}

.rs-map .rs-map__menu button:hover {
    background: var(--rs-cream-2)
}

/* Pins */
.rs-map .rs-map__pin {
    --s: clamp(28px, 3.4vh, 36px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--s);
    height: var(--s);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer
}

.rs-map__pin::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: #161616;
    border: 1.5px solid rgba(255, 255, 255, .85);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
    transition: box-shadow .3s
}

.rs-map__pin svg {
    position: relative;
    z-index: 1;
    width: 58%;
    height: 58%;
    fill: none;
    stroke: #fff;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round
}

.rs-map__pin.is-active::before {
    box-shadow: 0 0 0 4px rgba(98, 214, 90, .65), 0 0 0 10px rgba(98, 214, 90, .25)
}

.mapboxgl-marker:has(.is-active) {
    z-index: 2
}

/* Ruby Station pin */
.rs-map .rs-map__pin--main {
    --s: clamp(40px, 5vh, 52px)
}

.rs-map__pin--main::before {
    border-radius: 50%;
    transform: none;
    background: var(--rs-cream-3);
    border: 2px solid var(--rs-ui-brand);
    box-shadow: 0 0 0 6px rgba(141, 101, 97, .25), 0 0 18px rgba(180, 60, 60, .55)
}

.rs-map__pin-r {
    position: relative;
    z-index: 1;
    font-family: var(--font-serif);
    font-size: clamp(22px, 3vh, 30px);
    line-height: 1;
    color: var(--rs-ui-brand)
}

/* Place card */
.rs-map__card {
    position: absolute;
    top: 50%;
    right: 2vw;
    z-index: 4;
    width: clamp(300px, 24vw, 380px);
    max-height: calc(100% - 4vh);
    overflow-y: auto;
    padding: 4.5vh 22px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
    font-family: var(--font-ui);
    opacity: 0;
    visibility: hidden;
    transform: translate(16px, -50%);
    transition: opacity .3s, transform .3s, visibility .3s
}

.rs-map__card.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%)
}

.rs-map .rs-map__card-close {
    position: absolute;
    top: 1.4vh;
    right: 16px;
    font-size: 26px;
    line-height: 1;
    color: var(--rs-ui-ink);
    cursor: pointer
}

.rs-map__card-img {
    width: 100%;
    height: 20vh;
    object-fit: cover;
    border-radius: 12px
}

.rs-map .rs-map__card-title {
    margin-top: 2vh;
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--rs-ui-ink)
}

.rs-map .rs-map__card-desc {
    margin-top: 1vh;
    font-size: 15px;
    line-height: 1.4;
    color: #555
}

.rs-map__times {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 2vh
}

.rs-map__card.is-main .rs-map__times {
    display: none
}

.rs-map__time {
    padding: 1.2vh 6px;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    text-align: center
}

.rs-map__time-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #444
}

.rs-map__time-label svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round
}

.rs-map__time strong {
    display: block;
    margin-top: .6vh;
    font-size: 15px;
    font-weight: 600;
    color: var(--rs-ui-ink)
}

.rs-map .rs-map__gmaps {
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(40px, 5vh, 50px);
    margin-top: 2vh;
    border-radius: 12px;
    background: var(--rs-ui-brand);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, .3), 0 3px 8px rgba(0, 0, 0, .2);
    transition: background .2s
}

.rs-map .rs-map__gmaps:hover {
    background: var(--rs-ui-brand-dark);
    color: #fff
}

/* Mobile */
@media screen and (max-width:600px) {
    .rs-map__stage {
        height: 75vh
    }

    .rs-map__bar {
        left: 12px;
        right: 12px;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px
    }

    .rs-map .rs-map__btn {
        height: clamp(36px, 4.5vh, 44px);
        padding: 0 12px;
        font-size: 13px
    }

    .rs-map__card {
        top: auto;
        right: 12px;
        bottom: 2vh;
        left: 12px;
        width: auto;
        max-height: 62%;
        padding: 4vh 16px 16px;
        transform: translateY(16px)
    }

    .rs-map__card.is-open {
        transform: none
    }

    .rs-map__card-img {
        height: 16vh
    }
}
