/* Weather Widget v3 (Snörapport) — kabdalis2 design system.
   .kabdalis-weather-widget-v3 is the JS-locked wrapper. view.js injects
   .wv3 + .b-card/.wv3--bare, wraps title in .wv3__head with .b-kicker,
   adds .b-metrics to the metrics grid, overlays .b-metric on each metric,
   moves the cross-country callout out of the metrics grid, overlays
   .b-ann.b-ann--warn on the alert banner, and adds .btn.btn--primary
   on the CTA. JS-locked IDs: #weather_v3_alert/_icon/_message,
   #weather_v3_top_temp/_valley_temp, #weather_v3_snow_base/_natural_snow,
   #weather_v3_cross_country_km/_callout/_groomed_text,
   #weather_v3_forecast_icon/_title/_body. Container: .weather-v3-container.
   Attribute hooks: data-show-cross-country-km, data-show-groomed-date. */

.wv3{
    padding: var(--card-pad);
    display: flex;
    flex-direction: column;
}
.wv3--bare{ padding: 0; background: none; border: 0; box-shadow: none; }

/* The JS-locked .weather-v3-container holds all the visible rows (head,
   alert, metrics, cross-country, forecast, CTA). The gap lives HERE — not
   on .wv3 — because .wv3 has only one direct child (the container itself),
   so a gap on .wv3 has nothing to space between. */
.weather-v3-container{
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wv3__head{
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: flex-start;
    justify-content: space-between;
}

/* B12: while kabWeather() is in flight, hide the "--" placeholder rows and
   show the metrics-shaped skeleton (.weather-v3-skel) that view.js appends. */
.weather-v3-container.is-loading > .weather-v3-metrics,
.weather-v3-container.is-loading > .weather-v3-metric-cross-country,
.weather-v3-container.is-loading > .weather-v3-forecast,
.weather-v3-container.is-loading > .weather-v3-alert{ display: none !important; }
.wv3__title,
.weather-v3-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);
}

/* Alert — .b-ann.b-ann--warn primitive overlaid by view.js. Just size icon. */
.weather-v3-alert:empty{ display: none; }
.weather-v3-alert .b-ann__lead .fa{ font-size: 1.25rem; line-height: 1; }

/* Metrics — .b-metrics primitive layout, with widget-specific 2x2 grid.
   Spec uses .b-metrics 4-up; we keep 2x2 to match the existing 4-metric
   set (Topp / Dal / SnoNatur / SnoBacke) on the live API. */
.weather-v3-metrics{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.weather-v3-metrics .b-metric{
    background: var(--surface);
    padding: 13px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.weather-v3-metric-label{
    font-family: var(--font-mono);
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}
.weather-v3-metric-value{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 3px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.weather-v3-metric-unit{
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--muted);
}

/* Cross-country callout — sits BELOW the metrics grid (moved out by view.js).
   Compact row with icon + "Längdspår: X km preparerade · senast spårat …". */
.weather-v3-metric-cross-country{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    font-size: .9rem;
    color: var(--ink-soft);
}
.weather-v3-metric-cross-country .fa{
    color: var(--accent);
    font-size: 1.05rem;
}
.weather-v3-cross-country-callout{
    font-size: .8rem;
    color: var(--ink-soft);
    margin-top: -4px;
}
.weather-v3-cross-country-callout:empty{ display: none; }
.weather-v3-callout-text b{
    color: var(--ink);
    font-family: var(--font-mono);
}

/* Forecast block — icon + title + description */
.weather-v3-forecast{
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.weather-v3-forecast-icon{
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.weather-v3-forecast-icon i{ font-size: 20px; }
.weather-v3-forecast-content{
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.weather-v3-forecast-title{
    font-weight: 600;
    color: var(--ink);
    line-height: 1.25;
}
.weather-v3-forecast-body{
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.5;
    font-size: .9rem;
}

/* CTA — view.js adds .btn.btn--primary at runtime; just align self */
.weather-v3-cta{ align-self: flex-start; }

@media (max-width: 560px){
    .wv3{ padding: 14px; }
    .weather-v3-metrics{ grid-template-columns: 1fr; }
}
