/* Dedicated flow-path scenario page — same app-shell as index.html
   (topbar / sidebar / full-bleed map), redesigned as a proper numbered
   wizard rather than a flat stack of sections: a connecting stepper line,
   icon-led disclaimer, magnitude bars on the tier cards, and a stat-tile
   grid for results (matching index.html's own stat cards) instead of a
   plain definition list. Extends style.css's tokens and layout classes. */

.sc-sidebar { overflow-y: auto; padding: 1.1rem 1.1rem 1.5rem; }

/* ---------- Disclaimer ---------- */

.sc-disclaimer {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    background: linear-gradient(135deg, var(--crimson-tint), transparent 140%);
    border: 1px solid var(--crimson-tint);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.4rem;
}
.sc-disclaimer-icon { width: 18px; height: 18px; flex: none; color: var(--crimson); margin-top: 0.1rem; }
.sc-disclaimer p { margin: 0; font-size: var(--fs-0); line-height: 1.55; color: var(--ink-soft); }
.sc-disclaimer strong { color: var(--ink); font-weight: 700; }

/* ---------- Stepper ---------- */

.sc-stepper { list-style: none; margin: 0; padding: 0; position: relative; }
.sc-step {
    position: relative;
    padding-left: 2.3rem;
    padding-bottom: 1.6rem;
    margin-bottom: 0.2rem;
}
.sc-step::before {
    /* the connecting line, drawn from this step's number down to the next */
    content: '';
    position: absolute;
    left: 0.85rem;
    top: 2rem;
    bottom: 0;
    width: 1px;
    background: var(--line-card);
}
.sc-step:last-child::before { display: none; }
.sc-step-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; }
.sc-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 0;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--card-raised);
    border: 1px solid var(--line-card);
    color: var(--ink-faint);
    font-size: var(--fs-0);
    font-weight: 700;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.sc-step.is-active .sc-step-num { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.sc-step.is-done .sc-step-num { background: var(--green-tint); border-color: var(--green); color: var(--green); }
.sc-step-head h3 {
    margin: 0;
    font-size: var(--fs-1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    font-weight: 700;
}
.sc-step.is-active .sc-step-head h3 { color: var(--ink); }
.sc-step-body { opacity: 1; transition: opacity 0.2s var(--ease); }
.sc-step[hidden] { display: none; }

/* ---------- Lake search + list ---------- */

.sc-search-wrap { position: relative; margin-bottom: 0.7rem; }
.sc-search-icon { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-faint); pointer-events: none; }
#sc-lake-search {
    width: 100%;
    padding: 0.55rem 0.7rem 0.55rem 2.1rem;
    background: var(--card);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font: inherit;
    transition: border-color 0.15s ease;
}
#sc-lake-search:focus { outline: none; border-color: var(--brand); }

.sc-lake-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 40vh; overflow-y: auto; padding-right: 0.2rem; }
.sc-lake-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    background: var(--card);
    border: 1px solid transparent;
    border-left: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    font: inherit;
    width: 100%;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.sc-lake-row:hover { background: var(--card-raised); }
.sc-lake-row.active { background: var(--brand-tint); border-left-color: var(--brand); }
.sc-lake-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sc-lake-row .dot.rank-i { background: var(--crimson); }
.sc-lake-row .dot.rank-ii { background: var(--gold); }
.sc-lake-row .dot.unranked { background: var(--ink-faint); }
.sc-lake-row .name { flex: 1; font-size: var(--fs-1); }
.sc-lake-row .basin { font-size: var(--fs-0); color: var(--ink-faint); }

/* ---------- Tier cards ---------- */

.sc-selected-lake { font-size: var(--fs-1); color: var(--ink); font-weight: 600; margin: 0 0 0.9rem; }
.sc-tiers { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 1rem; }
.sc-tier-btn {
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.sc-tier-btn strong { font-size: var(--fs-1); }
.sc-tier-btn .sc-tier-meta { font-size: var(--fs-0); color: var(--ink-soft); }
.sc-tier-bar-track { height: 4px; border-radius: 2px; background: var(--paper-deep); overflow: hidden; }
.sc-tier-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--crimson)); border-radius: 2px; }
.sc-tier-btn.active { border-color: var(--brand); background: var(--brand-tint); }
.sc-tier-btn:hover { border-color: var(--brand); }

