/* =========================================================================
   tasks.css — Home page: hero, composer, task list, empty & done states
   ========================================================================= */

/* -------------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------------- */
.hero {
  padding: 0.5rem 0.25rem 0.35rem;
  animation: rise var(--t-slow) var(--ease-out) both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 0 0 rgba(var(--accent-1-rgb), 0.55);
  animation: blip 3.4s var(--ease-out) infinite;
}

@keyframes blip {
  0% {
    box-shadow: 0 0 0 0 rgba(var(--accent-1-rgb), 0.5);
  }
  70%,
  100% {
    box-shadow: 0 0 0 9px rgba(var(--accent-1-rgb), 0);
  }
}

.hero__title {
  margin-top: 0.7rem;
  font-size: clamp(2rem, 7vw, 2.85rem);
  font-weight: 300;
  letter-spacing: -0.038em;
  background: linear-gradient(160deg, #ffffff 8%, #c8d4f2 52%, #9fb0dd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  margin-top: 0.6rem;
  font-size: 0.98rem;
  color: var(--ink-3);
  max-width: 46ch;
}

/* -------------------------------------------------------------------------
   Composer
   ------------------------------------------------------------------------- */
.composer {
  padding: 0.7rem;
  animation: rise var(--t-slow) 60ms var(--ease-out) both;
}

.composer__form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.35rem 0.35rem 0.95rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke-1);
  background: rgba(0, 0, 0, 0.26);
  transition: border-color var(--t-med) var(--ease-out), background var(--t-med) var(--ease-out),
    box-shadow var(--t-med) var(--ease-out);
}

.composer__form:focus-within {
  border-color: rgba(var(--accent-1-rgb), 0.42);
  background: rgba(0, 0, 0, 0.34);
  box-shadow: 0 0 0 4px rgba(var(--accent-1-rgb), 0.08), 0 0 34px -14px rgba(var(--accent-1-rgb), 0.7);
}

.composer__glyph {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--ink-4);
  transition: color var(--t-med) var(--ease-out), rotate var(--t-slow) var(--ease-spring);
}

.composer__glyph svg {
  width: 100%;
  height: 100%;
}

.composer__form:focus-within .composer__glyph {
  color: var(--accent-1);
  rotate: 90deg;
}

.composer__input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0;
  border: 0;
  background: none;
  font-size: 0.98rem;
  color: var(--ink-1);
}

.composer__input::placeholder {
  color: var(--ink-4);
}

.composer__input:focus-visible {
  outline: none;
}

.composer__submit {
  flex: none;
  padding: 0.55rem 1.1rem;
}

/* -------------------------------------------------------------------------
   List shell
   ------------------------------------------------------------------------- */
.list {
  animation: rise var(--t-slow) 120ms var(--ease-out) both;
  padding: clamp(1.05rem, 3vw, 1.4rem) clamp(0.85rem, 2.5vw, 1.1rem)
    clamp(0.85rem, 2.5vw, 1.1rem);
}

.list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(0.35rem, 1.5vw, 0.5rem) 0.85rem;
}

.list__title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.list__meta {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ink-4);
}

/* Progress ring */
.progress {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
}

.progress__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  rotate: -90deg;
}

.progress__track,
.progress__value {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.progress__track {
  stroke: var(--stroke-1);
}

.progress__value {
  stroke: url(#ringGrad);
  stroke-dasharray: 125.66; /* 2πr, r = 20 */
  stroke-dashoffset: 125.66;
  filter: drop-shadow(0 0 5px rgba(var(--accent-1-rgb), 0.55));
  transition: stroke-dashoffset 700ms var(--ease-out);
}

.progress__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.04em;
}

/* -------------------------------------------------------------------------
   Task rows
   ------------------------------------------------------------------------- */
.tasks {
  display: flex;
  flex-direction: column;
  /* Tapping a task should not paint half the sentence blue.
     A double tap on a word selects it, and on a list of short task lines the
     selection is almost always wider than intended — it survives the re-render
     too, so a stray tap leaves a blue smear sitting on the list. Copying a task
     is a deliberate act now: the right-click menu's *Copy text* item. */
  -webkit-user-select: none;
  user-select: none;
  /* iOS shows a callout on long-press even with user-select: none, which is a
     magnified loupe over the row you were trying to right-click. */
  -webkit-touch-callout: none;
}

.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.78rem clamp(0.35rem, 1.5vw, 0.5rem);
  border-radius: var(--r-md);
  animation: task-in 420ms var(--ease-out) both;
  transition: background var(--t-med) var(--ease-out);
}

