/* The look of the to-do app (TD3). Selectors use only the elements and classes in docs/markup.md. */

body {
  margin: 0;
  padding: 1.5rem 1rem 3rem;
  background: #f4f5f7;
  color: #1f2328;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The single column */

.todo-app {
  box-sizing: border-box;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.25rem;
  background: #ffffff;
  border: 1px solid #d8dce1;
  border-radius: 0.75rem;
}

.todo-title {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  font-weight: 650;
  line-height: 1.2;
}

/* The add form: the label above, the field and the button side by side */

.todo-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
}

.todo-form-label {
  flex: 1 0 100%;
  font-weight: 600;
  font-size: 0.9375rem;
}

.todo-form-input {
  box-sizing: border-box;
  flex: 1 1 10rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #8a929c;
  border-radius: 0.5rem;
  background: #ffffff;
  color: inherit;
  font: inherit;
}

.todo-form-input::placeholder {
  color: #5c6470;
}

.todo-form-add {
  box-sizing: border-box;
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid #234f8f;
  border-radius: 0.5rem;
  background: #2b5fab;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.todo-form-add:hover {
  background: #234f8f;
}

/* The list */

.todo-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0.25rem;
}

.todo-item + .todo-item {
  border-top: 1px solid #e6e8eb;
}

.todo-item-check {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.125rem 0 0;
  accent-color: #2b5fab;
  cursor: pointer;
}

.todo-item-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}

/* The done state: greyed out and struck through, still legible (#6b7280 on white is 4.8:1) */

.todo-item.done .todo-item-text {
  color: #6b7280;
  text-decoration: line-through;
  text-decoration-color: #6b7280;
}

.todo-empty {
  margin: 0;
  padding: 0.625rem 0.25rem;
  color: #5c6470;
}

/* Visible keyboard focus */

.todo-form-input:focus-visible,
.todo-form-add:focus-visible,
.todo-item-check:focus-visible {
  outline: 3px solid #2b5fab;
  outline-offset: 2px;
}

@media (max-width: 400px) {
  body {
    padding: 0.75rem 0.5rem 2rem;
  }

  .todo-app {
    padding: 1rem 0.875rem;
  }
}
