/* MetroBites — interactive metro route map (pairs with /assets/js/metro-map.js). */

.metro-map-toggle { gap: 5px; }
.metro-map-toggle .mm-toggle-ico {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.metro-map-toggle.is-active {
    border-color: #d94b1f;
    background: #d94b1f;
    color: #fff;
}
.finder-field .step-row--city { margin-bottom: 12px; }

.metro-map-panel {
    margin-top: 18px;
    padding: 22px;
    border: 1.5px solid #ddd8d3;
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--mb-shadow, 0 8px 22px rgba(35, 30, 27, .035));
    animation: mm-in .22s ease-out;
}
.metro-map-panel[hidden] { display: none !important; }
@keyframes mm-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.mm-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.mm-head .step-kicker { display: block; }
.mm-title {
    margin: 0;
    color: #34302d;
    font-size: 17px;
    line-height: 1.35;
    font-weight: 900;
}
.mm-close {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e7e3df;
    border-radius: 10px;
    background: #fff;
    color: #45413e;
    cursor: pointer;
}
.mm-close svg, .mm-zoom svg, .mm-pop-x svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mm-close:hover { background: #f7f6f4; }

/* Legend chips (view-only line filter) */
.mm-legend {
    display: flex;
    gap: 7px;
    margin: 0 0 12px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.mm-chip {
    --c: #34302d;
    --fg: #fff;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 11px 0 5px;
    border: 1.5px solid #e7e3df;
    border-radius: 999px;
    background: #fff;
    color: #34302d;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.mm-chip--all { padding: 0 13px; }
.mm-chip-code {
    min-width: 26px;
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--c);
    color: var(--fg);
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
}
.mm-chip:hover { border-color: var(--c); }
.mm-chip.is-active {
    border-color: var(--c);
    background: var(--c);
    color: var(--fg);
}
.mm-chip.is-active .mm-chip-code { background: rgba(255, 255, 255, .25); color: var(--fg); }

/* Map stage */
.mm-stage {
    position: relative;
    height: clamp(440px, 70vh, 780px);
    overflow: hidden;
    border: 1px solid #eeeae6;
    border-radius: 12px;
    background: #fbfaf8;
}
.mm-svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    font-family: inherit;
}
.mm-svg.is-dragging { cursor: grabbing; }
.mm-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #77716d;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
}
.mm-status[hidden] { display: none; }