/* Separator between rows.
   This was `box-shadow: 0 -1px 0 var(--stroke-1)` on `.task + .task`, which
   looks like a hairline and is not one: a box-shadow is painted inside the
   element's border box, so it inherits `border-radius: var(--r-md)` and the
   "straight" line curls away at both ends. Two rounded rows with a curved line
   between them read as a smudge, not a division. A pseudo-element is a real
   box with its own, square geometry — and insetting it keeps the rule clear of
   the rounded corners instead of butting into them. */
.task + .task::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0.55rem;
  right: 0.55rem;
  height: 1px;
  background: var(--stroke-1);
}

.task:hover {
  background: var(--glass-1);
}

.task.is-leaving {
  animation: task-out 240ms var(--ease-in-out) both;
  pointer-events: none;
}

@keyframes task-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes task-out {
  to {
    opacity: 0;
    transform: translateX(14px) scale(0.97);
    max-height: 0;
    padding-block: 0;
  }
}

/* Checkbox */
.task__check {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 0.1rem;
  border-radius: 50%;
  border: 1.5px solid var(--stroke-3);
  display: grid;
  place-items: center;
  color: transparent;
  transition: border-color var(--t-med) var(--ease-out), background var(--t-med) var(--ease-out),
    color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out),
    scale var(--t-fast) var(--ease-spring);
}

.task__check svg {
  width: 12px;
  height: 12px;
  scale: 0.6;
  opacity: 0;
  transition: scale var(--t-med) var(--ease-spring), opacity var(--t-fast) linear;
}

.task:hover .task__check {
  border-color: rgba(var(--accent-1-rgb), 0.55);
}

.task__check:hover {
  background: rgba(var(--accent-1-rgb), 0.1);
}

.task__check:active {
  scale: 0.9;
}

.task.is-done .task__check {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  border-color: transparent;
  color: #060a18;
  box-shadow: 0 0 0 4px rgba(var(--accent-1-rgb), 0.1), 0 0 16px -2px rgba(var(--accent-1-rgb), 0.5);
}

.task.is-done .task__check svg {
  scale: 1;
  opacity: 1;
}

/* Text + strike-through */
.task__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.08rem;
}

/* The click meter. The task text is inside this element, not beside it, so
   clicking the words is the gesture. */
.task__meter {
  cursor: pointer;
  border-radius: var(--r-sm);
}

/* No background tint on hover. There was one — a 5% accent wash behind the
   words — and it was the wrong idea twice over: a filled rounded rectangle
   behind a line of text reads as a highlight, and on a touch screen the hover
   state sticks after a tap, so the list ends up looking like a column of
   smudges. The cue here is the ink itself, which costs no layout and no
   surface. `.task` already tints the whole row on hover; that is enough. */
.task:not(.is-done) .task__meter:hover .task__text {
  color: #fff;
}

.task__meter:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 4px;
  border-radius: var(--r-sm);
}

.task__text {
  display: inline;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-1);
  overflow-wrap: anywhere;
  /* The strike is a background gradient, not a pseudo-element: background
     slicing means a wrapped task gets one line per line, where an absolutely
     positioned ::after would only ever cut the first. */
  background-image: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  background-repeat: no-repeat;
  background-position: 0 68%;
  background-size: 0% 1.5px;
  transition: background-size 460ms var(--ease-out), color var(--t-slow) var(--ease-out);
}

