/* Watershed models (/gifts/watershed/). Same bench-and-panel layout as
   /gifts/topo-layers/, with a basin table and a flat basin map view. */

.ws {
    --bench: #1b2226;
    --bench-deep: #141a1d;
    --panel: #141716;
    --field: #1c201e;
    --ink: #eceee9;
    --muted: #9aa49e;
    --rule: rgba(236, 238, 233, 0.09);
    --accent: var(--tpa-accent, #ff8f1f);
    font-family: 'Schibsted Grotesk', system-ui, sans-serif;
    color: var(--ink);
    max-width: 1560px;
    margin: 0 auto;
    padding: 14px 24px 56px;
}
.ws h1, .ws h2, .ws h3 { font-family: inherit; color: var(--ink); }
.ws-intro { padding: 18px 0 16px; border-bottom: 1px solid var(--rule); }
.ws-intro h1 { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin: 0 0 10px; }
.ws-intro p { color: var(--muted); font-size: 0.93rem; line-height: 1.5; margin: 0; }

.ws-app { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }

/* ---------- the bench ---------- */
.ws-bench {
    position: sticky; top: 68px;
    display: flex; flex-direction: column;
    height: calc(100vh - 84px); min-height: 560px;
    background: var(--bench-deep); border-radius: 14px; overflow: hidden;
}
.ws-benchbar { display: flex; align-items: center; gap: 14px; padding: 10px 12px; flex-wrap: wrap; }
.ws-legendbar { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.76rem; color: rgba(236, 238, 233, 0.75); }
.ws-legendbar span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ws-legendbar i { width: 11px; height: 11px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.ws-stage {
    position: relative; flex: 1; min-height: 0; margin: 0 10px; border-radius: 8px; overflow: hidden;
    background: radial-gradient(120% 90% at 50% 30%, #253036 0%, var(--bench) 60%, #161c1f 100%);
}
.ws-3d { position: absolute; inset: 0; display: none; }
.ws-3d canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.ws-stage[data-mode="3d"] .ws-3d { display: block; }
.ws-flat { position: absolute; inset: 0; display: none; padding: 14px; }
.ws-flat canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.ws-stage[data-mode="map"] .ws-flat { display: block; }
.ws-empty {
    position: absolute; left: 50%; top: 45%; transform: translateX(-50%); margin: 0; z-index: 2;
    background: rgba(20, 23, 22, 0.88); color: var(--ink); padding: 10px 16px; border-radius: 8px; font-size: 0.9rem; text-align: center; max-width: 90%;
}
.ws-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, 0.06); z-index: 3; }
.ws-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }
.ws-status { margin: 0; padding: 9px 14px 11px; font-size: 0.8rem; color: rgba(236, 238, 233, 0.62); min-height: 2.4em; }