.sc-run-btn { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.sc-run-btn svg { width: 14px; height: 14px; }
.sc-status { font-size: var(--fs-0); color: var(--ink-soft); margin-top: 0.6rem; line-height: 1.5; }

/* ---------- Results ---------- */

.sc-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1.1rem; }
.sc-stat-tile {
    background: var(--card);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.sc-stat-tile .num { font-size: 1.15rem; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sc-stat-tile .label { font-size: var(--fs-0); color: var(--ink-faint); }

#sc-elevation-chart-wrap { margin-bottom: 1.1rem; }
.sc-chart-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 0.6rem; margin: 0 0 0.4rem;
}
.sc-chart-label { font-size: var(--fs-0); color: var(--ink-faint); margin: 0; }
.sc-chart-readout {
    margin: 0;
    font-size: var(--fs-0);
    font-weight: 700;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
#sc-elevation-chart {
    width: 100%;
    height: auto;
    background: var(--card);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    display: block;
    cursor: crosshair;
}

.sc-subhead { font-size: var(--fs-1); font-weight: 700; color: var(--ink-soft); margin: 0 0 0.5rem; }
.sc-muni-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.55rem 0.65rem;
    background: var(--card);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    font-size: var(--fs-1);
    margin-bottom: 0.4rem;
}
.sc-muni-row:last-child { margin-bottom: 0; }
.sc-muni-row .name { color: var(--ink); font-weight: 600; }
.sc-muni-row .dist { color: var(--ink-faint); font-size: var(--fs-0); font-weight: 400; }
.sc-muni-row .pop { color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }

.sc-path-note { font-size: var(--fs-0); color: var(--ink-faint); line-height: 1.5; margin: 0.7rem 0 0; }

/* ---------- Map chrome ---------- */

.sc-map-legend {
    position: absolute;
    left: 14px;
    /* Cleared above the transport bar, which now spans the full width. */
    bottom: 70px;
    z-index: 500;
    background: rgba(10,10,9,0.9);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    font-size: var(--fs-0);
    color: var(--ink-soft);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--shadow-card);
}
.sc-map-legend .item { display: flex; align-items: center; gap: 0.45rem; }
.sc-map-legend .swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- Telemetry HUD ---------- */

.sc-hud {
    position: absolute;
    /* Top-right, not top-left: Leaflet's zoom control owns the top-left
       corner and sits at a higher z-index, so a HUD there is half-covered. */
    top: 14px;
    right: 14px;
    z-index: 500;
    width: 232px;
    padding: 0.7rem 0.8rem 0.6rem;
    background: rgba(9, 12, 19, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line-card);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px -18px rgba(0,0,0,.9);
}
.sc-hud[hidden] { display: none; }
.sc-hud-head {
    display: flex; align-items: center; gap: 0.45rem;
    font-size: var(--fs-0); font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 0.6rem;
}
.sc-hud-dot {
    width: 7px; height: 7px; border-radius: 50%; flex: none;
    background: #ff6b5a;
    box-shadow: 0 0 8px 1px rgba(255,107,90,.9);
    animation: sc-front-pulse-dot 1.4s ease-in-out infinite;
}
@keyframes sc-front-pulse-dot { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

.sc-hud-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 0.7rem;
}
.sc-hud-cell { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sc-hud-cell .k {
    font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--ink-faint);
}
.sc-hud-cell .v {
    font-size: 1.02rem; font-weight: 800; color: var(--ink);
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
    line-height: 1.1;
}
.sc-hud-cell .v i {
    font-style: normal; font-size: 0.62rem; font-weight: 600;
    color: var(--ink-faint); margin-left: 0.15em;
}
.sc-hud-foot {
    margin-top: 0.6rem; padding-top: 0.5rem;
    border-top: 1px solid var(--line-card);
    font-size: var(--fs-0); color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    display: flex; flex-direction: column; gap: 0.2rem;
}

/* ---------- Settlement summary (results panel) ---------- */

