/* app.css — component styles. Tokens live in theme.css. */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- */
/* Shell                                                             */
/* ---------------------------------------------------------------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.masthead {
  padding: var(--s6) var(--s4) var(--s4);
}

.masthead__name {
  font-family: var(--font-display);
  font-size: var(--t-display);
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0;
}

.masthead__count {
  font-family: var(--font-mono);
  font-size: var(--t-meta);
  color: var(--ink-soft);
  margin-top: var(--s1);
  font-variant-numeric: tabular-nums;
}

.scroller {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--s3) var(--s7);
  -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------- */
/* Task rows                                                         */
/* ---------------------------------------------------------------- */

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border-radius: var(--r-card);
  overflow: hidden;
}

.tasks:empty { display: none; }

/* Suppresses the completion animation on first paint, so tasks that
   were already done don't all draw their strikethrough on load. */
.tasks.is-preload .task__text::after { transition: none; }

.task {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}

.task:last-child { border-bottom: 0; }

.task--done { background: var(--card); }

/* The check ------------------------------------------------------- */

.task__check {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  padding: 0;
  border: 1.5px solid var(--rule-firm);
  border-radius: var(--r-pill);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}

.task__check::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 10px;
  height: 5.5px;
  border-left: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: rotate(-45deg) scale(.4);
  transform-origin: center;
  opacity: 0;
  transition: opacity 120ms var(--ease), transform 180ms var(--ease);
  margin-bottom: 3px;
}

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

.task--done .task__check::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

/* The title and its stroke ---------------------------------------- */

.task__title {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 2px 0;
  text-align: left;
  font-size: var(--t-title);
  line-height: 1.35;
  cursor: text;
  color: var(--ink);
}

.task__text {
  position: relative;
  display: inline;
  transition: color var(--stroke) var(--ease);
}

/* The signature: a line that draws across the title rather than
   appearing all at once. */
.task__text::after {
  content: "";
  position: absolute;
  left: 0;
  top: 55%;
  height: 1.5px;
  width: 0;
  background: currentColor;
  transition: width var(--stroke) var(--ease);
  pointer-events: none;
}

.task--done .task__text {
  color: var(--ink-faint);
}

.task--done .task__text::after { width: 100%; }

/* Inline rename --------------------------------------------------- */

.task__input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1.5px solid var(--teal);
  background: transparent;
  padding: 2px 0;
  font-size: var(--t-title);
  border-radius: 0;
}

.task__input:focus { outline: none; }

/* Remove --------------------------------------------------------- */

.task__remove {
  flex: none;
  width: 34px;
  height: 34px;
  margin: -4px 0 0 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  border-radius: var(--r-pill);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  opacity: .55;
  transition: opacity 140ms var(--ease), color 140ms var(--ease);
}

.task__remove:hover,
.task__remove:focus-visible {
  opacity: 1;
  color: var(--danger);
}

/* ---------------------------------------------------------------- */
/* Group divider                                                     */
/* ---------------------------------------------------------------- */

.group-label {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: var(--s5) var(--s4) var(--s2);
}

/* ---------------------------------------------------------------- */
/* Empty state                                                       */
/* ---------------------------------------------------------------- */

.empty {
  padding: var(--s7) var(--s5);
  text-align: center;
}

.empty__line {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0 0 var(--s2);
}

.empty__hint {
  font-size: var(--t-meta);
  color: var(--ink-soft);
  margin: 0;
}

/* ---------------------------------------------------------------- */
/* Quick add                                                         */
/* ---------------------------------------------------------------- */

.quickadd {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--s2);
  align-items: center;
  padding: var(--s3) var(--s3);
  padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--paper);
  box-shadow: var(--shadow-sheet);
}

.quickadd__field {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 var(--s4);
  border: 1px solid var(--rule-firm);
  border-radius: var(--r-pill);
  background: var(--card);
  font-size: var(--t-title);
}

.quickadd__field::placeholder { color: var(--ink-faint); }

.quickadd__field:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.quickadd__submit {
  flex: none;
  height: 48px;
  min-width: 48px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
}

.quickadd__submit:disabled {
  opacity: .35;
  cursor: default;
}

/* ---------------------------------------------------------------- */
/* Undo                                                              */
/* ---------------------------------------------------------------- */

.undo {
  position: fixed;
  left: var(--s3);
  right: var(--s3);
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  border-radius: var(--r-card);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-meta);
  transform: translateY(140%);
  transition: transform 240ms var(--ease);
  z-index: 10;
}

.undo.is-shown { transform: translateY(0); }

.undo__action {
  border: 0;
  background: transparent;
  color: var(--done);
  font-weight: 600;
  font-size: var(--t-meta);
  padding: var(--s2) var(--s3);
  cursor: pointer;
}

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

/* ---------------------------------------------------------------- */
/* Priority                                                          */
/* ---------------------------------------------------------------- */

/* Priority is monochrome on purpose. Turmeric already means "done"
   and red already means "overdue"; a third colour competing with
   those would make the row harder to read, not easier. Weight and
   presence carry the level instead. */

.task {
  position: relative;
}

.task[data-priority="1"]::before,
.task[data-priority="2"]::before,
.task[data-priority="3"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--ink);
}

.task[data-priority="1"]::before { width: 2px; opacity: .18; }
.task[data-priority="2"]::before { width: 2px; opacity: .45; }
.task[data-priority="3"]::before { width: 3px; opacity: .85; }

.task--done::before { opacity: .1 !important; }

/* ---------------------------------------------------------------- */
/* Tags and notes on a row                                           */
/* ---------------------------------------------------------------- */

.tag-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: .01em;
  padding: 1px 7px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--card-sunk);
  color: var(--ink-soft);
}

.task--done .tag-pill { opacity: .55; }

.task__note {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--ink-faint);
}

/* ---------------------------------------------------------------- */
/* Tag filter strip                                                  */
/* ---------------------------------------------------------------- */

.tagbar {
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  padding: var(--s2) var(--s1) var(--s4);
  scrollbar-width: none;
}

.tagbar::-webkit-scrollbar { display: none; }

.tagbar__item {
  flex: none;
  min-height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--rule-firm);
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}

.tagbar__item.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--card);
  font-weight: 600;
}

.tagbar__count {
  opacity: .6;
  margin-left: 5px;
}
