/* Daily plan card: the Today card of a planner app, white on a white page. The hours of the day on the left with
   their blocks, the to-do list on the right; one accent colour for the time line, the ticks and the ring. */
:root {
  --page: #ffffff;          /* the page */
  --card: #ffffff;          /* the card */
  --ink: #16161b;           /* the words */
  --muted: #8a8a95;         /* the small words */
  --faint: #c4c4cc;         /* the hours, the empty boxes */
  --line: #efeff2;          /* the hairlines */
  --block: #f4f4f6;         /* a block of the day */
  --accent: #f2542d;        /* the time line, the ticks, the ring */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the card */
.day {
  --h: clamp(17px, 5.5vh, 34px);   /* the height of one hour */
  position: relative;
  width: min(94vw, 600px);
  padding: clamp(12px, 3.4vh, 24px) clamp(12px, 3.6vw, 26px) clamp(12px, 3.2vh, 24px);
  border-radius: clamp(18px, 4vh, 26px);
  background: var(--card);
  box-shadow:
    inset 0 0 0 1px rgba(20, 20, 30, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(20, 20, 40, 0.05),
    0 6px 16px -6px rgba(20, 20, 40, 0.08),
    0 28px 60px -24px rgba(20, 20, 40, 0.16);
  opacity: 0;
}

/* a breath of the accent at the top edge, like light caught by the rim */
.day::before {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  opacity: 0.7;
}

.day__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.day__brand {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: clamp(10px, 2.6vh, 12px);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.day__mark {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.day__sep {
  color: var(--faint);
}

.day__today {
  margin: clamp(1px, 0.6vh, 4px) 0 0;
  font-size: clamp(20px, 6.4vh, 34px);
  line-height: 1;
  font-weight: 640;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.03em;
}

.day__progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 6px;
  border-radius: 999px;
  background: #fafafb;
  box-shadow: inset 0 0 0 1px var(--line);
}

.ring {
  width: clamp(20px, 5.6vh, 28px);
  height: clamp(20px, 5.6vh, 28px);
  transform: rotate(-90deg);
  fill: none;
}

.ring__track {
  stroke: var(--line);
  stroke-width: 3;
}

.ring__fill {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.ring__check {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  transform: rotate(90deg);
  transform-origin: 14px 14px;
}

.day__count {
  margin: 0;
  line-height: 1.2em;
  font-size: clamp(11px, 2.9vh, 13px);
  font-weight: 560;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* the digit rolls on a column from 0 to 9 */
.roll {
  display: inline-block;
  width: 1ch;
  height: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.2em;
}

.roll__col {
  display: block;
}

.roll__col span {
  display: block;
  height: 1.2em;
  text-align: center;
}

.day__body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(10px, 3vw, 26px);
  margin-top: clamp(10px, 3.4vh, 22px);
}

/* ---------------------------------------------------------------- the hours */
.plan__track {
  --gutter: clamp(28px, 4.2vw, 38px);
  position: relative;
  height: calc(var(--h) * var(--hours, 10));
  margin: 6px 0;
}

.plan__hours {
  position: absolute;
  inset: 0;
}

/* one hour: a hairline across the track, and its label in the gutter */
.plan__hour {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
}

.plan__hour::after {
  content: '';
  position: absolute;
  left: calc(var(--gutter) - 2px);
  right: 0;
  top: 0;
  height: 1px;
  background: var(--line);
  opacity: 0.8;
}

.plan__label {
  position: absolute;
  left: 0;
  top: 0;
  font-size: clamp(8.5px, 2.3vh, 10.5px);
  font-weight: 500;
  line-height: 1;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
}

.plan__rule {
  position: absolute;
  left: calc(var(--gutter) - 2px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.plan__elapsed {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 70%, transparent));
  transform-origin: 50% 0;
  transform: scaleY(0);
}

.plan__blocks {
  position: absolute;
  inset: 0 0 0 calc(var(--gutter) + 4px);
  margin: 0;
  padding: 0;
  list-style: none;
  container-type: inline-size;
  z-index: 2;
}

/* a block: the li is moved by GSAP, the face by CSS */
.block {
  position: absolute;
  left: 0;
  right: 0;
  padding: 1px 0;
}

.block__face {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 3px 7px 0 9px;
  border-radius: clamp(6px, 1.8vh, 9px);
  background: var(--block);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 30, 0.035);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2), background-color 0.5s ease, box-shadow 0.35s ease;
}

.block__fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, transparent), color-mix(in srgb, var(--accent) 14%, transparent));
}

