:root {
  --bg: #eef1f5;
  --ink: #1c2541;
  --muted: #5b6478;
  --line: #c9cfdb;
  --accent: #2b50e0;

  --font: "Familjen Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a2e;
    --ink: #e6e9f2;
    --muted: #9aa3b8;
    --line: #36405c;
    --accent: #7d96ff;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 2rem;
}

/* The one loud element */
.wordmark {
  margin: 0 0 2.5rem;
  font-size: clamp(3rem, 13vw, 7.5rem);
  font-weight: 700;
  line-height: .9;
  letter-spacing: -.045em;
  /* nudge so the "d" sits on the same left edge as the checkboxes */
  margin-left: -.04em;
}

/* Task list */
.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.task {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.25rem, 3.6vw, 1.625rem);
  font-weight: 500;
}

.box {
  position: relative;
  flex: none;
  width: 1.35em;
  height: 1.35em;
  border: 2px solid var(--ink);
  border-radius: .3em;
  overflow: hidden;
}

/* Done: tick draws itself, then the label is struck through */
.task--done .box {
  border-color: var(--accent);
  background: var(--accent);
}
.task--done svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--bg);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.task--done path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw .45s var(--ease) .5s forwards;
}
.task--done .label {
  color: var(--muted);
  background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0 2px;
  animation: strike .4s var(--ease) .95s forwards;
}

/* Doing: box partly filled */
.task--doing .box { border-color: var(--accent); }
.task--doing .fill {
  position: absolute;
  inset: auto 0 0 0;
  height: 0;
  background: var(--accent);
  opacity: .35;
  animation: fill .9s var(--ease) 1.3s forwards;
}

/* To do: empty, quiet */
.task--todo .box { border-color: var(--line); }
.task--todo .label { color: var(--muted); }

.note {
  margin: 2rem 0 0;
  color: var(--muted);
  max-width: 40ch;
  text-wrap: pretty;
}

.footer {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  font-size: .875rem;
  color: var(--muted);
}
.footer p { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes draw   { to { stroke-dashoffset: 0; } }
@keyframes strike { to { background-size: 100% 2px; } }
@keyframes fill   { to { height: 55%; } }

@media (prefers-reduced-motion: reduce) {
  .task--done path { animation: none; stroke-dashoffset: 0; }
  .task--done .label { animation: none; background-size: 100% 2px; }
  .task--doing .fill { animation: none; height: 55%; }
}
