/* Map presentation is scoped to /roads; the kiosk keeps its existing layout. */
body[data-page-type="roads"] .map-container-fullscreen {
    width: 100%;
    height: 70vh;
    min-height: 480px;
    overflow: hidden;
    border: 1px solid #d9dde3;
    border-radius: 6px;
    box-shadow: none;
    box-sizing: border-box;
}

body[data-page-type="roads"] .road-network-map {
    height: 100%;
    border-radius: 0;
    box-shadow: none;
}

.roads-map-control-cluster {
    position: absolute;
    inset: 12px 12px auto;
    z-index: 1001;
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px;
    border: 1px solid #d9dde3;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.97);
    color: #374151;
}

.roads-map-control-cluster .hrrr-map-controls {
    flex: 1 1 auto;
    gap: 12px;
    margin: 0;
    padding: 0;
    border: 0;
}

.roads-map-control-cluster .hrrr-map-control-group {
    width: auto;
    min-width: 0;
}

.roads-map-control-cluster :is(.hrrr-map-toggle, .hrrr-map-hours) {
    width: auto;
    padding: 0;
    gap: 4px;
    background: none;
}

.roads-map-control-cluster .hrrr-map-hours button {
    min-width: 48px;
}

.roads-map-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.roads-map-control-cluster :is(button, .leaflet-control-zoom a) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 6px 9px;
    border: 1px solid #d9dde3;
    border-radius: 6px;
    background: white;
    color: #374151;
    box-shadow: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    box-sizing: border-box;
    text-decoration: none;
    transform: none;
    -webkit-tap-highlight-color: transparent;
}

.roads-map-control-cluster :is(button, .leaflet-control-zoom a):hover {
    background: #f5f6f7;
    box-shadow: none;
    transform: none;
}

.roads-map-control-cluster :is(button.is-active, button[aria-checked="true"], button[aria-expanded="true"]) {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.roads-map-control-cluster :is(button, a):focus-visible {
    outline: 2px solid #4b5563;
    outline-offset: 2px;
}

.roads-map-control-cluster .fas { color: inherit; font-size: 12px; }
.roads-map-control-cluster .units-toggle { min-width: 0; }
.roads-map-control-cluster :is(.units-toggle-container, .map-reset-container) { position: static; }

.roads-map-control-cluster :is(.camera-cycle-control, .road-legend-collapsible, .leaflet-control-zoom) {
    position: relative;
    float: none;
    clear: none;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    min-width: 0;
    background: none !important;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}

.roads-map-control-cluster .leaflet-control-zoom { display: flex; gap: 4px; }
.roads-map-control-cluster .leaflet-control-zoom a { width: 32px; font-size: 18px; }
.roads-map-control-cluster .camera-cycle-label { color: inherit; font-size: 12px; }
.roads-map-control-cluster .camera-cycle-switch {
    width: 32px;
    min-width: 32px;
    height: 18px;
    min-height: 18px;
    border: 1px solid #9ca3af;
    border-radius: 9px;
    background: #e5e7eb;
}
.roads-map-control-cluster .camera-cycle-slider { width: 14px; height: 14px; box-shadow: none; }
.roads-map-control-cluster .camera-cycle-button.active .camera-cycle-switch { background: #4b5563; }
.roads-map-control-cluster .camera-cycle-button.active .camera-cycle-slider { transform: translateX(14px); }
.roads-map-control-cluster .camera-cycle-timer-fill { background: #9ca3af; }

.roads-map-control-cluster .legend-arrow { transform: rotate(180deg); }
.roads-map-control-cluster .legend-arrow.rotated { transform: none; }
.roads-map-control-cluster .legend-content {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 230px;
    max-height: 0;
    visibility: hidden;
    border-radius: 6px;
    background: white;
    box-sizing: border-box;
}
.roads-map-control-cluster .legend-content.expanded {
    visibility: visible;
    max-height: 330px;
    overflow-y: auto;
    border: 1px solid #d9dde3;
}
.roads-map-control-cluster .hrrr-map-legend {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: none;
}
.roads-map-control-cluster [hidden] { display: none; }

body[data-page-type="roads"] .conditions-overlay {
    position: absolute;
    inset: auto auto 28px 50%;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 24px));
    margin: 0;
    padding: 8px 12px;
    gap: 6px;
    border: 1px solid #d9dde3;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: none;
}

.conditions-source {
    width: 100%;
    margin: 0;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Let the full camera location wrap; avoid competing fixed popup widths. */
body[data-page-type="roads"] .leaflet-popup.camera-popup-marker { max-width: none !important; }
body[data-page-type="roads"] .leaflet-popup.camera-popup-marker .leaflet-popup-content-wrapper {
    width: min(320px, calc(100vw - 64px));
    min-width: 0 !important;
    max-width: none !important;
    padding: 12px !important;
    box-sizing: border-box;
}
body[data-page-type="roads"] .camera-popup { max-width: none !important; }
body[data-page-type="roads"] .camera-popup h4 {
    display: block;
    padding-right: 12px;
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
    -webkit-line-clamp: unset;
    max-height: none;
    line-height: 1.4;
    text-align: left;
}

@media (max-width: 768px) {
    body[data-page-type="roads"] .map-container-fullscreen { height: max(680px, 80svh); }
    .roads-map-control-cluster { inset: 8px 8px auto; gap: 8px; padding: 8px; }
    .roads-map-control-cluster .hrrr-map-controls { width: 100%; gap: 8px; }
    .roads-map-control-cluster .hrrr-map-control-group { width: 100%; }
    .roads-map-control-cluster :is(.hrrr-map-toggle, .hrrr-map-hours) { width: 100%; }
    .roads-map-control-cluster :is(.hrrr-map-toggle, .hrrr-map-hours) button { flex: 1; min-width: 0; }
    .roads-map-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .roads-map-actions .camera-cycle-control { grid-column: span 2; }
    .roads-map-actions button { width: 100%; }
    .roads-map-control-cluster :is(button, .leaflet-control-zoom a) { min-height: 44px; padding-inline: 5px; }
    .roads-map-control-cluster .leaflet-control-zoom a { flex: 1; }
    body[data-page-type="roads"] .conditions-overlay { bottom: 30px; padding: 8px; }
    body[data-page-type="roads"] .condition-cards-horizontal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body[data-page-type="roads"] .condition-card-compact { min-width: 0; }
    body[data-page-type="roads"] .card-data .value { white-space: normal; }
}
