/* ===== Offshore SST: the color panel, the live legend, depth lines and spot
   labels (assets/sstlook.js, sprint 2 lane V). Scoped to .sst-page / sstc-* /
   sstl-*. Loads after sst.css (alphabetical), so it may override it.

   html.sst-engine-on is set by sstlook.js once the SST engine (window.SSTEngine)
   has a week: then the color controls and the live legend show and the
   server-drawn legend and "Same colors every week" step aside. Without an
   engine the page looks as before, plus the depth lines and spot labels. */

html:not(.sst-engine-on) .sst-page .sstc-engine { display: none !important; }
html:not(.sst-engine-on) .sst-page #sst-legend-live { display: none; }
html.sst-engine-on .sst-page #legend-container { display: none; }
html.sst-engine-on .sst-page #lock-scale { display: none !important; }

/* ---- The panel (sidebar; inside the drawer on phones and tablets) ---- */
.sst-color-panel { margin: 0; }
.sst-color-panel .sstc { border-top: 1px solid rgba(30, 41, 59, 0.5); margin-top: 1rem; padding-top: 1rem; }
.sstc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.55rem; }
.sstc-chip {
    min-height: 28px;
    padding: 0.2rem 0.7rem;
    border: 1px solid #3a4757;
    border-radius: 100px;
    background: #1b2531;
    color: #cfd8e3;
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
}
.sstc-chip:hover { background: #243244; color: #ffffff; }
.sstc-chip.active, .sstc-chip[aria-checked="true"] {
    background: #0183fe;
    border-color: #0183fe;
    color: #ffffff;
    font-weight: 700;
}
.sstc-chip:focus-visible, .sstc-pm:focus-visible, .sstc-val:focus-visible, .sstc-fit:focus-visible {
    outline: 2px solid #7cc0ff;
    outline-offset: 2px;
}

.sstc-custom { margin: 0 0 0.5rem; }
.sstc-custom[hidden] { display: none; }
.sstc-step { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.sstc-step-label { flex: 1 1 auto; color: #94a3b8; font-size: 0.75rem; }
.sstc-pm {
    flex: none;
    width: 30px;
    height: 28px;
    border: 1px solid #475569;
    border-radius: 100px;
    background: transparent;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}
.sstc-pm:hover { background: #1e293b; }
.sstc-val {
    flex: none;
    min-width: 3.6rem;
    text-align: center;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 4px;
}

.sstc-range { margin-bottom: 0.25rem; color: #94a3b8; font-size: 0.72rem; line-height: 1.3; }
.sstc-range-val { color: #ffffff; font-size: 0.85rem; font-weight: 700; margin-right: 0.15rem; }
.sstc-bar { position: relative; min-height: 34px; margin: 0.15rem 0 0.55rem; }

/* color bar pieces, shared by the panel and the map legend */
.sstc-hist { display: block; width: calc(100% - 22px); height: 20px; margin: 0 11px 2px; }
.sstc-hist polygon { fill: rgba(204, 217, 230, 0.28); stroke: rgba(204, 217, 230, 0.6); stroke-width: 0.5; vector-effect: non-scaling-stroke; }
.sstc-ramprow { display: flex; align-items: center; height: 12px; }
.sstc-ramp { flex: 1 1 auto; height: 12px; }
.sstc-tri { flex: none; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.sstc-tri.lo { border-right: 11px solid #3d358b; }
.sstc-tri.hi { border-left: 11px solid #7a0403; }
.sstc-ticks { position: relative; height: 18px; margin: 0 11px; }
.sstc-tick { position: absolute; top: 0; width: 1px; height: 3px; background: #94a3b8; transform: translateX(-0.5px); }
.sstc-tick.major { height: 5px; background: #cfd8e3; }
.sstc-num { position: absolute; top: 5px; transform: translateX(-50%); color: #e2e8f0; font-size: 0.68rem; line-height: 1.1; }

.sstc-fit { width: 100%; margin-bottom: 0.5rem; }
.gotone-sidebar .sstc-fit.active { background-color: #1e293b !important; border-color: #0183fe !important; color: #ffffff !important; }

.sstc-toggles .form-check { margin-bottom: 0.15rem; }
.sstc-toggles .form-check-label { line-height: 1.25; }
.sstc-hint { color: #7d8ea3; font-size: 0.7rem; }

/* ---- The live legend on the map (#sst-legend-live) ---- */
.sstl .sstl-bar { margin-top: 0.3rem; }
.sstl .sstc-num { color: #cbd5e1; }

/* ---- Map: the dark basemap's place names, depth lines, spot labels ---- */
/* Leaflet 1.9 draws tiles with mix-blend-mode: plus-lighter; on a translucent label layer that lights up every
   tile edge (CLAUDE.md, Dash + Custom JS Gotchas). */
#sst-map .leaflet-sst-labels-pane-pane img.leaflet-tile { mix-blend-mode: normal; }
#sst-map .sst-depth-canvas, #sst-map .sst-spotlabel-canvas { pointer-events: none; }
.sst-page .sst-legend-box .sst-legend + .sst-gfw-note { margin-top: 4px; }

/* ---- Touch screens and phones: 44 px targets ---- */
@media (hover: none) and (pointer: coarse), (max-width: 767.98px), (max-height: 500px) {
    .sstc-chip { min-height: 44px; padding: 0.3rem 0.95rem; font-size: 0.85rem; }
    .sstc-pm { width: 44px; height: 44px; font-size: 1.15rem; }
    .sstc-step-label { font-size: 0.8rem; }
    .sstc-val { font-size: 0.95rem; }
    .sstc-toggles .form-check-label { flex-wrap: wrap; column-gap: 0.35rem; padding: 0.35rem 0; }
    .sstc-num { font-size: 0.72rem; }
}
/* Phones: the compact legend at the top centre */
@media (max-width: 767.98px), (max-height: 500px) {
    .sst-page .sstl { width: 196px; }
    /* the longer attribution (dark basemap + depth source) in two lines under the play bar, not three beside it */
    .sst-page .leaflet-control-attribution { max-width: calc(100vw - 8px); }
    .sstl .sstc-ticks { height: 16px; }
}
