/* howfar.nyc */


/* --- Reset & Base --- */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
    font-size: 12px;
    color: #000000;
}

#app {
    height: 100%;
    width: 100%;
}


/* --- Loading Screen --- */

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #008080;
    position: relative;
    overflow: hidden;
}

.loading-screen h1 {
    font-size: 1.5rem;
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
}

.loading-screen p {
    color: #ffffff;
}

.loading-bike {
    width: 150px;
    height: 95px;
    animation: bob-bike 0.5s ease-in-out infinite alternate;
}

.loading-bike svg {
    width: 100%;
    height: 100%;
}

.loading-rear-wheel {
    transform-origin: 30px 68px;
    animation: loading-wheel-spin 1s linear infinite;
}

.loading-front-wheel {
    transform-origin: 72.5px 68px;
    animation: loading-wheel-spin 1s linear infinite;
}

.loading-road-wrapper {
    width: 200px;
    height: 4px;
    overflow: hidden;
    margin-top: -4px;
}

.loading-road {
    width: 200%;
    height: 0;
    border-top: 3px dashed rgba(255,255,255,0.6);
    animation: scroll-road 1s linear infinite;
}

.loading-cloud {
    position: absolute;
    left: 0;
}

.loading-cloud-1 {
    width: 60px;
    top: 15%;
    animation: drift-cloud 8s linear infinite;
}

.loading-cloud-2 {
    width: 80px;
    top: 25%;
    animation: drift-cloud 12s linear infinite;
    animation-delay: -4s;
}

.loading-cloud-3 {
    width: 100px;
    top: 10%;
    animation: drift-cloud 15s linear infinite;
    animation-delay: -7s;
}

@keyframes bob-bike {
    from { transform: translateY(-2px); }
    to { transform: translateY(2px); }
}

@keyframes loading-wheel-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes scroll-road {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes drift-cloud {
    from { transform: translateX(100vw); }
    to { transform: translateX(-200px); }
}


/* --- Layout --- */

.app-container {
    position: relative;
    height: 100%;
    width: 100%;
}

.map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#map {
    height: 100%;
    width: 100%;
}

/* Overlay Container */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1001;
}

.overlay-container > * {
    pointer-events: auto;
}


/* --- Mode Selector --- */

.mode-selector {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    background: #EBEBEB;
    border: 2px outset #ebebeb;
    overflow: hidden;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border: 2px outset #ebebeb;
    background: #EBEBEB;
    cursor: pointer;
    border-right: 1px solid #b0b0b0;
    transition: background-color 0.2s;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
    font-size: 11px;
}

.mode-icon {
    width: 28px;
    height: 28px;
}

.mode-plus {
    font-size: 12px;
    font-weight: 600;
    color: #000000;
    line-height: 1;
}

.mode-tab:last-child {
    border-right: none;
}

.mode-tab:hover:not(.active) {
    background: #f5f5f5;
}

.mode-tab.active {
    background: #6fbf73;
    color: #000000;
    border-style: inset;
}

.mode-tab-stack {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    border-right: 1px solid #b0b0b0;
}

.mode-tab-stack .mode-tab {
    flex: 1;
    padding: 2px 6px;
    border-right: none;
    justify-content: center;
}

.mode-tab-stack .mode-tab + .mode-tab {
    border-top: 1px solid #b0b0b0;
}

.mode-tab-plus {
    padding: 2px 6px;
}

.mode-tab-plus .mode-plus {
    font-size: 14px;
}

.combo-active .mode-tab.active {
    border: 2px solid #6fbf73;
}

.combo-active .mode-tab.active:first-child {
    border-top: 2px outset #ebebeb;
    border-bottom: 2px outset #ebebeb;
    border-right: none;
}

.combo-active .mode-tab-plus.active {
    border-top: 2px outset #ebebeb;
    border-bottom: 2px outset #ebebeb;
    border-left: none;
    border-right: none;
}

.combo-active .mode-tab.active:last-child {
    border-right: 2px outset #ebebeb;
    border-top: 2px outset #ebebeb;
    border-bottom: 2px outset #ebebeb;
    border-left: none;
}

.combo-active .mode-tab-stack {
    border-right: none;
}

/* Compare Mode */
.mode-tab-vs {
    padding: 2px 6px;
}

