/* Layer panel (panel.js). Colours share names with the "Story UI"
   variables in Figma (panel/bg there is --panel-bg here). */
:root { --chevron-right: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 6l6 6l-6 6'/></svg>"); /* Tabler chevron-right, drawn with a mask in the colour of the text */ --panel-bg: #ffffff;    }
.layer-panel {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  display: flex; flex-direction: column; gap: 16px; width: 294px; /* the cards under the product name, 10 px from the edge (Figma comment, Nov 19) */
  font: var(--fs-14)/1.4 Inter, system-ui, sans-serif; color: var(--text);
}
/* A white card over the map: the layer panel's cards, and the EM page's legend and flood boxes */
.panel-card {
  font: var(--fs-14)/1.4 Inter, system-ui, sans-serif; color: var(--text);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panel-bg) 95%, transparent); border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}
:is(.layer-panel, .map-legend) .title { margin: 0 0 4px; font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
:is(.layer-panel, .flood-control) .layer-title { margin: 0 0 8px; font-size: var(--fs-12); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); }
:is(.layer-panel, .flood-control) .layer-title[hidden] { display: none; }
.layer-panel section + section { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
:is(.layer-panel, .map-legend) label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
:is(.layer-panel, .flood-control) .advance { margin-top: 6px; }
:is(.layer-panel, .flood-control) .advance[hidden] { display: none; }
/* The flood layers as tabs along the foot of the card: the one on show is
   open to the legend above, the others are tinted */
:is(.layer-panel, .flood-control) .segmented.button-group { display: flex; width: auto; margin: 16px -12px -10px; overflow: hidden; border-radius: 0 0 var(--radius-l) var(--radius-l); }
:is(.layer-panel, .flood-control) .segmented .btn[data-variant] { flex: 1; height: 32px; border: 0; border-radius: 0 !important; background: var(--tint); color: var(--text); font-size: 13px; /* between the scale's steps on purpose */ }
:is(.layer-panel, .flood-control) .segmented .btn[data-variant]:hover { background: var(--tint-hover); }
:is(.layer-panel, .flood-control) .segmented .btn[data-variant][aria-pressed="true"] { position: relative; z-index: 1; background: transparent; box-shadow: 0 0 4px rgba(0, 0, 0, 0.09); }
:is(.layer-panel, .flood-control) .segmented .btn[aria-pressed="false"] + .btn[aria-pressed="false"] { box-shadow: inset 1px 0 0 var(--line-button); }
:is(.layer-panel, .flood-control) .segmented .btn:focus-visible { outline-offset: -2px; }
/* Basecoat buttons used as toggles (aria-pressed): the pressed one is tinted */
.btn[data-variant][aria-pressed="true"], .btn[data-variant][aria-pressed="true"]:hover { background-color: var(--tint); color: var(--text); cursor: default; }
.btn[data-variant][aria-pressed="true"]:active { translate: none; }
/* Stepped scale for depth and velocity (legend("depth"), legend("velocity")) */
.legend .scale { flex: 1 1 100%; padding: 2px 0 0; }
.legend .scale .bar { display: flex; gap: 1px; height: 10px; }
.legend .scale .bar i { flex: 1; width: auto; height: auto; border-radius: 0; }
.legend .scale .bar i:first-child { border-radius: 2px 0 0 2px; }
.legend .scale .bar i:last-child { border-radius: 0 2px 2px 0; }
.legend .scale .ticks { position: relative; height: 14px; margin-top: 2px; font-size: var(--fs-12); color: var(--text-2); }
.legend .scale .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend .scale .ticks span:last-child { transform: translateX(-30%); }
/* Impact tiers: stacked blocks with a 7 px bar in the tier colour (tierLegend in panel.js; story 4's map legend too) */
.tier-legend { display: flex; flex-direction: column; gap: 1px; margin-top: 10px; }
.tier-item { display: flex; flex-direction: column; gap: 4px; position: relative; padding: 6px 8px 6px 15px; font: var(--fs-14)/1.25 Inter, system-ui, sans-serif; }
.tier-item[hidden] { display: none; }
/* The 7 px bar in the tier colour; the first and last one showing have rounded ends */
.tier-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--bar); }
.tier-item:not([hidden]):not(.tier-item:not([hidden]) ~ *)::before { border-radius: 2px 2px 0 0; }
.tier-item:not([hidden]):not(:has(~ .tier-item:not([hidden])))::before { border-radius: 0 0 2px 2px; }
.tier-item:not([hidden]):not(.tier-item:not([hidden]) ~ *):not(:has(~ .tier-item:not([hidden])))::before { border-radius: 2px; }
.tier-item strong { font-weight: 600; color: #000000; }
.tier-item span { color: var(--text-2); }
/* Heading row with a switch on the right (one impacts toggle); the whole row is the label */
:is(.layer-panel, .map-legend) .group-head { justify-content: space-between; min-height: 24px; margin: -4px 0; }
/* With every tier hidden (switch off) the legend takes no room */
.layer-panel .tier-legend:not(:has(.tier-item:not([hidden]))) { display: none; }
:is(.layer-panel, .map-legend) .group-head .title { margin: 0; }
/* Outlined track, filled knob: grey and left when off, slate and right when on */
:is(.layer-panel, .map-legend) .switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 26px; height: 14px; margin: 0; border-radius: 7px; background: none; cursor: inherit;
  box-shadow: inset 0 0 0 1px var(--line-button);
}
:is(.layer-panel, .map-legend) .switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--line-control); transition: transform 0.15s ease, background 0.15s ease;
}
:is(.layer-panel, .map-legend) .switch:checked::before { transform: translateX(12px); background: var(--segment-bg, var(--selected)); }

