/* Quanto cozer amanhã. Fonts are kept with the page (SIL Open Font License, see the OFL files
   next to them); nothing is loaded from other domains. */
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #F4EFE3; --surface: #FFFCF5; --surface-2: #F9F4E8; --ink: #0B1220; --muted: #4B5468; --line: #DCD3BF;
  --gold: #85560A; --gold-mark: #C28A2B; --btn: #0B1220; --btn-ink: #F4EFE3; --mark: #F7E7C2; --head: #EDE5D2;
  --focus: #C28A2B; --demand: #0B1220; --model: #A0650A; --rule: #2B5DA6; --out: #A1271B; --grid: #E3DBC8;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --surface: #121B2E; --surface-2: #17213A; --ink: #EEE8DB; --muted: #AAB3C5; --line: #2A3754;
    --gold: #E8B04B; --gold-mark: #E8B04B; --btn: #E8B04B; --btn-ink: #0B1220; --mark: #3A3220; --head: #1C2740;
    --focus: #E8B04B; --demand: #EEE8DB; --model: #E8B04B; --rule: #8DB4F0; --out: #F29489; --grid: #24304A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #121B2E; --surface-2: #17213A; --ink: #EEE8DB; --muted: #AAB3C5; --line: #2A3754;
  --gold: #E8B04B; --gold-mark: #E8B04B; --btn: #E8B04B; --btn-ink: #0B1220; --mark: #3A3220; --head: #1C2740;
  --focus: #E8B04B; --demand: #EEE8DB; --model: #E8B04B; --rule: #8DB4F0; --out: #F29489; --grid: #24304A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1rem/1.55 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
h1, h2 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; line-height: 1.1; letter-spacing: 0; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--btn); color: var(--btn-ink); padding: 10px 14px; border-radius: 8px; z-index: 10; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 6px; flex-wrap: wrap; }
.brand { margin: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: url("../img/qpc-mark.svg") center / cover no-repeat; flex: none; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar select { min-height: 40px; width: auto; }
.intro { padding-top: 18px; padding-bottom: 26px; }
.intro h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 0 0 12px; }
.lead { font-size: 1.08rem; max-width: 72ch; margin: 0 0 10px; }
.notice { display: inline-block; margin: 6px 0 0; padding: 6px 12px; border: 1px dashed var(--gold-mark); border-radius: 18px; color: var(--muted); font-size: .92rem; }

/* controls */
button, select, input { font: inherit; color: inherit; }
select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 44px; width: 100%; }
select:hover { border-color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.ghost { background: transparent; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field label, .level-box > label { font-weight: 600; font-size: .95rem; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: .9rem; max-width: 80ch; }
.range { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.range input { flex: 1; accent-color: var(--gold-mark); min-width: 0; height: 32px; }
.range output { min-width: 4.5ch; font-weight: 700; font-size: 1.4rem; text-align: right; color: var(--gold); font-variant-numeric: tabular-nums; }

/* blocks */
main { padding: 22px 0 56px; }
main:focus { outline: none; }
.status { padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.block { margin: 0 0 30px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.block h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); margin: 0 0 10px; }
.block > p { max-width: 80ch; }
.weather { margin: 0 0 6px; }
.level-box { margin: 16px 0 18px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--gold-mark); border-radius: var(--radius); max-width: 760px; }
.saving { font-weight: 650; font-size: 1.08rem; color: var(--gold); margin: 14px 0 6px; }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .95rem; }
caption { text-align: left; padding: 8px 12px; font-weight: 650; border-bottom: 1px solid var(--line); background: var(--surface-2); }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
thead th { background: var(--head); font-weight: 650; font-size: .88rem; }
tbody th { font-weight: 600; white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tfoot th, tfoot td { border-top: 2px solid var(--line); border-bottom: 0; font-weight: 600; }
tfoot td { text-align: left; }
tr.mark th, tr.mark td { background: var(--mark); }
.sugg td strong { font-size: 1.1rem; }
.sugg td:last-child { min-width: 16ch; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* chart */
.chart-controls { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: end; margin: 12px 0 6px; }
.chart-controls .field { width: min(100%, 260px); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 26px; height: 0; border-top: 3px solid currentColor; }
.key.s-demand { color: var(--demand); }
.key.s-model { color: var(--model); border-top-width: 4px; }
.key.s-rule { color: var(--rule); border-top-style: dashed; }
.key.s-out { width: 10px; height: 10px; border: 2px solid var(--out); border-radius: 50%; background: var(--surface); }
.chart { margin: 8px 0 0; min-width: 0; }
.chart-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart-svg .grid line { stroke: var(--grid); stroke-width: 1; }
.chart-svg text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-svg .line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .s-demand { stroke: var(--demand); stroke-width: 2; }
.chart-svg .s-model { stroke: var(--model); stroke-width: 3; }
.chart-svg .s-rule { stroke: var(--rule); stroke-width: 2; stroke-dasharray: 6 4; }
.chart-svg circle.s-out { fill: var(--surface); stroke: var(--out); stroke-width: 2; }
.chart figcaption { margin-top: 8px; }

.how-text p { max-width: 80ch; margin: 0 0 10px; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 20px 0 60px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 0 0 6px; max-width: 80ch; }

@media (max-width: 560px) {
  .wrap { padding: 0 12px; }
  .block { padding: 14px 12px; }
  th, td { padding: 7px 8px; }
  table { font-size: .9rem; }
}
@media print {
  .toolbar, .skip { display: none; }
}