.mode-vs {
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
    color: #000000;
    line-height: 1;
}

.mode-tab.compare-transit {
    background: #991b1b;
    border-style: inset;
}

.mode-tab.compare-bike {
    background: #2563eb;
    border-style: inset;
}

.mode-tab.compare-transit svg *,
.mode-tab.compare-bike svg * {
    stroke: white;
}

/* Hover Animations */
@keyframes scroll-tracks {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.mode-tab:hover .train-tracks {
    animation: scroll-tracks 0.2s linear infinite;
}

@keyframes spin-wheel {
    from { transform: rotate(45deg); }
    to { transform: rotate(405deg); }
}

.bike-rear-wheel {
    transform-origin: 30px 68px;
    transform: rotate(45deg);
}

.bike-front-wheel {
    transform-origin: 72.5px 68px;
    transform: rotate(45deg);
}

.mode-tab:hover .bike-rear-wheel {
    animation: spin-wheel 0.5s linear infinite;
}

.mode-tab:hover .bike-front-wheel {
    animation: spin-wheel 0.5s linear infinite;
}


/* --- Controls --- */

/* Close Button */
.close-button {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 30px;
    border-radius: 0;
    border: 2px outset #ebebeb;
    background: #EBEBEB;
    color: #000000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: none;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
}

.close-button:hover {
    border-style: inset;
    background: #EBEBEB;
}

/* Info Button */
.info-button {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 30px;
    border-radius: 0;
    border: 2px outset #ebebeb;
    background: #EBEBEB;
    color: #000000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: right 0.15s ease;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
}

.info-button.has-origin {
    right: 48px;
}

.info-button:hover {
    border-style: inset;
    background: #EBEBEB;
}


/* --- Prompts & Overlays --- */

/* Click Prompt */
.click-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #EBEBEB;
    padding: 8px 14px;
    border: 2px outset #ebebeb;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
    font-size: 12px;
    color: #000000;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #EBEBEB;
    padding: 16px;
    border: 2px outset #ebebeb;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #b0b0b0;
    border-top-color: #000080;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --- Origin Info --- */

.origin-info {
    position: fixed;
    bottom: 20px;
    left: 10px;
    background: #EBEBEB;
    padding: 8px 14px;
    border: 2px outset #ebebeb;
    max-width: 250px;
}

.origin-name {
    font-size: 11px;
    font-weight: 500;
    color: #000000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}


/* --- Legend --- */

.legend {
    position: fixed;
    bottom: 20px;
    right: 10px;
    background: #EBEBEB;
    padding: 10px 14px;
    border: 2px outset #ebebeb;
}

.legend-title {
    font-size: 11px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 6px;
}

.legend-bands {
    display: flex;
    gap: 0;
}

.legend-band {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.legend-swatch {
    width: 24px;
    height: 14px;
    border: 1px inset #b0b0b0;
}

.legend-label {
    font-size: 10px;
    color: #000000;
    margin-top: 4px;
}

/* Compare Legend */
.legend-compare-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-compare-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-compare-item .legend-swatch {
    width: 24px;
    height: 14px;
    border: 1px inset #b0b0b0;
    flex-shrink: 0;
}

.legend-compare-item .legend-label {
    font-size: 11px;
    margin-top: 0;
}


/* --- Markers --- */

.origin-marker {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.transit-stop-marker {
    background: transparent;
}


/* --- Leaflet Overrides --- */

.leaflet-container {
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
}

.leaflet-popup-content-wrapper {
    border-radius: 0;
    border: 2px outset #ebebeb;
    background: #EBEBEB;
}

.leaflet-popup-content {
    margin: 0.75rem;
    font-size: 11px;
    color: #000000;
}

/* Leaflet Controls */
.leaflet-bar {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.leaflet-bar a {
    width: 32px !important;
    height: 30px !important;
    line-height: 30px !important;
    border-radius: 0 !important;
    background: #EBEBEB;
    color: #000000;
    border: 2px outset #ebebeb;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
    font-size: 18px;
    font-weight: bold;
}

.leaflet-bar a:hover {
    background: #f5f5f5;
}

.leaflet-bar a:active {
    border-style: inset;
}

.leaflet-bar a.leaflet-disabled {
    background: #EBEBEB;
    color: #b0b0b0;
    border: 2px outset #ebebeb;
}

.leaflet-control-attribution {
    background: #EBEBEB !important;
    border-radius: 0;
    border: 1px outset #ebebeb;
    font-size: 10px;
    color: #000000;
    font-family: "MS Sans Serif", "Fixedsys", Arial, sans-serif;
}

.leaflet-control-attribution a {
    color: #000080;
}


/* --- Info Modal --- */

.info-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-modal {
    position: relative;
    background: #dddddd;
    border: 1px solid #000000;
    border-radius: 6px;
    width: 420px;
    max-width: 90vw;
    z-index: 1001;
    box-shadow: 2px 3px 0 #000000;
    font-family: "Chicago", "Charcoal", "Geneva", "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

/* Titlebar */
.info-modal-titlebar {
    background:
        repeating-linear-gradient(
            to bottom,
            #ffffff 0px,
            #ffffff 1px,
            #dddddd 1px,
            #dddddd 2px
        );
    border-bottom: 1px solid #000000;
    display: flex;
    align-items: center;
    padding: 3px 6px;
    height: 20px;
    position: relative;
}

/* Close Box */
.info-modal-titlebar .close-box {
    width: 13px;
    height: 13px;
    border: 1px solid #000000;
    background: #ffffff;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    border-radius: 0;
    font-size: 10px;
    line-height: 11px;
    text-align: center;
    color: #000000;
    font-family: "Geneva", "Helvetica Neue", Arial, sans-serif;
}

.info-modal-titlebar .close-box:hover {
    background: #000000;
    color: #ffffff;
}

/* Title Label */
.info-modal-titlebar .titlebar-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: bold;
    color: #000000;
    background: #dddddd;
    padding: 0 8px;
}

/* Tabs */
.info-modal-tabs {
    display: flex;
    padding: 8px 8px 0 8px;
    gap: 0;
}

.info-modal-tabs button {
    padding: 3px 14px;
    border: 1px solid #000000;
    border-bottom: none;
    background: #dddddd;
    cursor: pointer;
    font-family: "Chicago", "Charcoal", "Geneva", "Helvetica Neue", Arial, sans-serif;
    font-size: 11px;
    border-radius: 4px 4px 0 0;
    color: #000000;
    position: relative;
    top: 1px;
    margin-right: -1px;
}

.info-modal-tabs button:hover:not(.active) {
    background: #cccccc;
}

.info-modal-tabs button.active {
    background: #ffffff;
    border-bottom: 1px solid #ffffff;
    z-index: 1;
    font-weight: bold;
}

/* Content */
.info-modal-content {
    margin: 0 8px 8px 8px;
    border: 1px solid #000000;
    background: #ffffff;
    padding: 12px;
    font-size: 11px;
    line-height: 1.5;
    font-family: "Geneva", "Helvetica Neue", Arial, sans-serif;
}

.info-modal-content a {
    color: #000080;
}


/* --- Responsive --- */

@media (max-width: 768px) {
    .mode-selector {
        bottom: 8px;
        max-width: calc(100vw - 16px);
    }

    .mode-selector.has-origin {
        left: 8px;
        transform: none;
    }

    .mode-tab {
        font-size: 11px;
    }

    .mode-selector > .mode-tab {
        width: 60px;
        height: 60px;
        padding: 0;
        justify-content: center;
    }

    .mode-tab-stack .mode-tab {
        padding: 2px 6px;
    }

    .mode-icon {
        width: 26px;
        height: 26px;
    }

    .has-origin ~ .origin-info {
        bottom: 62px;
    }

    .close-button {
        top: 8px;
        right: 8px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .info-button {
        top: 8px;
        right: 8px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .info-button.has-origin {
        right: 52px;
    }

    .info-modal {
        width: 300px;
    }

    .legend {
        bottom: 12px;
        right: 8px;
        padding: 8px 10px;
    }

    .legend-swatch {
        width: 18px;
        height: 12px;
    }

    .legend-label {
        font-size: 9px;
    }

    .legend-title {
        font-size: 10px;
    }

    .origin-info {
        bottom: 12px;
        left: 8px;
        padding: 6px 10px;
        max-width: 180px;
    }

    .origin-name {
        font-size: 11px;
    }
}
