/* Weather Forecast — kabdalis2 design system.
   .kabdalis-weather-forecast-widget is the JS-locked wrapper. view.js injects
   .wf + .b-card/.wf--bare, wraps title in .wf__head with .b-kicker "Prognos",
   loads Chart.js and renders a temperature line + precipitation bars on the
   <canvas>. Weather-symbol overlay built dynamically over each day column.
   JS-locked: .weather-forecast-chart (canvas), .weather-forecast-widget-container,
   .weather-forecast-widget-title, .weather-forecast-y-axis-labels (dynamic),
   .weather-symbols-overlay (dynamic), data-latitude / data-longitude attributes. */

.wf{
    --wf-chart-h: 128px;
    padding: var(--card-pad);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wf--bare{ padding: 0; background: none; border: 0; box-shadow: none; }

.wf__head{
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: flex-start;
    justify-content: space-between;
}
.wf__title,
.weather-forecast-widget-title{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    letter-spacing: var(--display-ls);
    font-size: 1.3rem;
    line-height: 1.1;
    margin: 2px 0 0;
    color: var(--ink);
}

.weather-forecast-widget-container{
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Series legend — temperature line + snow/rain bars (on-brand, replaces the
   Chart.js default legend, which is disabled in view.js). */
.wf__legend{
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: -2px 0 0;
}
.wf__lg{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: .68rem;
    color: var(--muted);
    white-space: nowrap;
}
.wf__lg-swatch{
    flex: 0 0 auto;
    width: 14px;
    height: 10px;
    border-radius: 2px;
}
.wf__lg-swatch--temp{
    width: 16px;
    height: 0;
    border-radius: 0;
    border-top: 2px solid #0B1115;
}
.wf__lg-swatch--snow{
    background: rgba(148, 197, 253, 0.65);
    border: 1px solid rgba(96, 165, 250, 0.9);
}
.wf__lg-swatch--rain{
    background: rgba(37, 99, 235, 0.4);
    border: 1px solid rgba(37, 99, 235, 0.65);
}
.wf__plot{ display: flex; gap: 8px; }

/* Y-axis sticky labels (rebuilt for mobile by view.js) */
.weather-forecast-y-axis-labels{
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: var(--wf-chart-h);
    padding: 4px 0;
}
.weather-forecast-y-axis-label{
    font-family: var(--font-mono);
    font-size: .66rem;
    color: var(--muted);
}

/* Chart wrap holds the canvas + the absolutely-positioned symbols overlay */
.wf__chartwrap,
.weather-forecast-chart-container{
    position: relative;
    flex: 1;
    height: var(--wf-chart-h);
}
.weather-forecast-chart{
    display: block;
    width: 100%;
    height: 100%;
}
/* B12: skeleton block over the chart while the YR forecast loads. */
.weather-forecast-skel{ position: absolute; inset: 0; }
.weather-forecast-skel .kab-skel-wrap,
.weather-forecast-skel .kab-skel--block{ height: 100%; }
.weather-symbols-overlay{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    pointer-events: none;
}
.wf__sym{
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--accent);
    padding-top: 4px;
}

/* Day labels (below chart) — Day name + high temp + low temp */
.weather-day-labels{
    display: flex;
    padding-left: 28px;
}
.weather-day-label{
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}
.weather-day-label b{
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--ink);
}
.weather-day-label em{
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--muted);
    font-style: normal;
}
.weather-day-label span{
    font-size: .72rem;
    color: var(--ink-soft);
}

/* Error message (view.js inserts on fetch failure) */
.weather-forecast-error:empty{ display: none; }
.weather-forecast-error{
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--no) 9%, var(--surface));
    border-left: 3px solid var(--no);
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.5;
}

@media (max-width: 560px){
    .wf{ padding: 14px; --wf-chart-h: 112px; }
}
