:root {
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 2rem;
}
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
}
a {
  color: var(--color-primary);
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}
::selection {
  background: var(--color-primary-tint);
}
header,
main,
footer {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 2rem;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}
nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9rem;
}
.brand {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--color-text);
  font: 600 1.4rem var(--font-serif);
  text-decoration: none;
}
.brand span {
  margin-left: 0.5rem;
  font: 400 0.9rem var(--font-sans);
  color: var(--color-text-muted);
}
main {
  padding-block: 2.5rem;
}
h1,
h2 {
  font-family: var(--font-serif);
  line-height: 1.15;
  text-wrap: balance;
}
h1 {
  max-width: 20ch;
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 500;
}
h2 {
  margin: 0 0 1.5rem;
  font-size: 2rem;
  font-weight: 500;
}
p {
  margin: 0 0 1rem;
}
.intro {
  max-width: 68ch;
  font-size: 1.1rem;
}
.measure,
details p {
  max-width: 72ch;
}
.notice,
.muted,
figcaption {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.notice {
  max-width: 80ch;
  margin-block: 1.5rem 0;
}
section {
  margin-top: 3.5rem;
  border-top: 1px solid var(--color-border);
  padding-top: 2rem;
}
.section-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
:where(.section-title p) {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
.settings {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.settings > div {
  flex: 1 1 15rem;
}
label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}
select,
button {
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--color-text-meta);
  border-radius: 4px;
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}
select {
  width: 100%;
}
button {
  cursor: pointer;
}
button:hover {
  background: var(--color-surface-alt);
}
button:disabled,
select:disabled {
  opacity: 0.65;
  cursor: wait;
}
figure {
  margin: 1.5rem 0;
}
#chart {
  min-height: 14rem;
}
#chart svg {
  display: block;
  width: 100%;
  height: auto;
}
figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-top: 0.75rem;
}
.legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.legend::before {
  content: "";
  width: 1.25rem;
  height: 2px;
  background: var(--legend);
}
.price {
  --legend: var(--chart-series-primary);
}
.fast {
  --legend: var(--chart-series-secondary);
}
.slow {
  --legend: var(--chart-series-tertiary);
}
.readings {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding-block: 1rem;
  border-block: 1px solid var(--color-border);
}
dt {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
dd {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.journal-settings {
  margin-top: 1.5rem;
}
.table-scroll {
  overflow: auto;
  max-height: 36rem;
  border-block: 1px solid var(--color-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  font-weight: 500;
  background: var(--color-surface-alt);
}
th,
td {
  padding: 0.8rem 1rem 0.8rem 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
th:first-child,
td:first-child {
  padding-left: 0.5rem;
}
td:first-child,
td:last-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#empty {
  margin-top: 1rem;
}
details {
  margin-top: 1.5rem;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding-block: 0.5rem;
  font-weight: 500;
}
details p {
  margin-top: 0.75rem;
}
#error {
  padding: 1rem 0;
  color: var(--color-text);
  font-weight: 500;
}
footer {
  padding-block: 2rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}
footer p {
  max-width: 72ch;
}
.skip,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  clip-path: none;
  background: var(--color-surface);
  padding: 1rem;
  z-index: 10;
}
@media (max-width: 600px) {
  header,
  main,
  footer {
    padding-inline: 1.5rem;
  }
  header {
    gap: 0.5rem;
  }
  main {
    padding-block: 2rem;
  }
  nav {
    gap: 0.25rem 1rem;
  }
  nav a {
    font-size: 0.85rem;
  }
  .readings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settings > div {
    flex-basis: 100%;
  }
  .settings button {
    width: 100%;
  }
  #chart {
    min-height: 0;
  }
  th,
  td {
    min-width: 8rem;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-paper: hsl(210 20% 8%);
    --color-surface: hsl(210 18% 12%);
    --color-surface-alt: hsl(210 16% 15%);
    --color-text: hsl(40 10% 91%);
    --color-text-muted: hsl(40 8% 72%);
    --color-text-meta: hsl(40 8% 63%);
    --color-border: hsl(210 12% 28%);
    --color-primary: hsl(189 55% 67%);
    --color-primary-tint: hsl(189 20% 22%);
    --chart-series-primary: hsl(189 55% 67%);
    --chart-series-secondary: hsl(258 48% 73%);
    --chart-series-tertiary: hsl(28 65% 68%);
    --chart-grid: hsl(210 12% 24%);
    --chart-annotation: hsl(40 10% 82%);
    --chart-axis: hsl(40 8% 70%);
  }
}

.event-link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.event-link:hover {
  background: transparent;
  text-decoration-thickness: 2px;
}