.task.is-done .task__text {
  color: var(--ink-4);
  background-size: 100% 1.5px;
  transition: background-size 420ms var(--ease-out), color var(--t-slow) var(--ease-out);
}

/* Partial-progress bar. `--fill` is set from JS as a percentage. */
.task__gauge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.task__track {
  flex: 1;
  min-width: 0;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--stroke-1);
  overflow: hidden;
}

.task__fill {
  display: block;
  width: var(--fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-3));
  box-shadow: 0 0 8px -1px rgba(var(--accent-1-rgb), 0.55);
  /* Long enough to read as the bar moving rather than snapping, short enough
     that twenty clicks in a row still feel like a direct response. */
  transition: width 300ms var(--ease-out);
}

.task__pct {
  flex: none;
  min-width: 2.6em;
  text-align: right;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}

.task__note {
  display: block;
  margin-top: 0.32rem;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  opacity: 0.7;
}

.task__input {
  width: 100%;
  padding: 0.15rem 0.4rem;
  margin: -0.15rem -0.4rem;
  border: 1px solid rgba(var(--accent-1-rgb), 0.4);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.95rem;
  color: var(--ink-1);
  /* The one place in the list where selection is wanted: you need it to replace
     a word, and select-all is the natural gesture in an editor. */
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* Delete */
.task__delete {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 0.02rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  opacity: 0;
  scale: 0.8;
  transition: opacity var(--t-med) var(--ease-out), scale var(--t-med) var(--ease-spring),
    color var(--t-med) var(--ease-out), background var(--t-med) var(--ease-out);
}

.task__delete svg {
  width: 14px;
  height: 14px;
}

.task:hover .task__delete,
.task__delete:focus-visible {
  opacity: 1;
  scale: 1;
}

.task__delete:hover {
  color: var(--accent-4);
  background: rgba(255, 157, 180, 0.1);
}

@media (hover: none) {
  .task__delete {
    opacity: 0.55;
    scale: 1;
  }
}

/* -------------------------------------------------------------------------
   Empty / all-done state
   ------------------------------------------------------------------------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.1rem 1rem 2.4rem;
  animation: rise var(--t-slow) var(--ease-out) both;
}

.empty__art {
  width: 104px;
  height: 104px;
  margin-bottom: 1.1rem;
}

.empty__orbit {
  fill: none;
  stroke: var(--stroke-2);
  stroke-width: 1;
  stroke-dasharray: 3 9;
  transform-origin: 60px 60px;
  animation: spin 46s linear infinite;
}

.empty__orbit--slow {
  stroke-opacity: 0.5;
  animation-duration: 78s;
  animation-direction: reverse;
}

.empty__core {
  fill: rgba(143, 180, 255, 0.16);
  stroke: rgba(143, 180, 255, 0.4);
  stroke-width: 1;
  animation: core-breathe 6s var(--ease-in-out) infinite;
}

.empty__dot {
  fill: var(--accent-1);
  filter: drop-shadow(0 0 6px rgba(var(--accent-1-rgb), 0.9));
  transform-origin: 60px 60px;
  animation: spin 46s linear infinite;
}

.empty__dot--2 {
  fill: var(--accent-2);
  animation-duration: 78s;
  animation-direction: reverse;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes core-breathe {
  0%,
  100% {
    opacity: 0.65;
    r: 9;
  }
  50% {
    opacity: 1;
    r: 10.5;
  }
}

.empty__title {
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.empty__text {
  margin-top: 0.4rem;
  max-width: 34ch;
  font-size: 0.85rem;
  color: var(--ink-4);
  text-wrap: balance;
}

.empty--done .empty__core {
  fill: rgba(111, 216, 207, 0.18);
  stroke: rgba(111, 216, 207, 0.45);
}

.empty--done .empty__title {
  background: linear-gradient(100deg, #ffffff, var(--accent-3));
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4.5s var(--ease-in-out) infinite;
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* -------------------------------------------------------------------------
   List footer
   ------------------------------------------------------------------------- */
.list__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.9rem clamp(0.35rem, 1.5vw, 0.5rem) 0.1rem;
  border-top: 1px solid var(--stroke-1);
  animation: rise var(--t-med) var(--ease-out) both;
}

