/* Machhar analyst workspace. Full-height, map first, Maplore type.
   The level scale is the same four steps as the district view; blue for
   "more than usual", never amber (amber is Tiddi's locusts). */
:root {
  --paper: #f7f7f7; --ink: #1a1c1f; --ink-2: #4b4a46; --muted: #85837c; --rule: #e2e0da;
  --lv-top: #0d366b; --lv-high: #3987e5; --lv-usual: #d3d1ca; --lv-low: #cde2fb; --lv-none: #ecebe7;
  --sans: "Space Grotesk", system-ui, sans-serif; --mono: "Space Mono", ui-monospace, monospace; --serif: "DM Serif Display", Georgia, serif;
  --card: #ffffff; color-scheme: light;
}
/* Dark: chosen steps for a dark ground, not an inversion. "Lower than usual"
   and "no history" go darker so the blues still read as more / less. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1c1f; --ink: #ececee; --ink-2: #c3c2b7; --muted: #8a8a86; --rule: #2c2c2a;
    --lv-top: #9ec5f4; --lv-high: #3987e5; --lv-usual: #4a4a47; --lv-low: #1d3a5f; --lv-none: #26272a;
    --card: #202226; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

.ws { display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); height: 100dvh; }
.ws-body, .side, .side > section { min-width: 0; }
.side { grid-template-columns: minmax(0, 1fr); }
.side > section { grid-template-columns: minmax(0, 1fr); }
.ws-top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--rule); background: var(--card); }
.ws-top .mk { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; text-decoration: none; }
.ws-top .mk img { height: 20px; }
.ws-top .nm { font-family: var(--serif); font-style: italic; font-size: 21px; }
.ws-top .sp { flex: 1; }

.ws-body { display: grid; grid-template-columns: 440px 1fr; min-height: 0; }
.side { display: grid; grid-template-rows: none; grid-auto-rows: auto; align-content: start; min-height: 0; border-right: 1px solid var(--rule); background: var(--card); }
.side > section { padding: 16px 20px; border-bottom: 1px solid var(--rule); display: grid; gap: 10px; }
.side > section.s-weeks { gap: 8px; }


#summary .big { font-family: var(--serif); font-size: 26px; line-height: 1.1; margin: 0 0 6px; }
#summary p:not(.big) { margin: 0; color: var(--ink-2); line-height: 1.45; font-size: 14px; }

.side > section.filter { display: flex; align-items: center; gap: 12px; }
.filter .ui-select { flex: 1; min-width: 0; }
.filter .ct { font-size: 12px; color: var(--muted); white-space: nowrap; }

.listwrap { overflow: auto; min-height: 0; }
#list { list-style: none; margin: 0; padding: 0; }
#list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) 104px 80px; gap: 8px; align-items: center; padding: 9px 18px; border-bottom: 1px solid #f0efeb; cursor: pointer; }
#list li:hover { background: #fafaf8; }
#list li.on { background: #eef4fd; box-shadow: inset 3px 0 0 var(--lv-high); }
#list .r { font-family: var(--mono); font-size: 12px; color: var(--muted); }
#list .nm b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#list .nm small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#list .lv { font-size: 13px; }
#list .lv i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; }
#list .lv small { display: block; color: var(--muted); font-family: var(--mono); font-size: 11px; margin-left: 16px; }

/* The drawer sits beside the map, not over it: the unit being read stays in view. */
.stage { position: relative; min-height: 0; display: flex; }
.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }
.legend { position: absolute; left: 14px; bottom: 26px; background: color-mix(in srgb, var(--card) 94%, transparent); border: 1px solid var(--rule); padding: 8px 10px; font-size: 12px; display: grid; gap: 4px; }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -2px; }
.nomap { padding: 40px; color: var(--muted); }

