/* The weather display: a device rebuilt in the browser.

   This is the module's own styling and it travels with the module - the package the core
   fetches from it consists of its frontend assembly and this file. Until 2026-08-14 it
   stood in the toolkit's paula.css, where it never belonged: the toolkit delivers tools,
   never meaning, and a device's optics are meaning.

   The template is the froggit display: every measurement stands there as a variable and
   every decision as a comment beside it. What is to be changed here is discussed THERE
   first. */

/* --- the history page: what to compare, over which period ---------------- */

/* two rows: the three fields, then the rooms. A field is its label above its controls - a
   narrow window moves whole fields, never a label without its field */
.history-bar { display: flex; flex-direction: column; gap: var(--s4); margin-bottom: var(--s4); }

.history-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s5); }

.history-field { display: flex; flex-direction: column; gap: var(--s1); }

/* every label of the bar in the one small grey of the platform's fields */
.history-field > span, .history-label { font-size: var(--fs-sm); color: var(--text-muted); }

/* the controls of one height, so the three fields line up along their lower edge */
.history-row select, .history-row .btn, .history-row .filter-date
{
    height: 30px;
    box-sizing: border-box;
    font-size: var(--fs-sm);
}

.history-row .btn-icon { width: 30px; }

.history-picks { display: flex; flex-wrap: wrap; gap: var(--s1); }

.history-range { display: flex; align-items: center; gap: var(--s2); }

.history-channels { align-items: center; gap: var(--s3); }

/* "all on" and "all off" stay together, never one of them alone on the next line */
.history-switch { display: inline-flex; gap: var(--s1); white-space: nowrap; }

.history-channel { display: flex; align-items: center; gap: var(--s2); }

/* the dot carries the curve's colour - that is the legend, next to the switch */
.history-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* the tokens of the dark surface. They are set HERE and not in the module, because the
   chart reads its colours off its container - that is how one chart implementation fits
   a bright page and a dark display */
.tft
{
    display: grid; grid-template-columns: 1fr 1fr;
    background: #05060a; border-radius: var(--radius);
    color: #d6e6ff;
    font-size: var(--fs-base);

    /* its own tokens, NOT overridden platform ones: the anchor popovers are children of
       this box and would inherit dark-surface colours onto a white card */
    --tft-line: #565b66;   /* the grey separators - channels, clock, middle axis */
    --tft-grid: #2a3040;   /* the raster inside the graph, clearly weaker than those */
    --tft-muted: #8fa8d6;  /* axis numbers, refresh line */
    --tft-white: #ffffff;  /* the readings themselves */

    --tft-w-line: 2px;     /* the grey separators; the raster stays at one pixel */

    --tft-fs-value: 34px;  /* the big figure of a channel */
    --tft-fs-unit: 17px;   /* °C / % beside it */
    --tft-fs-chno: 22px;   /* "CH 1" - label and number share a line, so they match */
    --tft-fs-name: 15px;   /* channel name above its figure */
    --tft-fs-head: 15px;   /* the two column headings */
    --tft-fs-title: 17px;  /* the graph title */
    --tft-fs-clock: 17px;
    --tft-fs-refresh: 13px;
    --tft-fs-legend: 12px;

    /* the edge where everything on the left begins. --tft-plot-left is the same value as
       PAD.left in chart.js: there the drawing area starts, and the title stands over the
       drawing area, not over the axis numbers */
    --tft-x-plot: 0px;
    --tft-plot-left: 46px;

    --anchor-hover: rgba(120, 170, 255, .20);
}

/* the chart reads its colours off its container. Set HERE, on the chart alone, so nothing
   else inherits them */
.tft-plot .chart { --text: #d6e6ff; --text-muted: #8fa8d6; --border: #565b66; --grid: #2a3040; }

/* the left side is a column: title, graph, clock, refresh. The graph gets what the other
   three leave over - it is half the view and must not stick to the top as a strip while
   surface stays empty below. On the right only enough room that the legend does not touch
   the separator; every point more is missing from the graph */
.tft-left { padding: 10px 6px 12px 12px; display: flex; flex-direction: column; }

/* no rule ever touches another: every line keeps its distance at both ends, the way the
   device draws them. That is why they are pseudo elements and not borders */
.tft-right { position: relative; }

.tft-right::before
{
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
    border-left: var(--tft-w-line) solid var(--tft-line);
}

.tft-graph-title { font-size: var(--tft-fs-title); padding-left: var(--tft-plot-left); }

/* graph and legend are TWO columns - so the drawing never reaches into the legend */
.tft-graph
{
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
    flex: 1; min-height: 0;
}

/* the chart lies in this box and measures it - a fixed height would squeeze it over its
   aspect ratio and leave surface empty below */
.tft-plot { position: relative; min-width: 0; }

.tft-plot > .chart { position: absolute; inset: 0; }

/* centred but airy - not stretched over the whole height, or CH1 stands in the sky and
   CH8 in the cellar */
.tft-legend
{
    display: flex; flex-direction: column; justify-content: center; gap: 14px;
    font-size: var(--tft-fs-legend); padding-bottom: 16px;
}

.tft-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

/* a filled dot, not a ring */
.tft-legend i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }

/* echarts draws the axes, so the anchors lie ON them - invisible until the pointer
   arrives, exactly like every other anchor. The measurements follow PAD in chart.js */
.tft-axis-y { position: absolute; left: 0; top: 0; bottom: 16px; width: 44px; z-index: 3; }

.tft-axis-x { position: absolute; left: 44px; right: 2px; bottom: 0; height: 16px; z-index: 3; }

.tft-axis-y .anchor, .tft-axis-x .anchor { display: block; width: 100%; height: 100%; }

.tft-axis-hit { display: block; width: 100%; height: 100%; }

.tft-clock
{
    position: relative; margin-top: 12px;
    padding: 11px 4px 11px var(--tft-x-plot);
    font-size: var(--tft-fs-clock);
    display: flex; align-items: center; gap: var(--s2);
}

.tft-clock::before, .tft-clock::after
{
    content: ""; position: absolute; left: var(--tft-x-plot); right: 10px;
    border-top: var(--tft-w-line) solid var(--tft-line);
}

.tft-clock::before { top: 0; }
.tft-clock::after  { bottom: 0; }

.tft-refresh
{
    padding: 9px 11px 2px var(--tft-x-plot);
    font-size: var(--tft-fs-refresh); color: var(--tft-muted);
    display: flex; align-items: center;
}

/* the reload button ends the line at the right edge of the left column, where the
   separators above it end too - it is a control on a dark display, so it takes the
   display's colours instead of the page's */
.tft-refresh .btn-icon
{
    margin-left: auto; padding: 0; border: 0;
    background: transparent; color: var(--tft-muted);
}

.tft-refresh .btn-icon:hover { background: transparent; color: var(--tft-white); }
.tft-refresh .btn-icon svg { width: 16px; height: 16px; }

.tft-refresh .anchor, .tft-graph-title .anchor, .tft-name .anchor { display: inline-block; }

/* heading and the eight fields share one grid, so every figure stands under its
   heading - minmax(0,...) keeps a long name from pushing the columns apart */
.tft-head, .tft-ch
{
    display: grid; grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr);
    align-items: center; position: relative;
}

.tft-head { font-size: var(--tft-fs-head); }

.tft-head > span { padding: 6px 4px 6px 10px; }

/* the two rows are as high as their content and stand as a BLOCK in the middle - with
   align-items they share the 68 px in halves and tear name and figure apart */
.tft-ch { height: 68px; grid-template-rows: auto auto; align-content: center; }

.tft-head::after, .tft-ch::after
{
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 0;
    border-bottom: var(--tft-w-line) solid var(--tft-line);
}

.tft-ch:last-child::after { content: none; }

/* "CH 1" on ONE line - the number stands directly behind the label, both the same size */
.tft-chno
{
    display: flex; align-items: baseline; justify-content: center; gap: 6px;
    font-size: var(--tft-fs-chno); grid-row: span 2;
}

.tft-chno b { font-weight: 400; }

/* the name sits CLOSE above its figure - it belongs to that figure, not to the row above.
   It spans BOTH figures, so it may grow long, and starts where its figure starts */
.tft-name
{
    grid-column: 2 / 4; font-size: var(--tft-fs-name); line-height: 1.1;
    padding: 0 6px 0 10px; justify-self: start;
    min-width: 0; max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* while the field stands open the cell must not shorten it: the ellipsis is there for a
   long NAME, not for the box one types it into */
.tft-name:has(.anchor-open) { text-overflow: clip; }

/* the figures are left aligned and the unit travels with the number - lining them up on
   the decimal point was tried and dropped */
.tft-val { text-align: left; padding: 0 4px 0 10px; white-space: nowrap; line-height: 1.05; }

.tft-n
{
    font-size: var(--tft-fs-value); color: var(--tft-white);
    letter-spacing: -.5px; font-variant-numeric: tabular-nums;
}

.tft-u { font-size: var(--tft-fs-unit); color: var(--tft-white); padding: 0 3px; }

.tft-note { margin-top: var(--s3); }

/* one value in several places: hovering any of them lights them all, so how far the
   click reaches is visible before it happens */
.tft:has(.anchor-v1:hover) .anchor-v1,
.tft:has(.anchor-v2:hover) .anchor-v2,
.tft:has(.anchor-unit:hover) .anchor-unit { background: var(--anchor-hover); }