/* Lines */
.mm-casing {
    fill: none;
    stroke: #fbfaf8;
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mm-casing--lrt { stroke-width: 9; }
.mm-path {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.mm-line--lrt .mm-path { stroke-width: 4.5; }
.mm-line--gondola .mm-path {
    stroke-width: 5;
    stroke-dasharray: .1 9;
}
.mm-transfer {
    stroke: #8f8782;
    stroke-width: 2.4;
    stroke-dasharray: 2 4;
    stroke-linecap: round;
}
.mm-note {
    fill: #8f8782;
    font-size: 11px;
    font-weight: 800;
}

/* Stations */
.mm-st { cursor: pointer; outline: none; }
.mm-hit { fill: transparent; }
.mm-ring { fill: none; stroke: transparent; stroke-width: 3; }
.mm-dot {
    fill: #fff;
    stroke-width: 3;
    transition: r .15s;
}
.mm-dot--ix {
    fill: #fff;
    stroke: #2b2724;
    stroke-width: 2.6;
}
.mm-lbl {
    paint-order: stroke;
    stroke: #fbfaf8;
    stroke-width: 3.4;
    stroke-linejoin: round;
}
.mm-lbl .mm-p { fill: #2b2724; font-size: 13px; font-weight: 800; }
.mm-lbl .mm-p--latin { font-size: 11px; }
.mm-lbl .mm-s { fill: #6f6863; font-size: 9.6px; font-weight: 650; }

.mm-st:hover .mm-ring,
.mm-st:focus-visible .mm-ring,
.mm-st.is-picked .mm-ring { stroke: #ff5722; }
.mm-st.is-picked .mm-lbl .mm-p { fill: #d94b1f; }
.mm-st.is-current .mm-ring {
    stroke: #ff5722;
    stroke-width: 3.5;
    animation: mm-pulse 1.6s ease-in-out infinite;
}
@keyframes mm-pulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: .25; }
}

/* Focus a single line: dim everything else */
.mm-line, .mm-casing, .mm-st, .mm-transfer { transition: opacity .2s; }
.mm-svg.has-focus .mm-line:not(.is-focus),
.mm-svg.has-focus .mm-casing:not(.is-focus) { opacity: .12; }
.mm-svg.has-focus .mm-st:not(.is-on) { opacity: .2; }
.mm-svg.has-focus .mm-transfer:not(.is-on) { opacity: .15; }
.mm-svg.has-focus .mm-line.is-focus .mm-path { stroke-width: 9; }
.mm-svg.has-focus .mm-line--lrt.is-focus .mm-path { stroke-width: 6; }

/* Zoom controls */
.mm-zoom {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mm-zoom button {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e7e3df;
    border-radius: 10px;
    background: #fff;
    color: #34302d;
    box-shadow: 0 4px 12px rgba(35, 30, 27, .08);
    cursor: pointer;
}
.mm-zoom button:hover { background: #f7f6f4; }

/* Station popover */
.mm-pop {
    position: absolute;
    z-index: 5;
    width: 236px;
    padding: 14px 14px 13px;
    border: 1px solid #e7e3df;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(35, 30, 27, .16);
    color: #34302d;
}
.mm-pop[hidden] { display: none; }
.mm-pop-x {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #77716d;
    cursor: pointer;
}
.mm-pop-x:hover { background: #f7f6f4; }
.mm-pop-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 30px 8px 0; }
.mm-badge {
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--c);
    color: var(--fg);
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1.2;
}
.mm-pop-name { display: block; padding-right: 26px; font-size: 16px; line-height: 1.3; font-weight: 900; }
.mm-pop-sub { display: block; margin-top: 1px; color: #77716d; font-size: 12px; font-weight: 700; }
.mm-pop-lines { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; }
.mm-pop-line {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #5f5853;
    font-size: 11.5px;
    font-weight: 700;
}
.mm-pop-line::before {
    content: "";
    width: 12px;
    height: 4px;
    border-radius: 2px;
    background: var(--c);
}
.mm-pop-current { display: block; margin-top: 8px; color: #d94b1f; font-size: 11.5px; font-weight: 800; }
.mm-pop-go {
    width: 100%;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    border: 0;
    border-radius: 10px;
    background: #ff5722;
    color: #fff;
    font: inherit;
    font-size: 13.5px;
    font-weight: 900;
    cursor: pointer;
}
.mm-pop-go:hover { background: #e94a17; }
.mm-pop-none {
    margin: 12px 0 0;
    padding: 9px 10px;
    border-radius: 10px;
    background: #f7f6f4;
    color: #77716d;
    font-size: 12px;
    font-weight: 700;
}

.mm-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    margin: 10px 0 0;
    color: #a09a96;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
}
.mm-hint { transition: color .2s; }
.mm-hint.is-flash { color: #d94b1f; font-weight: 800; }

/* Phones: full-screen sheet */
@media (max-width: 767px) {
    .metro-map-panel.is-open {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 14px 12px calc(10px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .metro-map-panel.is-open .mm-viewer-host { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
    .metro-map-panel.is-open .mm-stage { flex: 1 1 auto; height: auto; min-height: 0; }
    .mm-title { font-size: 15px; }
    .mm-legend { margin-left: -12px; margin-right: -12px; padding: 0 12px 2px; scrollbar-width: none; }
    .mm-legend::-webkit-scrollbar { display: none; }
    .mm-disclaimer { display: none; }
    .mm-pop { width: min(236px, calc(100% - 16px)); }
}
html.mm-lock, html.mm-lock body { overflow: hidden !important; }

/* Emphasised lines (store page: the station's own line), others stay fully visible */
.mm-line.is-emph .mm-path { stroke-width: 9.5; }
.mm-line--lrt.is-emph .mm-path { stroke-width: 6; }

/* Static snapshot (store page preview card) */
.mm-snapshot { cursor: inherit; pointer-events: none; touch-action: auto; }
.mm-snapshot.has-focus .mm-line:not(.is-focus),
.mm-snapshot.has-focus .mm-casing:not(.is-focus) { opacity: .38; }
.mm-snapshot.has-focus .mm-st:not(.is-on) { opacity: .5; }

@media (prefers-reduced-motion: reduce) {
    .metro-map-panel, .mm-st.is-current .mm-ring { animation: none; }
    .mm-line, .mm-casing, .mm-st, .mm-transfer, .mm-chip { transition: none; }
}

/* ===== Store page (store.php "GETTING THERE") — enhances the existing card + modal ===== */
.metro-system-map-preview.is-enhanced .metro-system-map-thumb {
    position: relative;
    display: block;
    padding: 0;
    background: #fbfaf8;
}
.mm-thumb-box { position: absolute; inset: 0; display: block; }
.mm-thumb-box .mm-svg { width: 100%; height: 100%; }

.metro-system-map-scroll.mm-store-host {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 14px 12px;
    overflow: hidden;
    background: #fff;
}
.mm-store-host .mm-legend { flex: 0 0 auto; }
.mm-store-host .mm-stage { flex: 1 1 auto; height: auto; min-height: 0; }
.metro-system-map-modal.mm-enhanced .mm-modal-hint { color: #a09a96; font-weight: 600; }

@media (max-width: 760px) {
    .metro-system-map-preview.is-enhanced { grid-template-columns: minmax(0, 1fr); }
    .metro-system-map-preview.is-enhanced .metro-system-map-thumb {
        height: 150px;
        border-left: 0;
        border-right: 0;
        border-top: 1px solid #eceff2;
    }
    .metro-system-map-scroll.mm-store-host { padding: 10px 10px 8px; }
    .mm-store-host .mm-legend { margin-left: -10px; margin-right: -10px; padding: 0 10px 2px; }
}
.mm-thumb-note {
    position: absolute;
    left: 10px;
    bottom: 9px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px 4px 8px;
    border-radius: 999px;
    background: #ff5722;
    color: #fff;
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1.2;
    box-shadow: 0 3px 10px rgba(255, 87, 34, .28);
    pointer-events: none;
}
.mm-thumb-note::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
}

/* ===== Fare mode (cities whose map JSON names a "fares" file) ===== */
.mm-head { align-items: center; }
.mm-fare-toggle {
    margin-left: auto;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid #ffd8c9;
    border-radius: 999px;
    background: #fff4ef;
    color: #d94b1f;
    font: inherit;
    font-size: 12.5px;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}
.mm-fare-toggle[hidden] { display: none; }
.mm-fare-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.mm-fare-toggle.is-active { border-color: #d94b1f; background: #d94b1f; color: #fff; }

.mm-fare-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 4;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 999px;
    background: #2b2724;
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(35, 30, 27, .18);
    pointer-events: none;
}
.mm-fare-hint[hidden] { display: none; }

.mm-st.is-origin .mm-ring { stroke: #ff5722; stroke-width: 4.5; }
.mm-st.is-origin .mm-dot { fill: #ff5722; stroke: #fff; }
.mm-st.is-origin .mm-lbl .mm-p { fill: #d94b1f; }

.mm-fare {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    width: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e7e3df;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(35, 30, 27, .16);
}
.mm-fare[hidden] { display: none; }
.mm-stage:has(.mm-fare:not([hidden])) .mm-zoom { right: 364px; }
.mm-fare-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 10px 14px;
    border-bottom: 1px solid #eeeae6;
}
.mm-fare-label { display: block; color: #d94b1f; font-size: 10.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.mm-fare-head strong { display: block; font-size: 16px; line-height: 1.25; font-weight: 900; color: #2b2724; }
.mm-fare-head small { display: block; color: #77716d; font-size: 11.5px; font-weight: 700; }
.mm-fare-x {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #77716d;
    cursor: pointer;
}
.mm-fare-x:hover { background: #f7f6f4; }
.mm-fare-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.mm-fare-head, .mm-fare-tabs { flex: 0 0 auto; }
.mm-fare-tabs { display: flex; gap: 6px; padding: 8px 12px 2px; overflow-x: auto; scrollbar-width: none; }
.mm-fare-tab {
    flex: 0 0 auto;
    padding: 5px 10px;
    border: 1.5px solid var(--c);
    border-radius: 999px;
    background: #fff;
    color: #34302d;
    font: inherit;
    font-size: 11.5px;
    font-weight: 850;
    cursor: pointer;
}
.mm-fare-tab.is-active { background: var(--c); color: var(--fg); }
.mm-fare-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 0 8px; overscroll-behavior: contain; }
.mm-fare-dir {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 14px 6px;
    background: #fbfaf8;
    color: #77716d;
    font-size: 11.5px;
    font-weight: 900;
}
.mm-fare-row {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 0;
    border-bottom: 1px solid #f3f0ed;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.mm-fare-row:hover { background: #fffaf7; }
.mm-fare-row.is-active { background: #fff4ef; box-shadow: inset 3px 0 0 #ff5722; }
.mm-fare-code .mm-badge { display: inline-block; min-width: 40px; text-align: center; }
.mm-fare-name { min-width: 0; }
.mm-fare-name b, .mm-fare-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-fare-name b { font-size: 13px; font-weight: 850; color: #2b2724; }
.mm-fare-name small { font-size: 11px; font-weight: 650; color: #8a837e; }
.mm-fare-val { text-align: right; white-space: nowrap; }
.mm-fare-val b { display: block; font-size: 15px; font-weight: 900; color: #d94b1f; }
.mm-fare-val small { display: block; font-size: 10.5px; font-weight: 700; color: #8a837e; }
.mm-fare-note, .mm-fare-empty { margin: 10px 14px 4px; color: #a09a96; font-size: 11px; font-weight: 600; line-height: 1.55; }
.mm-fare-note b { color: #8a5a3c; }

@media (max-width: 767px) {
    .mm-fare-toggle span { display: none; }
    .mm-fare-toggle { padding: 0 10px; }
    .mm-fare { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 55%; border-radius: 16px 16px 0 0; }
    .mm-stage:has(.mm-fare:not([hidden])) .mm-zoom { right: 12px; bottom: calc(55% + 12px); }
    .mm-fare-hint { white-space: normal; max-width: calc(100% - 24px); text-align: center; }
}

/* Fare mode: origin → destination stretch stays lit; the rest of its line dims like the other lines */
.mm-svg.has-segment .mm-line.is-focus,
.mm-svg.has-segment .mm-casing.is-focus { opacity: .12; }
.mm-svg.has-segment .mm-st.is-on:not(.is-seg) { opacity: .2; }
.mm-svg.has-segment .mm-transfer { opacity: .15; }
.mm-seg-casing { fill: none; stroke: #fbfaf8; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.mm-seg-path { fill: none; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }

.mm-fare-sum {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    max-width: calc(100% - 380px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 14px;
    border: 1px solid #e7e3df;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(35, 30, 27, .12);
    pointer-events: none;
}
.mm-fare-sum[hidden] { display: none; }
.mm-fare-sum b { color: #2b2724; font-size: 14px; font-weight: 900; line-height: 1.3; }
.mm-fare-sum span { color: #77716d; font-size: 12px; font-weight: 750; }
.mm-fare-sum em { color: #d94b1f; font-size: 15px; font-style: normal; font-weight: 900; }

@media (max-width: 767px) {
    .mm-fare-sum { left: 12px; right: 12px; max-width: none; }
}