.sc-settle-summary {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.sc-settle-tile {
    flex: 1;
    padding: 0.55rem 0.7rem;
    background: var(--card);
    border: 1px solid var(--line-card);
    border-radius: var(--radius-sm);
}
.sc-settle-tile .num {
    display: block; font-size: 1.1rem; font-weight: 800; color: var(--ink);
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.sc-settle-tile .label { font-size: var(--fs-0); color: var(--ink-faint); }

/* ---------- Transport bar ---------- */

.sc-playback {
    position: absolute;
    left: 14px; right: 14px; bottom: 14px;
    z-index: 500;
}
.sc-playback[hidden] { display: none; }
.sc-transport {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.65rem;
    background: rgba(9, 12, 19, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line-card);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px -18px rgba(0,0,0,.9);
}
.sc-tbtn {
    flex: none;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 8px;
    border: 1px solid var(--line-card);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.sc-tbtn:hover { background: var(--card-raised); border-color: #3a4150; }
.sc-tbtn svg { width: 15px; height: 15px; }
/* One button, two glyphs — the JS only toggles .is-playing. */
.sc-tbtn .ic-play { display: none; }
.sc-tbtn.is-playing .ic-play { display: none; }
.sc-tbtn.is-playing .ic-pause { display: block; }
.sc-tbtn:not(.is-playing) .ic-pause { display: none; }
.sc-tbtn:not(.is-playing) .ic-play { display: block; }

.sc-scrub {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff6b5a var(--sc-fill, 0%), var(--line-card) var(--sc-fill, 0%));
    cursor: pointer;
}
.sc-scrub::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px; height: 13px;
    border-radius: 50%;
    background: #ff6b5a;
    border: 2px solid #14181f;
    box-shadow: 0 0 10px 2px rgba(255,107,90,.55);
    cursor: grab;
}
.sc-scrub::-moz-range-thumb {
    width: 13px; height: 13px;
    border-radius: 50%;
    background: #ff6b5a;
    border: 2px solid #14181f;
    box-shadow: 0 0 10px 2px rgba(255,107,90,.55);
    cursor: grab;
}
.sc-scrub-read {
    flex: none;
    font-size: var(--fs-0);
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sc-speed { display: flex; gap: 2px; flex: none; }
.sc-speed-btn {
    padding: 0.28rem 0.42rem;
    border: 1px solid var(--line-card);
    background: var(--card);
    color: var(--ink-faint);
    font-family: inherit;
    font-size: 0.66rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s var(--ease);
}
.sc-speed-btn:first-child { border-radius: 7px 0 0 7px; }
.sc-speed-btn:last-child { border-radius: 0 7px 7px 0; }
.sc-speed-btn.is-active { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }

.sc-follow {
    flex: none;
    display: flex; align-items: center; gap: 0.35rem;
    font-size: var(--fs-0); color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}
.sc-follow input { accent-color: var(--brand); cursor: pointer; }

@media (max-width: 900px) {
    .sc-hud { width: auto; left: 14px; right: 14px; }
    .sc-scrub-read, .sc-follow { display: none; }
    /* HUD spans the width here, so the legend would sit under it. */
    .sc-map-legend { display: none; }
}

/* Flood-front marker: a bigger, brighter pulse than the standing hazard
   markers elsewhere in the app, since this one is meant to draw the eye
   as it travels down the path during the animation. */
.flood-front { position: relative; width: 20px; height: 20px; }
.flood-front .core {
    position: absolute; inset: 5px;
    border-radius: 50%;
    background: #ff6b5a;
    box-shadow: 0 0 14px 3px rgba(255, 107, 90, 0.9);
}
.flood-front .ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: #ff6b5a;
    opacity: 0.6;
    animation: sc-front-pulse 1s ease-out infinite;
}
@keyframes sc-front-pulse {
    0% { transform: scale(0.5); opacity: 0.65; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* The dim "path ahead" guide line drifts downstream, which reads as flow
   direction before the front has arrived. Leaflet renders polylines as SVG
   paths, so animating stroke-dashoffset here is enough — no per-frame JS.
   Scoped to the dashed guide only: the solid channel must not shimmer. */
#sc-map path[stroke-dasharray="4 6"] {
    animation: sc-flow-drift 1.1s linear infinite;
}
@keyframes sc-flow-drift {
    to { stroke-dashoffset: -10; }
}

.sc-muni-marker-pulse {
    animation: sc-muni-flash 0.6s ease-out;
}

/* Settlement clusters are smaller and dimmer than municipality markers at
   rest — there can be a couple hundred of them on one trace, and they're
   meant to read as a texture the front moves through, not as individually
   important points the way a whole municipality is. The hit state flips
   them to the same warning-amber as the HUD's flood dot, so "the water
   reached a real, mapped building" reads as a distinct event on the map. */
.sc-settlement-hit {
    animation: sc-settlement-flash 0.5s ease-out;
}
@keyframes sc-settlement-flash {
    0% { transform: scale(0.4); }
    55% { transform: scale(1.8); }
    100% { transform: scale(1); }
}
@keyframes sc-muni-flash {
    0% { transform: scale(0.3); }
    60% { transform: scale(1.6); }
    100% { transform: scale(1); }
}

/* style.css's #map rule doesn't apply to this page's own map id — without
   this, the map div inherits no height from .map-wrap's flex context and
   Leaflet never fetches a single tile (confirmed live: 0px computed
   height, zero tile requests). */
#sc-map { width: 100%; height: 100%; background: #06070a; }
#sc-map.leaflet-container { background: #06070a; }
