/* Prognosebuch: a ledger for forecasts. Pale ledger paper, blue ink for the forecast,
   red ink only for "red numbers" (missed days, worse than the rule of thumb), and a
   highlighter for the cheapest hours. */

@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(fonts/barlow-condensed-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-700.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 400 700; font-display: swap; src: url(fonts/source-serif-4.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/source-serif-4-italic.woff2) format("woff2"); }

:root {
  --paper: #eef2eb;
  --paper-2: #e3eadf;
  --rule: #c7d3c1;
  --ink: #17243a;
  --ink-2: #4c5b6f;
  --blue: #1f5fa6;
  --band: #1f5fa6;
  --red: #b3261e;
  --marker: #f2d94e;
  --focus: #1f5fa6;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --measure: 68ch;
  --wide: 76rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1714;
    --paper-2: #16211c;
    --rule: #2a3a32;
    --ink: #e2e9df;
    --ink-2: #9fb0a5;
    --blue: #86b6ee;
    --band: #6fa4e6;
    --red: #f08b80;
    --marker: #d9bf3a;
    --focus: #86b6ee;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--serif);
  font-optical-sizing: auto;
}
a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- header */
.site-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 2rem;
  max-width: var(--wide); margin: 0 auto; padding: 1.25rem 1rem .75rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font: 700 1.75rem/1 var(--cond); letter-spacing: -0.01em; color: var(--ink); text-decoration: none;
}
.site-head nav { flex: 1 1 auto; }
.site-head ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-head nav a, .lang {
  font: 600 1.05rem/1.2 var(--cond); color: var(--ink-2); text-decoration: none; padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.site-head nav a:hover, .lang:hover { color: var(--ink); }
.site-head nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

main { max-width: var(--wide); margin: 0 auto; padding: 0 1rem 3rem; }
section { margin-top: 3rem; }

/* ---------------------------------------------------------------- type */
h1, h2, h3 { font-family: var(--cond); color: var(--ink); line-height: 1.05; margin: 0 0 .5rem; }
h1 { font-weight: 700; font-size: clamp(2.3rem, 6.5vw, 4.6rem); letter-spacing: -0.015em; }
h2 { font-weight: 700; font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
h3 { font-weight: 600; font-size: 1.35rem; margin-top: 2rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }
.lede { font-size: 1.2rem; line-height: 1.5; color: var(--ink-2); max-width: 60ch; }
.section-lede { color: var(--ink-2); }
.note { font-size: .92rem; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.red { color: var(--red); }
.empty-note { font-style: italic; color: var(--ink-2); }
.page-head { margin-top: 2.5rem; }

/* ---------------------------------------------------------------- hero */
.hero { margin-top: 2rem; }
.day-title { margin-bottom: .75rem; }
.panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.no-js .panel-title { position: static; width: auto; height: auto; clip: auto; margin-top: 2rem; }

.tabs { display: flex; gap: .5rem; margin: 1.5rem 0 1rem; flex-wrap: wrap; }
.no-js .tabs { display: none; }
.tabs button {
  font: 600 1.1rem/1.1 var(--cond); color: var(--ink-2); background: transparent;
  border: 1px solid var(--rule); border-radius: 3px; padding: .45rem .9rem; cursor: pointer;
}
.tabs button span { font-weight: 500; margin-left: .45rem; }
.tabs button[aria-selected="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.js .panel[data-hidden] { display: none; }

/* ---------------------------------------------------------------- ladder chart */
.ladder { position: relative; margin: 0; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.svg-narrow { display: none; }
@media (max-width: 720px) { .svg-wide { display: none; } .svg-narrow { display: block; } }
.c-band { fill: var(--band); fill-opacity: .28; }
.c-med { stroke: var(--blue); stroke-width: 2.4; fill: none; }
.c-act { stroke: var(--ink); stroke-width: 1.6; fill: none; stroke-linejoin: round; }
.c-mark { fill: var(--marker); fill-opacity: .6; }
@media (prefers-color-scheme: dark) { .c-mark { fill-opacity: .3; } }
.c-mark-label { font: 600 14px var(--cond); fill: var(--ink); }
.c-grid { stroke: var(--rule); stroke-width: 1; }
.c-vgrid { stroke-dasharray: 2 4; }
.c-zero { stroke: var(--ink-2); stroke-width: 1.2; }
.c-tick { font: 500 13px var(--cond); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.c-hit { fill: transparent; }
.c-hit.on { fill: var(--ink); fill-opacity: .07; }
.c-line { stroke: var(--ink-2); stroke-width: 1.5; fill: none; }
circle.c-line { fill: var(--ink-2); }
.c-line-em { stroke: var(--blue); stroke-width: 2.6; }
circle.c-line-em { fill: var(--blue); }
.c-line-ref { stroke: var(--ink); stroke-dasharray: 6 4; }
.c-line-label { font: 600 13px var(--cond); fill: var(--ink-2); stroke: none; }
.c-line-label.c-line-em { fill: var(--blue); }
.c-line-label.c-line-ref { fill: var(--ink); }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin-top: .5rem;
  font: 500 .98rem/1.3 var(--cond); color: var(--ink-2); }
.key { display: inline-block; width: 1.4rem; height: .8rem; margin-right: -.45rem; vertical-align: -1px; }
.key-band { background: color-mix(in srgb, var(--band) 30%, transparent); }
.key-med { height: 3px; background: var(--blue); }
.key-act { height: 2px; background: var(--ink); }
.key-mark { background: color-mix(in srgb, var(--marker) 70%, transparent); }
.legend .unit { margin-left: auto; }

.tip {
  position: absolute; pointer-events: none; z-index: 2; min-width: 9rem;
  background: var(--paper); border: 1px solid var(--ink); padding: .4rem .6rem;
  font: 500 .95rem/1.35 var(--cond); font-variant-numeric: tabular-nums; color: var(--ink);
}
.tip b { font-weight: 700; font-size: 1.05rem; }

/* ---------------------------------------------------------------- facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 45%), 1fr)); gap: 1.25rem 2rem;
  margin: 1.75rem 0 1rem; }
.fact { margin: 0; }
.fact dt { font: 500 1rem/1.2 var(--cond); color: var(--ink-2); }
.fact dd { margin: .15rem 0 0; font: 600 1.9rem/1.1 var(--cond); font-variant-numeric: tabular-nums; }
.fact dd small { font-size: 1rem; font-weight: 500; color: var(--ink-2); }
.fact dd.sub { font: 400 .95rem/1.35 var(--serif); color: var(--ink-2); max-width: 26ch; }
.fact-mark dd:first-of-type a {
  color: var(--ink); text-decoration: none;
  background: linear-gradient(transparent 38%, color-mix(in srgb, var(--marker) 75%, transparent) 38% 92%, transparent 92%);
}

/* ---------------------------------------------------------------- ledger tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; }
.ledger { width: 100%; font: 500 1.02rem/1.35 var(--cond); font-variant-numeric: tabular-nums; }
.ledger caption { text-align: left; font: 700 1.2rem/1.2 var(--cond); padding-bottom: .4rem; }
.ledger thead th { font-weight: 600; color: var(--ink-2); text-align: right; vertical-align: bottom;
  border-bottom: 3px double var(--ink); padding: .35rem .6rem; }
.ledger thead th:first-child { text-align: left; }
.ledger td, .ledger tbody th { padding: .38rem .6rem; border-bottom: 1px solid var(--rule); text-align: right; }
.ledger tbody th { text-align: left; font-weight: 600; white-space: nowrap; }
.ledger .num { text-align: right; }
.ledger tr.ref th { color: var(--ink); }
.ledger tr.ref td, .ledger tr.ref th { background: var(--paper-2); }
.ledger .n { display: block; font-size: .8rem; color: var(--ink-2); }
.tag { font: 500 .85rem var(--cond); color: var(--ink-2); margin-left: .3rem; }
.ledger.dm-table td, .ledger.files td, .ledger.dict td,
.ledger.dm-table thead th, .ledger.files thead th, .ledger.dict thead th { text-align: left; }
.ledger thead th.l { text-align: left; }
.ledger.files td.num, .ledger.dm-table td.num,
.ledger.files thead th.num, .ledger.dm-table thead th.num { text-align: right; }
.ledger.dict { font-size: .98rem; }
.ledger code { font: 600 .95rem var(--cond); }
.book-table .entry { color: var(--ink-2); text-align: right; width: 3rem;
  border-right: 3px double var(--red); }
.compact { font-size: .95rem; }
.values { margin: 1rem 0; }
.values summary { font: 600 1.05rem var(--cond); color: var(--blue); cursor: pointer; }
.values table { margin-top: .5rem; min-width: 18rem; }
.range { font: 500 1rem var(--cond); color: var(--ink-2); }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 2.5rem 2rem; }
.fail-card { border-top: 3px double var(--ink); padding-top: .75rem; }
.fail-card h3 { margin: 0; font-size: 1.3rem; }
.card-head { font: 500 1rem var(--cond); color: var(--ink-2); margin-bottom: .5rem; }
.mini { margin: 0 0 .75rem; }
.hints { margin: 0; padding-left: 1.1rem; font-size: .98rem; }
.hints li { margin-bottom: .35rem; }
.backtest { border-top: 1px solid var(--rule); padding-top: 1.5rem; }

.cheap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); gap: 3rem; margin-top: 2rem; }
.cheap-day h2 { font-size: 1.5rem; }
.window-time { font: 700 clamp(3rem, 9vw, 5rem)/1 var(--cond); margin: .25rem 0 1rem;
  background: linear-gradient(transparent 55%, color-mix(in srgb, var(--marker) 75%, transparent) 55% 92%, transparent 92%);
  display: inline-block; font-variant-numeric: tabular-nums; }
.alts { list-style: none; padding: 0; margin: 0; font: 500 1.05rem var(--cond); max-width: 18rem; }
.alts li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rule); padding: .25rem 0; }
.explain p { color: var(--ink-2); }

.missed-list { font: 500 1.05rem var(--cond); padding-left: 1.1rem; }
.chart-block figure { margin: 0; }

/* ---------------------------------------------------------------- prose */
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.5rem; }
.prose table { width: 100%; margin: 1rem 0 1.5rem; font-size: .96rem; line-height: 1.4; }
.prose th { text-align: left; border-bottom: 3px double var(--ink); padding: .3rem .5rem; font: 600 1rem var(--cond); }
.prose td { border-bottom: 1px solid var(--rule); padding: .35rem .5rem; vertical-align: top; }
.prose code { font-size: .9em; background: var(--paper-2); padding: 0 .2em; }
.prose li { margin-bottom: .4rem; }

/* ---------------------------------------------------------------- footer */
.site-foot { max-width: var(--wide); margin: 0 auto; padding: 1.5rem 1rem 3rem; border-top: 3px double var(--ink);
  font-size: .92rem; color: var(--ink-2); }
.site-foot p { margin: .3rem 0; }
.disclaimer { color: var(--ink); font-weight: 600; }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .site-head { gap: .5rem 1rem; }
  .site-head nav { order: 3; flex-basis: 100%; }
  .site-head ul { gap: .1rem .9rem; }
  .lang { order: 2; margin-left: auto; }
  .fact dd { font-size: 1.5rem; }
  .fact dd.sub { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.prose table { display: block; overflow-x: auto; }
