/* The to-do list: a dark card on a black page; ticked tasks turn coral and grey and gather at the bottom. */
:root {
  --page: #000000;          /* the page */
  --card: #111114;
  --edge: #212127;
  --ink: #f2f2f5;
  --muted: #7d7d88;
  --box: #3a3a44;           /* an empty box */
  --done: #ff8a5c;          /* the ticks, the bar */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Albert Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* held from the top: tasks added grow the card downwards */
.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: start;
  padding: clamp(36px, 14vh, 150px) 16px 48px;
}

.todo {
  width: min(430px, 100%);
  padding: 22px 16px 14px;
  border: 1px solid var(--edge);
  border-radius: 26px;
  background: var(--card);
}

/* ---------------------------------------------------------------- the head and the bar */
.todo__head {
  padding: 0 8px;
}

.todo__title {
  height: 30px;
  margin: 0;
  overflow: hidden;
  font-size: 22px;
  font-weight: 700;
  line-height: 30px;
  letter-spacing: -0.02em;
}

.todo__title span {
  display: block;
}

.todo__count {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.todo__bar {
  height: 5px;
  margin: 14px 8px 10px;
  overflow: hidden;
  border-radius: 3px;
  background: #1f1f25;
}

.todo__bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--done);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------------------------------------------------------------- the tasks */
.todo__list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 8px;
  border-radius: 14px;
  background: var(--card);
}

.task label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 52px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* the real checkbox, over the drawn box */
.task input {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.task__box {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid var(--box);
  border-radius: 8px;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.task__box svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #111114;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.task.is-done .task__box {
  border-color: var(--done);
  background: var(--done);
}

.task input:focus-visible ~ .task__box {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* the words, with the line drawn through them */
.task__text {
  position: relative;
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 520;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color 0.35s ease;
}

.task.is-done .task__text {
  color: var(--muted);
}

.task__strike {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  height: 2px;
  border-radius: 1px;
  background: var(--muted);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* the cross: on hover or focus with a mouse, always with a finger */
.task__x {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.task__x svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.task__x:focus-visible {
  opacity: 1;
}
@media (hover: hover) {
  .task:hover .task__x {
    opacity: 1;
  }
}

@media (hover: hover) {
  .task__x:hover {
    background: #1f1f25;
    color: var(--ink);
  }
}

.task__x:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

@media (pointer: coarse) {
  .task__x {
    opacity: 0.8;
  }
}

/* ---------------------------------------------------------------- adding */
.todo__add {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  margin: 4px 0 0;
  padding: 0 8px;
  border-top: 1px solid var(--edge);
}

.todo__plus {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
}

.todo__plus svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.todo__field {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.todo__field::placeholder {
  color: var(--muted);
}