#drawer { flex: 0 0 min(520px, 45%); background: var(--card); border-left: 1px solid var(--rule); overflow: auto; padding: 18px 22px 30px; }
#drawer[hidden] { display: none; }
.d-head { display: flex; align-items: start; gap: 10px; }
.d-head h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 0; line-height: 1.05; }
#d-sub { color: var(--muted); margin: 4px 0 14px; font-size: 13px; }
#d-level { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
#d-level i { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -1px; }
#d-say { color: var(--ink-2); line-height: 1.45; margin: 0 0 12px; }
#d-charts h4 { margin: 18px 0 4px; font-size: 13px; font-weight: 600; }
#d-charts h4 span { font-weight: 400; color: var(--muted); }
svg.ch { width: 100%; display: block; overflow: visible; }
svg.ch text { font: 10.5px var(--sans); fill: var(--muted); }
svg.ch .g { stroke: #efeee9; }
svg.ch .x { stroke: var(--muted); }
svg.ch .band { fill: #dfeafb; }
svg.ch .clim { fill: none; stroke: #a9a79f; stroke-width: 1.4; stroke-dasharray: 1 3; stroke-linecap: round; }
svg.ch .obs { fill: none; stroke: var(--lv-high); stroke-width: 1.6; }
svg.ch .fc { fill: none; stroke: var(--lv-high); stroke-width: 1.6; stroke-dasharray: 4 3; }
svg.ch .out { fill: none; stroke: var(--lv-high); stroke-width: 1.6; stroke-dasharray: 1.5 3; stroke-linecap: round; }
svg.ch .past { fill: none; stroke: #c9c7bf; stroke-width: 1; }
svg.ch .rain { fill: #9ec5f4; }
svg.ch .temp { fill: none; stroke: #b0662e; stroke-width: 1.2; }
svg.ch .term { fill: none; stroke: var(--ink-2); stroke-width: 1.2; }
.terms { margin-top: 16px; font-size: 13px; }
.terms summary { cursor: pointer; color: var(--ink-2); }
.terms p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.d-actions { margin-top: 18px; display: flex; gap: 10px; }

#tt { position: fixed; pointer-events: none; z-index: 50; background: var(--card); border: 1px solid var(--rule); padding: 7px 9px; font-size: 12px; line-height: 1.45; opacity: 0; max-width: 260px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
#tt span { color: var(--muted); }

#method-body p { line-height: 1.55; margin: 0 0 8px; color: var(--ink-2); }
#method-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
#method-body th, #method-body td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #efeee9; }
#method-body th { color: var(--muted); font-weight: 500; }
.news { list-style: none; padding: 0; margin: 0; }
.news li { padding: 7px 0; border-bottom: 1px solid #efeee9; font-size: 13px; }
.news li span { display: block; color: var(--muted); font-size: 11.5px; }

@media (max-width: 900px) {
  .ws { height: auto; }
  .ws-top { flex-wrap: wrap; gap: 10px 12px; }
  .ws-top .sp { display: none; }
  .ws-body { grid-template-columns: minmax(0, 1fr); }
  .stage { flex-direction: column; }
  .mapwrap { height: 60vh; flex: none; }
  #drawer { flex: none; border-left: 0; border-top: 1px solid var(--rule); }
  .ws-body { grid-template-columns: 1fr; }
  .stage { height: 60vh; }
  .side { border-right: 0; }
  .listwrap { max-height: 60vh; }
  .ws-top { flex-wrap: wrap; }
}

/* Week scrubber: one track, each week a two-line cell (date, kind). */
.weeks { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; background: var(--ui-track); border-radius: 10px; }
.weeks button { display: grid; gap: 1px; justify-items: center; padding: 6px 2px; border: 0; border-radius: 7px; background: transparent; font: inherit; color: var(--ui-ink-2); cursor: pointer; transition: background-color .15s, box-shadow .15s; min-width: 0; }
.weeks button b { font-size: 16px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.weeks button span { font-size: 11px; color: var(--ui-muted); }
.weeks button.now b::after { content: ""; display: block; width: 4px; height: 4px; border-radius: 50%; background: var(--lv-high); margin: 3px auto 0; }
.weeks button:hover { color: var(--ui-ink); }
.weeks button[aria-selected="true"] { background: var(--ui-surface); color: var(--ui-ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px rgb(0 0 0 / .04); }
.weeks button:focus-visible { outline: 2px solid var(--ui-ink); outline-offset: 1px; }
.weeks button.k-outlook b { font-weight: 500; color: var(--ui-ink-2); }
.week-kinds { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 0 3px; }
.week-kinds span { font-size: 11px; color: var(--ui-muted); text-align: center; padding-top: 5px; border-top: 2px solid var(--ui-rule-strong); margin: 0 3px; }
.week-kinds .k-forecast { border-top-style: dashed; }
.week-kinds .k-outlook { border-top-style: dotted; }
#method-body > section + section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--ui-rule); }
.m-title { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 0; }
#method-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; font-weight: 500; }
#method-body h3:first-child { margin-top: 0; }
.d-head { justify-content: space-between; }

/* Under the Maplore chrome. The list takes whatever height is left. */
.side { display: flex; flex-direction: column; }
.side > .listwrap { flex: 1 1 auto; min-height: 0; }
.s-dz .ui-seg { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s-dz .ui-seg a { text-align: center; }
