/* The task search with a week range to narrow under the field: the task search of Pondwise, a project app, on white.
   A warm white card with a fine grain, a 1px edge that catches the light and layered shadows. One accent, a warm
   tangerine, for the weeks in the window and the matched letters; everything else is ink and soft greys. */
:root {
  --page: #ffffff;                    /* the page */
  --card: #fdfcfa;                    /* the card, warm white */
  --ink: #19181c;                     /* the words */
  --muted: #7f7d86;                   /* the small words */
  --faint: #aeacb4;                   /* the faintest words */
  --line: rgba(28, 24, 36, 0.085);    /* the 1px edges */
  --accent: #f0592a;                  /* the one accent: tangerine */
  --accent-deep: #d8441a;             /* the accent at the foot of a bar */
  --accent-soft: rgba(240, 89, 42, 0.14); /* the tint behind matched letters */
  --bar: #e9e6e1;                     /* a week outside the window */
  --bar-hover: #d9d5ce;               /* a week outside the window, under the pointer */
  --row-h: clamp(38px, 9.4vh, 48px);  /* how tall a task row is */
  --strip-h: clamp(50px, 14.4vh, 74px); /* how tall the strip of weeks is */
}

* {
  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: clamp(10px, 3vh, 18px) 12px;
  overflow: hidden;
}

/* the wrap is GSAP's (entrance), the card is CSS's */
.wrap {
  width: min(540px, 94vw);
  opacity: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: min(452px, calc(100vh - 28px));
  --pad: clamp(8px, 1.9vh, 10px);
  padding: var(--pad);
  border-radius: 20px;
  background:
    radial-gradient(130% 70% at 50% 0%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(70% 50% at 50% 26%, rgba(240, 89, 42, 0.04), transparent 70%),
    var(--card);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 1px rgba(30, 20, 20, 0.04),
    0 4px 10px -4px rgba(30, 20, 20, 0.07),
    0 18px 36px -16px rgba(40, 24, 20, 0.14),
    0 42px 84px -40px rgba(120, 50, 20, 0.2);
  overflow: hidden;
  isolation: isolate;
}

.card__grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  opacity: 0.32;
  mix-blend-mode: multiply;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.48 0 0 0 0 0.46 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* a hair of light along the top edge */
.card__sheen {
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 1), transparent);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the field */
.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: clamp(40px, 9.8vh, 48px);
  padding: 0 8px 0 14px;
  border-radius: 13px;
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 1px 2px rgba(30, 20, 20, 0.05),
    0 6px 14px -10px rgba(40, 20, 20, 0.18);
  transition: box-shadow 0.25s ease;
}

.field.is-focus {
  box-shadow:
    inset 0 0 0 1px rgba(240, 89, 42, 0.55),
    0 0 0 4px rgba(240, 89, 42, 0.1),
    0 1px 2px rgba(30, 20, 20, 0.05),
    0 6px 14px -10px rgba(40, 20, 20, 0.18);
}

.field__lens {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.field.is-focus .field__lens {
  stroke: var(--ink);
}

.field__type {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 100%;
}

.field__input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: transparent;
  font: 500 clamp(15px, 3.4vh, 16.5px) / 1 'Mona Sans Variable', system-ui, sans-serif;
  letter-spacing: -0.01em;
}

.field__input::placeholder {
  color: var(--faint);
  font-weight: 450;
}

.field__caret {
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.6px;
  height: 1.15em;
  margin-top: -0.6em;
  border-radius: 1px;
  background: var(--accent);
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
}

.field__measure {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font: 500 clamp(15px, 3.4vh, 16.5px) / 1 'Mona Sans Variable', system-ui, sans-serif;
  letter-spacing: -0.01em;
}

.field__clear {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.field__clear.is-on {
  pointer-events: auto;
}

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

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

@media (hover: hover) {
  .field__clear:hover {
    background: rgba(28, 24, 36, 0.05);
    color: var(--ink);
  }
}

/* ---------------------------------------------------------------- the weeks */
.weeks {
  flex: none;
  margin-top: clamp(6px, 1.6vh, 10px);
  padding: clamp(7px, 1.7vh, 10px) 10px clamp(5px, 1.2vh, 7px);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.55));
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.weeks__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 16px;
  margin-bottom: clamp(4px, 1.1vh, 7px);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.weeks__label {
  letter-spacing: 0.01em;
}

