/* "Map & Analysis" (js/explore/explore.js). One quiet control bar over a large map; the only loud element
   is the Synthesis button. The right panel follows the state (Start / source / Synthesis / area). */

.work-title { margin: 0; font-size: var(--fs-14); font-weight: 800; color: var(--text); letter-spacing: .2px; }
.ws-research .work-title { color: var(--warn); }

.ex { display: flex; flex-direction: column; min-height: 0; }
.ex-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 8px 12px 10px; background: var(--panel); border-bottom: 1px solid var(--border); }
.ex-field { display: grid; gap: 3px; min-width: 0; }
.ex-field-l { font-size: var(--fs-11); color: var(--muted); font-weight: 600; }
.ex-spacer { flex: 1 1 0; }
.ex-field.is-dim .ex-select { opacity: .6; }
.ex-select { background: var(--bg-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 30px 7px 10px; font: 600 13px/1.2 var(--font); min-height: 36px; max-width: 100%;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ex-select:hover { border-color: var(--accent-2); }

.ex-phases { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; min-height: 36px; }
.ex-phase { display: grid; gap: 1px; text-align: left; padding: 4px 12px; background: var(--bg-2); color: var(--text-2); border: 0; font: inherit; min-width: 104px; cursor: pointer; }
.ex-phase + .ex-phase { border-left: 1px solid var(--border-strong); }
.ex-phase-l { font-size: 12.5px; font-weight: 700; }
.ex-phase-d { font-size: var(--fs-11); color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-phase:hover:not(:disabled):not(.is-info) { background: var(--panel-2); color: var(--text); }
.ex-phase.is-on { background: var(--panel-3); color: var(--text); box-shadow: inset 0 -3px 0 var(--accent); }
.ex-phase.is-on .ex-phase-d { color: var(--text-2); }
/* audit 14/11: opacity .5 dropped "no image" to ~2.6:1; muted text on a hatched ground stays readable (~6:1) */
.ex-phase:disabled, .ex-phase.is-off { cursor: not-allowed; color: var(--muted);
  background: repeating-linear-gradient(135deg, transparent 0 6px, #ffffff08 6px 12px), var(--bg-2); }
.ex-phase:disabled .ex-phase-d, .ex-phase.is-off .ex-phase-d { font-style: italic; color: var(--muted); }
.ex-phase.is-info { cursor: default; }
/* Synthesis: the phases are read-only facts ("images used for the result"), not two selected buttons */
.ex-phase.is-info.is-on { background: var(--bg-2); box-shadow: inset 0 -2px 0 #22d3ee80; }
/* the strip clips (overflow:hidden): draw the focus ring inside the button */
.ex-phase:focus-visible { outline-offset: -3px; }
.ex-phase-none { align-self: center; padding: 0 12px; font-size: 12px; color: var(--muted); }

.ex-synth { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 20px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--accent); background: transparent; color: var(--accent); font: 800 15px/1 var(--font); letter-spacing: .3px; }
.ex-synth:hover { background: #22d3ee1f; }
.ex-synth[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 0 0 4px #22d3ee2e; }
.ex-synth-ico { font-size: 12px; }

.ex-map { position: relative; flex: 1 1 auto; min-height: 280px; }
.ex-map > .map { position: absolute; inset: 0; }
.ex-legend { position: absolute; left: 10px; bottom: 24px; z-index: 650; max-width: min(300px, calc(100% - 20px)); background: #10243af0; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: var(--fs-12); }
.ex-legend .ml-title { margin: 0 0 6px; font-weight: 700; }
.ex-ramp { height: 12px; border-radius: 3px; border: 1px solid var(--border); min-width: 180px; }
.ex-busy { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 700; background: var(--panel); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; box-shadow: var(--shadow); }
.ex-busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; vertical-align: -1px; animation: ex-spin .8s linear infinite; }
@keyframes ex-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ex-busy::before { animation: none; } }
.ex-map .cmp-label { top: 54px; }
.ex-pointing, .ex-pointing .leaflet-interactive { cursor: crosshair !important; }

.swatch-veil { border: 1px dashed var(--muted); }
.swatch-hatch { background: repeating-linear-gradient(45deg, #a0a8b4 0 2px, transparent 2px 6px) !important; border: 1px solid var(--muted); }

/* ---- right panel */
.ex-panel { display: grid; gap: 12px; font-size: 13px; }
.ex-lead { margin: 0; color: var(--text-2); line-height: 1.5; }
.ex-sec { display: grid; gap: 6px; }
.ex-h3 { margin: 0; font-size: 12.5px; font-weight: 800; color: var(--text); }
.ex-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); line-height: 1.45; }
.ex-steps b { color: var(--text); }
.ex-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-link { background: none; border: 0; padding: 0; color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; font: inherit; cursor: pointer; }
.ex-link:hover { color: var(--accent); }
.ex-foot { display: grid; gap: 4px; justify-items: start; border-top: 1px solid var(--border); padding-top: 8px; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ex-chip { border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-2); border-radius: var(--radius-sm); padding: 4px 9px; font: 600 12px/1.3 var(--font); cursor: pointer; }
.ex-chip:hover { border-color: var(--accent-2); color: var(--text); }
.ex-chip.is-on { border-color: var(--accent); color: var(--text); background: var(--panel-3); }
.ex-research { margin-top: 4px; }
.ex-research > summary, .ex-more > summary, .ex-compare > summary, .ex-chart > summary { cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--text-2); }
.ex-research > summary { font-weight: 600; color: var(--warn); }
.ex-compare { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg-2); display: grid; gap: 8px; }
.ex-compare[open] { border-color: var(--border-strong); }
.ex-cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex-cmp-grid label { display: grid; gap: 3px; font-size: 11.5px; color: var(--muted); }
.ex-cmp-grid .ex-select { width: 100%; font-size: 12px; }
.ex-kv td { text-align: right; }
.ex-kv th { white-space: nowrap; }
.ex-files { margin: 4px 0 0; padding-left: 16px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.ex-warn { margin: 0; padding-left: 18px; color: var(--warn); font-size: 12px; }
.ex-bullets { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--text-2); }
.ex-tip { font-size: 12px; color: var(--text-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 8px 10px; }
.ex-svg { color: var(--muted); }

/* 5 classes: checkbox · swatch · name/code · area */
.ex-classes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ex-class { display: flex; align-items: center; gap: 8px; border-radius: 6px; padding: 4px 6px; }
.ex-class:hover { background: var(--panel-2); }
.ex-class input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; margin: 0; }
.ex-class label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.ex-class-t { display: grid; flex: 1; min-width: 0; }
.ex-class-t b { font-size: 12.5px; font-weight: 700; color: var(--text); }
/* wraps instead of ellipsis: the cut-off part was the honesty note ("not 'not flooded'") */
.ex-class-t small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; line-height: 1.35; }
.ex-class-v { display: grid; justify-items: end; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ex-class-v small { color: var(--muted); font-size: 10.5px; }
.ex-class.is-nodata { border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 6px; }
.ex-class input:not(:checked) + label .ex-class-t b { color: var(--muted); text-decoration: line-through; text-decoration-color: #8ba3b880; }

/* hotspots (T054): numbered amber markers — amber, not cyan (cyan = the user's own selection) */
.ex-hot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #ffd166; color: #1b1300; font: 800 12px/1 var(--font); border: 2px solid #071426; box-shadow: 0 1px 4px #0008; }
.leaflet-marker-icon.ex-hot { margin: 0; }
.ex-hot-sw { width: 20px; height: 20px; font-size: 10.5px; flex: none; }
.ex-hotlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.ex-hotrow { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 6px; color: var(--text-2); font: inherit; cursor: pointer; }
.ex-hotrow:hover { background: var(--panel-2); color: var(--text); }
.ex-hotrow.is-on { border-color: var(--accent); color: var(--text); }
.ex-hotrow:focus-visible { outline-offset: -2px; }   /* inside the scrolling list, an outer ring is clipped */
.ex-hotrow .ex-hot { width: 20px; height: 20px; font-size: 10.5px; flex: none; }
.ex-hot-n { flex: 1; }
.ex-hot-v { font-variant-numeric: tabular-nums; font-size: 12px; }

/* area analysis */
.ex-place { border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; background: #22d3ee0d; display: grid; gap: 8px; }
.ex-place-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ex-place-name { margin: 0; font-weight: 700; color: var(--text); }
.ex-verdict { margin: 0; font-weight: 700; color: var(--text); border-left: 3px solid var(--border-strong); padding-left: 8px; }
.ex-verdict.is-new { border-left-color: var(--cls-new); }
.ex-cls-table caption { text-align: left; font-size: 11px; color: var(--muted); padding-bottom: 2px; }
.ex-cls-table th { display: flex; align-items: center; gap: 6px; }

/* workbar in the two workspace modes */
.ws-explore .wtabs { display: none; }
#page-analysis.ws-research .stage { border-color: #f2b54466; }

.ex-bar, .ex-panel { touch-action: manipulation; }
/* visible reason for a phase without images (for the JS fix: title-only text is invisible on touch/keyboard) */
.ex-phase-why { flex-basis: 100%; margin: -6px 0 0; font-size: var(--fs-11); color: var(--muted); line-height: 1.4; }

/* touch: 44 px hit areas (chips were 26 px, rows 30 px, checkboxes 16 px, small buttons 28 px) */
@media (pointer: coarse) {
  .ex-chip, .ex-panel .btn-sm, .ex-hotrow, .ex-class { min-height: 44px; }
  .ex-chip { padding: 6px 12px; }
  .ex-class input { width: 20px; height: 20px; }
  .ex-link { padding: 10px 0; }
  .ex-research > summary, .ex-more > summary, .ex-compare > summary, .ex-chart > summary { padding: 10px 0; }
}

/* small maps (tablet / phone): the legend covered 28–30 % of the map; keep it compact */
@media (max-width: 1100px) {
  .ex-legend { left: 6px; bottom: 18px; padding: 6px 8px; font-size: 11px; max-width: min(230px, calc(100% - 60px)); }
  .ex-legend .ml-title { margin-bottom: 4px; }
  .ex-legend .legend-items { gap: 1px; }
  .ex-legend .legend-items li { gap: 6px; line-height: 1.25; }
  .ex-legend .swatch { width: 10px; height: 10px; }
  .ex-ramp { min-width: 140px; }
}

@media (max-width: 720px) {
  .ex-bar { gap: 8px; }
  .ex-map { min-height: 360px; }
  .ex-field, .ex-field-phase { width: 100%; }
  .ex-phases { width: 100%; }
  .ex-phase { flex: 1 1 0; min-width: 0; padding: 4px 8px; }
  .ex-synth { width: 100%; justify-content: center; }
  .ex-spacer { display: none; }
  .ex-cmp-grid { grid-template-columns: 1fr; }
}