/* inside the block of now, the edge of the fill is the line of now */
.block.is-now .block__fill {
  border-bottom: 1px solid var(--accent);
}

.block__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--faint);
  transform-origin: 50% 0;
  transition: background-color 0.4s ease;
}

.block__row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.block__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(9.5px, 2.7vh, 12px);
  line-height: 1.25;
  font-weight: 600;
  transition: color 0.5s ease;
}

.block__time {
  margin-left: auto;
  flex: none;
  font-size: clamp(8.5px, 2.3vh, 10.5px);
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.block__sub {
  position: relative;
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(8.5px, 2.3vh, 10.5px);
  color: var(--muted);
}

.block.has-room .block__sub {
  display: block;
}

.block__check {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.block__face > .block__check {
  top: clamp(3px, 1.1vh, 5px);
  margin-top: 0;
}

@container (max-width: 132px) {
  .block__time {
    display: none;
  }
}

.block.is-now .block__face {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 6px 14px -8px color-mix(in srgb, var(--accent) 45%, transparent);
}

.block.is-now .block__bar {
  background: var(--accent);
}

.block.is-past .block__face {
  background: #fafafb;
}

.block.is-past .block__title {
  color: var(--muted);
}

.block.is-past .block__bar {
  background: var(--line);
}

@media (hover: hover) {
  .block:hover .block__face {
    transform: translateY(-1px);
    box-shadow: inset 0 0 0 1px rgba(20, 20, 30, 0.06), 0 6px 12px -8px rgba(20, 20, 40, 0.25);
  }
}

/* ---------------------------------------------------------------- the line of now */
.now {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  z-index: 1;
  pointer-events: none;
}

.now__line {
  position: absolute;
  left: calc(var(--gutter) - 2px);
  right: -4px;
  top: -0.5px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 70%, color-mix(in srgb, var(--accent) 0%, transparent));
  box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent);
}

.now__tag {
  position: absolute;
  left: -3px;
  top: 0;
  padding: 2px 4px 2px;
  border-radius: 5px;
  font-size: clamp(8.5px, 2.3vh, 10.5px);
  font-weight: 640;
  line-height: 1;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 2px 6px -2px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the to-do list */
.todo__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 clamp(4px, 1.4vh, 10px);
  padding: 0 4px;
  font-size: clamp(10px, 2.7vh, 12px);
  font-weight: 600;
}

.todo__left {
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.todo__list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* a task: the li is moved by GSAP, the row by CSS */
.task {
  position: relative;
}

.task.is-carried {
  z-index: 2;
}

.task__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(7px, 2vw, 10px);
  width: 100%;
  padding: clamp(4px, 1.25vh, 8px) 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2), background-color 0.25s ease, box-shadow 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.task.is-carried .task__row {
  transition: transform 0.25s ease, box-shadow 0.3s ease;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(20, 20, 30, 0.05), 0 10px 20px -10px rgba(20, 20, 40, 0.3);
}

.task__row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: -2px;
}

@media (hover: hover) {
  .task__row:hover {
    transform: translateY(-1px);
    background: #f8f8fa;
    box-shadow: 0 0 0 1px rgba(20, 20, 30, 0.035), 0 6px 12px -9px rgba(20, 20, 40, 0.28);
  }
}

.task__box {
  position: relative;
  display: block;
  width: clamp(14px, 3.9vh, 18px);
  height: clamp(14px, 3.9vh, 18px);
}

.task__frame {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1.5px var(--faint);
  transition: box-shadow 0.25s ease;
}

.task__row:active .task__frame {
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.task__fill {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 8px -3px color-mix(in srgb, var(--accent) 70%, transparent);
  transform: scale(0);
}

.task__tick {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.task__text {
  display: block;
  min-width: 0;
}

.task__words {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
  font-size: clamp(10.5px, 3vh, 13.5px);
  line-height: 1.3;
  font-weight: 540;
  transition: color 0.45s ease;
}

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

.task__meta {
  display: block;
  margin-top: 1px;
  font-size: clamp(8.5px, 2.3vh, 10.5px);
  color: var(--muted);
  transition: opacity 0.45s ease;
}

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

.task.is-done .task__meta {
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .task__row,
  .block__face {
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  }

  .task__row:hover,
  .block:hover .block__face {
    transform: none;
  }
}
