/* Rain distributions page. Builds on style.css (tokens, top bar, theme switch, type, table).
   The three compare slot colours mark lines, dots and swatches only, never text. */
:root { --cmp-1: #2a78d6; --cmp-2: #d95926; --cmp-3: #199e70; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cmp-1: #3987e5; } }
:root[data-theme="dark"] { --cmp-1: #3987e5; }
.slot-1 { --c: var(--cmp-1); }
.slot-2 { --c: var(--cmp-2); }
.slot-3 { --c: var(--cmp-3); }

.dist { padding-top: 28px; }
.dist h1 { font-size: clamp(44px, 9vw, 72px); }
.dist .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; margin: 0 0 16px; min-width: 0; }
/* Headings inside panels stay in sentence case, in the text face */
.panel h2 { margin: 0 0 12px; padding: 0; border: 0; font: 700 17px/1.3 var(--sans); text-transform: none; letter-spacing: 0; }

/* Controls */
.label { font-size: 14px; color: var(--muted); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 20px 0 16px; }
/* Each control group is one line: its label, then its keys */
.controls { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 12px; }
.field { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.field .label { flex: none; min-width: 56px; line-height: 44px; }
.keypad { display: flex; flex-wrap: wrap; gap: 6px; }
.keypad button { min-height: 44px; min-width: 56px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); font: 600 15px/1.1 var(--sans); cursor: pointer; }
.keypad button:hover { border-color: var(--ink); }
.keypad button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* Tasks table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.table-wrap th, .table-wrap td { vertical-align: middle; }
td.pick-cell { padding: 0 8px; width: 60px; }
td.task-cell { min-width: 220px; }
.task-cell .name { font-weight: 600; }
.task-cell .id { display: block; font: 500 13px/1.4 var(--mono); color: var(--muted); }
.pick { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-ctl); background: transparent; cursor: pointer; }
.pick i { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-radius: 2px; }
.pick[aria-pressed="true"] i { background: var(--c); border-color: var(--c); }
.pick:disabled { cursor: default; }
.pick:disabled i { opacity: .4; }
/* Phones: each task is a card, with its values in labelled columns under its name */
@media (max-width: 799px) {
  .table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .table-wrap table, .table-wrap tbody { display: block; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-wrap tr { display: grid; grid-template-columns: 44px minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
  .table-wrap td { padding: 0; border: 0; }
  td.pick-cell { grid-row: span 3; width: auto; padding: 0; }
  td.task-cell { grid-column: 2 / -1; min-width: 0; }
  td.num::before { content: attr(data-label); display: block; font: 400 12px/1.4 var(--sans); color: var(--muted); }
  td.num:last-child { grid-column: 2 / -1; }
  td.num:last-child::before { display: inline; margin-right: 8px; }
}

/* Chart panels */
.pair { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 16px; }
@media (min-width: 900px) { .pair { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 14px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; flex: none; width: 16px; height: 3px; border-radius: 1px; background: var(--c); }
.task-line .sw { margin-right: 6px; vertical-align: middle; }

/* Charts: SVG drawn by distributions.js; every colour is a token */
.plot { position: relative; touch-action: pan-y; }
.plot svg { display: block; touch-action: pan-y; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .axis { stroke: var(--line-strong); stroke-width: 1; }
.plot .rule { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 3; }
.plot .tick { fill: var(--muted); font: 500 11px var(--mono); font-variant-numeric: tabular-nums; }
.plot .title { fill: var(--muted); font: 400 12px var(--sans); }
.plot .year { fill: var(--ink); font: 500 12px var(--mono); font-variant-numeric: tabular-nums; }
.plot .split-label { fill: var(--muted); font: 400 12px var(--sans); }
.plot .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; }
.plot .end { fill: var(--ink); font: 600 12px var(--sans); }
.plot .cursor { stroke: var(--ink); stroke-width: 1; }
.plot .dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.plot .band { fill: var(--surface-2); }
.plot .range { stroke: var(--line-strong); stroke-width: 2; }
.mark { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.legend-row .mark { stroke: none; }
/* Chart 3: the names lie over the SVG and set each row's height (name lines plus a 26 px dot track). */
.plot svg.under { position: absolute; top: 0; left: 0; }
.task-names { position: relative; padding-bottom: 44px; pointer-events: none; }
.task-line { margin: 0; padding: 2px 0 24px; font-size: 14px; line-height: 20px; }

.readout-box { margin-top: 8px; font-size: 13px; line-height: 1.5; }
.readout-box p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.readout-box .head { font-weight: 600; }
.readout-box .val { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Definitions */
.defs dl { display: grid; gap: 4px 16px; margin: 0; }
@media (min-width: 600px) { .defs dl { grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; } }
.defs dd + dt { margin-top: 8px; }
@media (min-width: 600px) { .defs dd + dt { margin-top: 0; } }
.defs dt { font-weight: 700; }
.defs dd { margin: 0; }
.defs code { font: 500 13px var(--mono); }
