@font-face {
  font-family: 'Gloock';
  src: url('fonts/Gloock_400Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --paper: #edf2ec;
  --sheet: #f8faf7;
  --ink: #1e2b23;
  --muted: #56665b;
  --line: #c9d6c8;
  --ribbon: #b8223b;
  --moss: #2f6b4c;
  --thread: #9db3a0;
  --display: 'Gloock', Georgia, serif;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141a16;
    --sheet: #1b231e;
    --ink: #e9efe8;
    --muted: #a3b2a6;
    --line: #2f3b33;
    --ribbon: #ef657d;
    --moss: #73c79b;
    --thread: #4a5c4f;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
}
main,
.bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}
h1,
h2 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.15;
  margin: 0;
}
h1 {
  font-size: clamp(1.75rem, 4vw, 2.6rem);
}
h2 {
  font-size: 1.5rem;
  margin-top: 56px;
}
a {
  color: inherit;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
button.link {
  border: 0;
  background: none;
  padding: 0;
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid var(--ribbon);
  outline-offset: 2px;
}
input[type='date'],
input[type='email'],
input[type='password'] {
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 8px;
  padding: 6px 10px;
}
.hint,
small,
figcaption {
  color: var(--muted);
  font-size: 0.875rem;
}
.error {
  color: var(--ribbon);
}
.error:empty {
  display: none;
}

/* Header */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--display);
  font-size: 1.4rem;
  margin: 0;
}
.brand span {
  color: var(--ribbon);
}
.who {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
#env {
  color: var(--ribbon);
}

/* Sign-in */
.signin {
  max-width: 380px;
  padding-top: 15vh;
}
.signin form {
  display: grid;
  gap: 14px;
  margin: 24px 0 12px;
}
.signin label {
  display: grid;
  gap: 4px;
}
.signin button[type='submit'] {
  background: var(--ribbon);
  border-color: var(--ribbon);
  color: #fff;
}

/* Range and the ribbon: the one loud thing on the page. */
.range {
  padding-top: 24px;
}
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 16px 0;
}
.presets label {
  color: var(--muted);
}
.ribbon {
  margin: 0;
}
#ribbon {
  display: block;
  width: 100%;
  height: 72px;
  touch-action: none;
  cursor: col-resize;
  border-bottom: 1px solid var(--line);
}
#ribbon .day {
  fill: var(--thread);
}
#ribbon .day.in {
  fill: var(--ribbon);
}
#ribbon .band {
  fill: var(--ribbon);
  opacity: 0.12;
}

/* What needs a look */
.watch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 32px;
  margin-top: 40px;
}
.watch-item {
  display: grid;
  text-decoration: none;
  border-left: 4px solid var(--ribbon);
  padding: 4px 0 4px 16px;
}
.watch-item strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 3.5rem;
  line-height: 1;
}
.watch-item.calm {
  border-left-color: var(--moss);
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 28px 32px;
  margin: 20px 0 0;
}
.metrics div {
  margin: 0;
}
.metrics dt {
  color: var(--muted);
  font-size: 0.875rem;
}
.metrics dd {
  margin: 2px 0 0;
}
.metrics .value {
  font-family: var(--display);
  font-size: 2.25rem;
  line-height: 1.1;
}
.delta {
  font-size: 0.875rem;
  margin-left: 6px;
}
.delta.up {
  color: var(--moss);
}
.delta.down {
  color: var(--ribbon);
}
.metrics small {
  display: block;
}

/* Sparklines */
.sparks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px 32px;
  margin-top: 16px;
}
.spark p {
  margin: 0 0 4px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.875rem;
}
.spark svg {
  width: 100%;
  height: 56px;
  display: block;
  overflow: visible;
}
.spark polyline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.spark .base {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0 48px;
}

/* Funnel */
.funnel {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 12px;
}
.funnel p {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.funnel .track {
  height: 10px;
  background: var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.funnel .fill {
  height: 100%;
  background: var(--moss);
}

/* List types */
.types {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
  background: var(--line);
}
.types span:nth-child(1),
.legend li:nth-child(1)::before {
  background: var(--ribbon);
}
.types span:nth-child(2),
.legend li:nth-child(2)::before {
  background: var(--moss);
}
.types span:nth-child(3),
.legend li:nth-child(3)::before {
  background: var(--ink);
}
.types span:nth-child(4),
.legend li:nth-child(4)::before {
  background: var(--thread);
}
.legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
.legend li::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}

/* Tables and lists */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}
.table th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.875rem;
}
.table td,
.table th {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.table .num {
  text-align: right;
  padding-right: 24px;
}
.table td {
  overflow-wrap: anywhere;
}
.issues,
.inbox {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.issues li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
}
.issues a {
  overflow-wrap: anywhere;
}
.issues small {
  grid-column: 1;
}
.issues .count {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-family: var(--display);
  font-size: 1.4rem;
}
.empty {
  color: var(--muted);
  padding: 10px 0;
}

/* Inbox */
.inbox li {
  background: var(--sheet);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--ribbon);
}
.inbox li.done {
  border-left-color: var(--line);
  opacity: 0.7;
}
.inbox header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.inbox .msg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 10px 0 12px;
}
.inbox .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inbox .danger {
  color: var(--ribbon);
}

.totals {
  margin: 64px 0 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .fill,
  .types span {
    transition:
      width 0.3s ease,
      flex-basis 0.3s ease;
  }
}