.weeks__range {
  position: relative;
  display: inline-block;
  height: 16px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.weeks__range-in {
  display: block;
  line-height: 16px;
}

.weeks__range-in + .weeks__range-in {
  position: absolute;
  right: 0;
  top: 0;
}

.strip {
  position: relative;
  height: var(--strip-h);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* a hairline under the bars */
.strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(28, 24, 36, 0.09);
}

.bars {
  position: absolute;
  inset: 0 0 1px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
}

.bar {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
}

/* GSAP sets the height of the fill, CSS its colour */
.bar__fill {
  position: relative;
  width: 58%;
  height: 3px;
  border-radius: 4px 4px 1.5px 1.5px;
  background: var(--bar);
  transition: background-color 0.28s ease, box-shadow 0.28s ease;
}

.bar.is-in .bar__fill {
  background: linear-gradient(180deg, #ff8a5c, var(--accent) 40%, var(--accent-deep));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 4px 10px -5px rgba(240, 89, 42, 0.55);
}

@media (hover: hover) {
  .bar:hover .bar__fill {
    background: var(--bar-hover);
  }

  .bar.is-in:hover .bar__fill {
    background: linear-gradient(180deg, #ff9a70, #f26a3d 40%, var(--accent));
  }
}

/* the window over the weeks: GSAP sets its x and width */
.brush {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 0;
  width: 100%;
  cursor: grab;
  touch-action: none;
}

.brush.is-drag {
  cursor: grabbing;
}

.brush__glass {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    rgba(240, 89, 42, 0.05);
  box-shadow:
    inset 0 0 0 1px rgba(240, 89, 42, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 6px 16px -10px rgba(240, 89, 42, 0.5);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  pointer-events: none;
}

.brush.is-drag .brush__glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    rgba(240, 89, 42, 0.085);
  box-shadow:
    inset 0 0 0 1px rgba(240, 89, 42, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 3px rgba(240, 89, 42, 0.08),
    0 10px 22px -12px rgba(240, 89, 42, 0.6);
}

/* a glint that crosses the glass when the window settles */
.brush__glint {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%);
  background-size: 250% 100%;
  background-position: 130% 0;
  background-repeat: no-repeat;
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
}

/* the grips: CSS centres the button, GSAP presses the inner pill */
.grip {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 34px;
  margin: -17px 0 0 -11px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.grip--lo {
  left: 0;
}

.grip--hi {
  left: 100%;
}

.grip i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 24px;
  margin: -12px 0 0 -4.5px;
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff, #f6f3ef);
  box-shadow:
    inset 0 0 0 1px rgba(240, 89, 42, 0.55),
    0 1px 2px rgba(60, 20, 10, 0.12),
    0 4px 8px -3px rgba(120, 40, 10, 0.25);
}

/* two hairlines on the grip */
.grip i::before {
  content: '';
  position: absolute;
  left: 3px;
  right: 3px;
  top: 8px;
  bottom: 8px;
  border-left: 1px solid rgba(240, 89, 42, 0.55);
  border-right: 1px solid rgba(240, 89, 42, 0.55);
}

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

.grip:focus-visible i {
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 0 0 3px rgba(240, 89, 42, 0.22),
    0 4px 8px -3px rgba(120, 40, 10, 0.25);
}

.months {
  position: relative;
  height: 14px;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--faint);
}

.months span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the summary line */
.sum {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex: none;
  padding: clamp(7px, 1.8vh, 11px) 8px clamp(3px, 0.8vh, 5px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.005em;
  gap: 12px;
}

.sum__in {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
}

.sum__count {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  color: var(--ink);
  font-weight: 600;
}

.roll {
  position: relative;
  display: inline-block;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.roll__n {
  display: inline-block;
}

.roll__n + .roll__n {
  position: absolute;
  left: 0;
  top: 0;
}

/* ---------------------------------------------------------------- the list */
.list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent);
}

.rows {
  position: relative;
}

/* GSAP moves the row, CSS the inside */
.row {
  position: relative;
  left: 0;
  right: 0;
  height: var(--row-h);
}

.row__in {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 100%;
  padding: 0 8px;
  border-radius: 11px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .row__in:hover {
    background: rgba(28, 24, 36, 0.035);
  }
}

.row__in:active {
  transform: scale(0.99);
}

.tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f3f1ed);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 1px 2px rgba(30, 20, 20, 0.06);
}

.tile svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.78;
}

.row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row__t {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: clamp(13px, 3.1vh, 14px);
  font-weight: 550;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.row__m {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11.5px;
  font-weight: 450;
  color: var(--muted);
}

.row__key {
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.row__d {
  flex: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(30, 20, 20, 0.12);
}

/* the matched letters: a tint that sweeps in from the left */
.hl {
  border-radius: 3px;
  background: linear-gradient(var(--accent-soft), var(--accent-soft)) no-repeat 0 0 / 100% 100%;
  color: #b8350f;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.empty {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

.empty svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.5;
  stroke-linecap: round;
}

@media (max-width: 420px) {
  .row__d {
    display: none;
  }

  .weeks {
    padding-left: 8px;
    padding-right: 8px;
  }
}