.list__counts {
  font-size: 0.79rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.list__actions {
  display: flex;
  gap: 0.4rem;
}

/* -------------------------------------------------------------------------
   Backup & restore
   ------------------------------------------------------------------------- */
.data {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  padding: 0 clamp(0.35rem, 1.5vw, 0.5rem);
  animation: rise var(--t-slow) 180ms var(--ease-out) both;
}

.data__note {
  font-size: 0.79rem;
  color: var(--ink-4);
}

.data__actions {
  display: flex;
  gap: 0.4rem;
}

/* -------------------------------------------------------------------------
   Task context menu
   -------------------------------------------------------------------------
   Sits above everything, follows the pointer, and flips rather than clipping at
   the bottom of the window. Not a <dialog>: this is a menu, it should not dim
   the page behind it, and it should not trap focus — the rest of the row stays
   reachable with Shift+Tab while it is open. */
.taskmenu {
  position: fixed;
  z-index: 90;
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--stroke-2);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(18, 23, 49, 0.97), rgba(8, 11, 26, 0.98));
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  animation: taskmenu-in 140ms var(--ease-out) both;
}

/* Left/top are set from JS after measuring, so the menu is never painted at
   0,0 for a frame on the way in. */
@keyframes taskmenu-in {
  from {
    opacity: 0;
    translate: 0 -4px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.taskmenu__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: var(--r-sm);
  font-size: 0.83rem;
  color: var(--ink-2);
  text-align: left;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out);
}

.taskmenu__item svg {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.75;
}

.taskmenu__item:hover,
.taskmenu__item:focus-visible {
  background: var(--glass-3);
  color: var(--ink-1);
}

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

.taskmenu__item:active {
  background: rgba(var(--accent-1-rgb), 0.16);
}

/* The sheet is a native <dialog> so focus trapping, Escape and inertness of
   the page behind it are the platform's job, not ours. */
.sheet {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(92vw, 34rem);
  max-height: 86dvh;
  padding: 0;
  border: 1px solid var(--stroke-2);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(18, 23, 49, 0.94), rgba(8, 11, 26, 0.96));
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  color: var(--ink-1);
  overflow: hidden;
}

.sheet::backdrop {
  background: rgba(3, 4, 11, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet[open] {
  animation: sheet-in var(--t-med) var(--ease-out) both;
}

.sheet[open]::backdrop {
  animation: fade-in var(--t-med) var(--ease-out) both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet__inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: clamp(1.1rem, 3vw, 1.5rem);
  max-height: 86dvh;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sheet__title {
  font-size: 1.05rem;
  font-weight: 600;
}

.sheet__note {
  font-size: 0.82rem;
  color: var(--ink-3);
  text-wrap: pretty;
}

.sheet__area {
  width: 100%;
  min-height: 8.5rem;
  resize: vertical;
  padding: 0.75rem 0.85rem;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke-1);
  background: rgba(0, 0, 0, 0.36);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--ink-2);
  tab-size: 2;
  transition: border-color var(--t-med) var(--ease-out), box-shadow var(--t-med) var(--ease-out);
}

.sheet__area:focus-visible {
  outline: none;
  border-color: rgba(var(--accent-1-rgb), 0.45);
  box-shadow: 0 0 0 4px rgba(var(--accent-1-rgb), 0.09);
}

.sheet__area[readonly] {
  color: var(--ink-3);
  cursor: text;
}

.sheet__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* Pushes the confirm buttons to the trailing edge, and collapses when the
   row would otherwise sit on one line. */
.sheet__gap {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 420px) {
  .sheet__foot .btn {
    flex: 1 1 auto;
  }
  .sheet__gap {
    display: none;
  }
}

/* -------------------------------------------------------------------------
   Shared entrance animation
   ------------------------------------------------------------------------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