/* ---------- segmented controls ---------- */
.ws-seg { display: inline-flex; background: var(--field); border-radius: 9px; padding: 3px; gap: 2px; }
.ws-seg button {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.86rem; font-weight: 500;
    padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.ws-seg button:hover { color: var(--ink); }
.ws-seg button[aria-pressed="true"] { background: var(--ink); color: #141716; }
.ws-views { background: rgba(0, 0, 0, 0.25); }
.ws-sec .ws-seg { display: flex; margin-bottom: 4px; }
.ws-sec .ws-seg button { flex: 1; padding: 6px 6px; }

/* ---------- panel ---------- */
.ws-panel { background: var(--panel); border-radius: 14px; padding: 4px 18px 18px; }
.ws-sec { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.ws-sec h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.ws-sec h3 { font-size: 0.9rem; font-weight: 600; margin: 14px 0 8px; }
.ws-sub { margin: 14px 0 8px; font-size: 0.86rem; color: var(--muted); }
.ws-hint { font-size: 0.78rem; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
.ws-readout { font-size: 0.82rem; color: var(--muted); margin: 6px 0 0; }
.ws-indent { margin-left: 25px; }

.ws-search { display: flex; gap: 6px; }
.ws-search input, .ws-field input, .ws-field select {
    width: 100%; min-width: 0; background: var(--field); color: var(--ink); border: 1px solid transparent; border-radius: 8px;
    padding: 8px 10px; font: inherit; font-size: 0.9rem;
}
.ws-field select { appearance: auto; }
.ws-search input:focus, .ws-field input:focus, .ws-field select:focus { outline: none; border-color: var(--accent); }
.ws-results { list-style: none; margin: 6px 0 0; padding: 0; }
.ws-results button {
    display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--ink); font: inherit;
    padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.ws-results button:hover, .ws-results button:focus-visible { background: var(--field); }
.ws-results strong { display: block; font-size: 0.9rem; font-weight: 600; }
.ws-results span { display: block; font-size: 0.76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-res-note { font-size: 0.8rem; color: var(--muted); padding: 6px 8px; }

.ws-mapwrap { position: relative; margin-top: 10px; border-radius: 8px; overflow: hidden; background: var(--field); }
.ws-map { width: 100%; aspect-ratio: 1 / 1; }
.ws-mask { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ws-km {
    position: absolute; left: 8px; bottom: 8px; pointer-events: none;
    background: rgba(20, 23, 22, 0.82); color: var(--ink); font-size: 0.75rem; padding: 3px 8px; border-radius: 6px;
}
.ws-mapwrap .maplibregl-ctrl-attrib { font-size: 10px; }

.ws-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.ws .ws-ex {
    display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; border-radius: 999px;
    background: var(--field); color: var(--ink) !important; font-size: 0.82rem; text-decoration: none;
}
.ws .ws-ex:hover { background: #262b29; color: #fff !important; }
.ws-ex i {
    width: 18px; height: 18px; border-radius: 50%; flex: none;
    background: conic-gradient(#2f8f5b 0 34%, #e08a2e 0 58%, #8b5cb8 0 80%, #c9473b 0);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    position: relative;
}
.ws-ex i::after { content: ''; position: absolute; left: 8px; top: 2px; width: 2px; height: 14px; background: #2368c9; border-radius: 1px; transform: rotate(18deg); }

.ws-field { display: block; margin: 0 0 10px; }
.ws-field > span, .ws-range > span { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.ws-range output { color: var(--ink); }
.ws-range { display: block; margin: 12px 0 4px; }
.ws-range input { width: 100%; accent-color: var(--accent); }
.ws-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ws-check-row { display: flex; align-items: center; gap: 9px; font-size: 0.88rem; margin: 8px 0; cursor: pointer; }
.ws-check-row input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.ws-link { background: none; border: 0; padding: 0; margin-top: 10px; color: var(--muted); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; text-align: left; }
.ws-link:hover { color: var(--ink); }

/* the numbers that matter: layers, height per layer, exaggeration */
.ws-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.ws-fact { background: var(--field); border-radius: 8px; padding: 8px 9px 7px; }
.ws-fact b { display: block; font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; }
.ws-fact span { display: block; font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.ws-fact.is-warn b { color: #ffb36b; }

.ws-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid rgba(236, 238, 233, 0.2); background: transparent; color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600;
    padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.ws-btn:hover { border-color: var(--ink); }
.ws-btn-main { background: var(--accent); border-color: var(--accent); color: #1a1205; }
.ws-btn-main:hover { background: #ffa246; border-color: #ffa246; }
.ws-btn:disabled { opacity: 0.7; cursor: progress; }
.ws-btn:focus-visible, .ws-seg button:focus-visible, .ws-link:focus-visible, .ws-ex:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ws-dl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ws-license { font-size: 0.76rem; color: var(--muted); margin: 10px 0 0; }
.ws-license a { color: var(--muted); }

.ws-info { margin-top: 12px; font-size: 0.86rem; }
.ws-info p { margin: 0 0 6px; }
.ws-check.is-ok { color: #8fd6a8; }
.ws-check.is-bad { color: #ffb36b; }
.ws-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ws-legend li { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; }
.ws-legend i { width: 22px; height: 14px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ws-legend i.is-line { height: 4px; border-radius: 2px; box-shadow: none; }
.ws-notes { margin: 12px 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.8rem; }
.ws-notes:empty { display: none; }
.ws-notes li { margin-bottom: 4px; }

/* ---------- basin table ---------- */
.ws-tablewrap { margin-top: 12px; overflow-x: auto; }
.ws-table { font-family: inherit; width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.ws-table th { text-align: right; font-weight: 500; color: var(--muted); padding: 4px 4px 6px; font-size: 0.72rem; line-height: 1.25; vertical-align: bottom; }
.ws-table th:first-child, .ws-table td:first-child { text-align: left; }
.ws-table td { font-family: inherit; text-align: right; padding: 5px 4px; border-top: 1px solid var(--rule); }
.ws-table td:first-child { display: flex; align-items: center; gap: 7px; }
.ws-table td small { display: block; color: var(--muted); font-size: 0.72rem; }
.ws-table i { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ws-table b { font-weight: 600; }
.ws-table tr.is-other td { color: var(--muted); }
.ws-pickhint { background: var(--field); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; margin: 10px 0 0; line-height: 1.4; }
.ws-pickhint b { color: var(--accent); }
.ws-colours { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; }
.ws-colours li { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; }
.ws-colours i { width: 20px; height: 13px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ws-colours span { color: var(--muted); }

/* ---------- about ---------- */
.ws-about { margin-top: 44px; max-width: 1180px; }
.ws-about h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 16px; }
.ws-about-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 40px; }
.ws-about figure { margin: 0; }
.ws-about svg { display: block; max-width: 100%; height: auto; }
.ws-about ol { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin: 8px 0 0; padding-left: 1.2rem; max-width: 60ch; }
.ws-about h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.ws-about p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; margin: 0; max-width: 60ch; }
.ws-credit { margin-top: 22px !important; font-size: 0.82rem !important; }

.ws-toast {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
    width: max-content; max-width: calc(100vw - 32px);
    background: var(--ink); color: #141716; padding: 10px 16px; border-radius: 9px; font-size: 0.9rem; font-weight: 500;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

@media (max-width: 1100px) {
    .ws-app { grid-template-columns: minmax(0, 1fr) 350px; }
}
@media (max-width: 900px) {
    .ws { padding: 14px 16px 44px; }
    .ws-app { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .ws-bench { position: relative; top: 0; height: auto; min-height: 0; }
    .ws-stage { height: 420px; flex: none; }
    .ws-about-cols { grid-template-columns: 1fr; gap: 18px; }
    .ws-panel { display: contents; }
    .ws-intro { order: -1; border: 0; padding: 6px 2px 4px; }
    .ws-intro h1 { font-size: 1.8rem; }
    .ws-sec { order: 1; background: var(--panel); border-radius: 12px; padding: 14px; border: 0; }
    .ws-notes { order: 2; }
}
@media (max-width: 420px) {
    .ws-seg button { padding: 6px 6px; font-size: 0.8rem; }
    .ws-fact b { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .ws-progress i { transition: none; }
}
.ws-check-sub { margin-left: 25px; font-size: 0.84rem; color: var(--muted, #b9bcc0); }