/* Time slider (timeline.js; Figma 559:388): the track with the played part and a grabber, the breach marked
   by a red line running below the track to its "Breach" label, the time right of the playhead (left of the slider once it no longer fits), play button beside */
.timeline-row { display: flex; align-items: flex-start; gap: 4px; margin-top: 6px; }
.timeline { --f: 0; --b: 0.5; position: relative; flex: 1; min-width: 0; height: 32px; margin-bottom: 18px; }
.timeline .breach-label { position: absolute; left: calc(10px + var(--b) * (100% - 20px) + 6px); top: 35px; font-size: var(--fs-12); line-height: 16px; color: var(--text-2); white-space: nowrap; }
.timeline .track { position: absolute; inset: 0; border-radius: var(--radius-m); background: #e5eef3; }
.timeline .fill { position: absolute; left: 0; top: 0; bottom: 0; box-sizing: border-box; width: calc(10px + var(--f) * (100% - 20px)); border: 1px solid #96b7c8; border-radius: 4px 0 0 4px; background: #acd1e4; }
.timeline .grabber { position: absolute; right: -10px; top: -1px; bottom: -1px; width: 20px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid #96b7c8; border-radius: var(--radius-m); background: #ffffff; z-index: 2; }
.timeline .grabber b { width: 2px; height: 15px; border-radius: 9px; background: #778593; }
.timeline .breach-line { position: absolute; left: calc(10px + var(--b) * (100% - 20px) - 1px); top: 0; bottom: -17px; width: 2px; background: #d12b2b; z-index: 1; }
.timeline .clock-time { position: absolute; right: 8px; top: 0; line-height: 32px; font: 400 var(--fs-14)/32px Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--text); pointer-events: none; z-index: 1; }
.timeline.text-left .clock-time { right: auto; left: 8px; }
.timeline input.time { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; background: transparent; }
.timeline input.time::-webkit-slider-runnable-track { height: 32px; background: transparent; }
.timeline input.time::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 32px; }
.timeline input.time::-moz-range-track { height: 32px; background: transparent; }
.timeline input.time::-moz-range-thumb { width: 20px; height: 32px; border: 0; }
.timeline-row .btn.play { flex: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line-button); border-radius: var(--radius-button); background: #ffffff; color: var(--text); box-shadow: none; }
.timeline-row .btn.play:hover { background: var(--surface); }
.timeline:has(input.time:focus-visible) .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.timeline-row .btn.play svg { width: 11px; height: 12px; flex: none; } /* Basecoat sizes button icons at 16px; these are 11 x 12 */

/* USACE step 2: the flood slider alone (story.js setTransition) */
.layer-panel.slider-only .segmented, .layer-panel.slider-only .panel-card:not(:first-child) { display: none; }
.timeline input.time:disabled { cursor: default; }
