/* Daylight tariff — a light, meter-readout theme for Helsinki spot prices.
   The price figure is the gauge: its colour is the live price band. Everything
   else stays quiet. Bands mirror pricing.PRICE_BANDS (display only). */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("/static/familjen-grotesk.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  font-style: normal;
}

:root {
  --paper: #f1f4f7;
  --card: #ffffff;
  --ink: #16202b;
  --ink-soft: #5d6b7a;
  --line: #e2e7ed;
  --accent: #2f6fed;          /* neutral UI accent: focus, "now" row, tomorrow line */

  /* Price-band ramp (cheap → very-high). fg used for figures, tint for fills. */
  --cheap: #0c8f5e;        --cheap-tint: #e4f4ec;
  --moderate: #b06a07;     --moderate-tint: #fbeedd;
  --high: #d9531a;         --high-tint: #fce6dc;
  --very-high: #c1121f;    --very-high-tint: #fbe0e2;

  --display: "Familjen Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 16px;
  font-family: var(--body);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* Band utility: any element carrying band-* exposes --band / --band-tint. */
.band-cheap      { --band: var(--cheap);      --band-tint: var(--cheap-tint); }
.band-moderate   { --band: var(--moderate);   --band-tint: var(--moderate-tint); }
.band-high       { --band: var(--high);       --band-tint: var(--high-tint); }
.band-very-high  { --band: var(--very-high);  --band-tint: var(--very-high-tint); }

/* ---- Header ---- */
.eyebrow {
  margin: 0 0 .5rem;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 .55rem;
}
.sub { color: var(--ink-soft); margin: 0; font-size: .92rem; max-width: 48ch; }

/* ---- Now card (the hero) ---- */
.now-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin: 1.75rem 0 1rem;
  padding: 1.4rem 1.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--band, var(--accent));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(22,32,43,.04), 0 12px 28px rgba(22,32,43,.06);
}
.now-main { flex: 1 1 auto; min-width: 0; }
.now-label {
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.now-time { font-family: var(--mono); letter-spacing: 0; margin-left: .4rem; color: var(--ink); }
.now-price { margin: .35rem 0 .5rem; line-height: 1; }
.now-figure {
  font-family: var(--display);
  font-size: clamp(3rem, 13vw, 4.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--band, var(--ink));
}
.now-figure.muted { color: var(--ink-soft); }
.now-price .unit { font-size: 1rem; font-weight: 600; color: var(--ink-soft); margin-left: .5rem; }
.now-band {
  margin: 0;
  font-size: .9rem;
  color: var(--ink-soft);
  text-transform: capitalize;
}
.now-band .dot {
  display: inline-block;
  width: .6rem; height: .6rem;
  border-radius: 50%;
  background: var(--band, var(--accent));
  margin-right: .45rem;
  vertical-align: baseline;
}

/* next-2h sparkline */
.now-spark {
  flex: 0 0 200px;
  height: 104px;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.now-spark figcaption {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
  margin-bottom: .4rem;
}
.now-spark canvas { width: 100% !important; flex: 1 1 auto; min-height: 0; }

/* ---- Cheapest / priciest ---- */
.extremes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin: 0 0 2rem;
}
.extreme {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: .75rem .9rem;
  background: var(--band-tint, var(--card));
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: .9rem;
}
.extreme .arrow { color: var(--band); font-weight: 700; font-size: 1.05rem; line-height: 1; }
.extreme .ex-label { color: var(--ink-soft); }
.extreme .ex-time { font-family: var(--mono); color: var(--ink); }
.extreme .ex-price {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--band);
  white-space: nowrap;
}
.extreme .ex-unit { font-size: .72rem; color: var(--ink-soft); margin-left: .25rem; }

/* ---- Blocks / table ---- */
.block { margin: 2.25rem 0; }
.block h2 {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 .85rem;
}

.block h2 .hint {
  font-family: var(--body);
  font-weight: 400;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-left: .45rem;
}

/* Rest-of-today: 2–3 side-by-side Time/Price tables that wrap, so the list
   reads in tidy columns instead of one tall stretched table. */
.price-tables {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;   /* don't stretch a shorter column's rows to full height */
  gap: .35rem 2rem;
}
table.prices {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
}
.prices thead th {
  text-align: right;
  color: var(--ink-soft);
  font-family: var(--body);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .03em;
  padding: .3rem .55rem .35rem;
  border-bottom: 1px solid var(--line);
}
.prices thead th:first-child { text-align: left; padding-left: .85rem; }
.prices td {
  padding: .32rem .55rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.prices td.num { text-align: right; }
.prices td.strong { font-weight: 600; }
.prices tbody tr:last-child td { border-bottom: none; }
/* Per-row price band: a coloured bar reflecting how cheap each period is. */
.prices td.t {
  padding-left: .85rem;
  box-shadow: inset 4px 0 0 var(--band, var(--line));
}
.prices tr.is-now { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.prices tr.is-now td.t { color: var(--accent); font-weight: 600; }

/* ---- Verdict + footer ---- */
.verdict {
  padding: .75rem 1rem;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: .96rem;
  margin: 0 0 1rem;
}
.verdict.good { background: var(--cheap-tint); border-color: color-mix(in srgb, var(--cheap) 35%, var(--line)); color: #0a5a3c; }
.verdict.bad { background: var(--very-high-tint); border-color: color-mix(in srgb, var(--very-high) 35%, var(--line)); color: #8c1118; }

#compareChart { width: 100% !important; }

.muted { color: var(--ink-soft); }
.small { font-size: .82rem; }
footer { margin-top: 2.75rem; border-top: 1px solid var(--line); padding-top: 1rem; }

/* ---- A11y / responsive ---- */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Price tables: 3 columns, collapsing straight to a single column on phones —
   never the awkward 2-then-1 orphan a flex wrap would produce. */
@media (max-width: 620px) {
  .price-tables { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  main { padding: 1.75rem 1rem 3rem; }
  .now-card { flex-direction: column; align-items: stretch; gap: 1rem; }
  .now-spark { flex-basis: auto; height: 70px; }
  .now-spark figcaption { text-align: left; }
  .extremes { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
