/* cp-cycle — one 30-day cycle as an instrument: spends land on days, the paycheck clears them. */
#cp-cycle .cy { margin: 0; width: 100%; max-width: 580px; justify-self: end; }
#cp-cycle .cy-panel {
  --g: 3px; --px: 28px; --line: rgba(223,227,222,.12);
  --clear: var(--green-light);
  position: relative; background: rgba(242,244,241,.03); color: var(--on-ink);
  border: 1px solid rgba(223,227,222,.22);
  overflow: hidden; transition: border-color .6s var(--ease);
}
#cp-cycle .cy.is-clear .cy-panel { border-color: rgba(111,203,159,.42); }

#cp-cycle .cy-lab { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; line-height: 1; color: var(--on-ink-50); white-space: nowrap; }

/* head */
#cp-cycle .cy-h { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 0 var(--px); border-bottom: 1px solid var(--line); }
#cp-cycle .cy-day { display: inline-flex; align-items: center; gap: 9px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-ink-70); white-space: nowrap; font-variant-numeric: tabular-nums; }
#cp-cycle .cy-day b { font-weight: 400; color: var(--on-ink); display: inline-block; min-width: 2ch; text-align: right; }
#cp-cycle .cy-live { width: 7px; height: 7px; border-radius: 50%; background: var(--clear); }

/* amount + days left */
#cp-cycle .cy-m { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: baseline; column-gap: 20px; row-gap: 16px; padding: 26px var(--px) 4px; }
#cp-cycle .cy-kv { display: contents; }
#cp-cycle .cy-kv > :first-child { grid-row: 1; }
#cp-cycle .cy-kv > :last-child { grid-row: 2; }
#cp-cycle .cy-kv--r > * { grid-column: 2; justify-self: end; text-align: right; }
#cp-cycle .cy-amt, #cp-cycle .cy-left {
  font-family: var(--f-display); font-weight: 800; line-height: .84; letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--on-ink);
}
#cp-cycle .cy-amt { font-size: clamp(56px, 5.6vw, 84px); transition: color .5s var(--ease); }
#cp-cycle .cy-amt small { font-size: .5em; font-weight: 700; letter-spacing: -0.02em; color: var(--on-ink-70); margin-left: .02em; }
#cp-cycle .cy.is-clear .cy-amt { color: var(--clear); }
#cp-cycle .cy.is-clear .cy-amt small { color: rgba(111,203,159,.72); }
#cp-cycle .cy-left { font-size: clamp(40px, 3.6vw, 54px); color: var(--on-ink-70); }

/* the track */
#cp-cycle .cy-trk { padding: 30px var(--px) 30px; }
#cp-cycle .cy-rail { position: relative; padding-top: 84px; }
#cp-cycle .cy-cells { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); column-gap: var(--g); height: 44px; }
#cp-cycle .cy-c { display: block; border-radius: 3px; background: rgba(223,227,222,.07); transition: background-color .35s var(--ease), box-shadow .35s var(--ease); }
#cp-cycle .cy-c.on { background: rgba(223,227,222,.26); }
#cp-cycle .cy-c.sp { background: var(--on-ink); }
#cp-cycle .cy-c.td { box-shadow: 0 0 0 1.5px var(--on-ink); }
#cp-cycle .cy-c.on.cl { background: rgba(111,203,159,.42); }
#cp-cycle .cy-c.sp.cl, #cp-cycle .cy-c.td.cl { background: var(--clear); }
#cp-cycle .cy-c.td.cl { box-shadow: 0 0 0 1.5px var(--clear); }

/* x of a day's centre, with the gaps accounted for */
#cp-cycle .cy-mk, #cp-cycle .cy-pay, #cp-cycle .cy-axis span {
  position: absolute; left: calc((var(--d) - 1) * (100% + var(--g)) / 30 + (100% - 29 * var(--g)) / 60);
}
/* spend flags: pole on the left edge, two lanes so neighbours never touch */
#cp-cycle .cy-mk { top: 0; height: 84px; }
#cp-cycle .cy-mk--lo { top: 36px; height: 48px; }
#cp-cycle .cy-tag {
  position: absolute; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px;
  border-radius: 6px; background: var(--ink-3); border: 1px solid var(--line);
  font-size: 13.5px; line-height: 1; color: var(--on-ink-70); white-space: nowrap;
  transition: background-color .4s var(--ease), border-color .4s var(--ease), color .4s var(--ease);
}
#cp-cycle .cy-tag b { font-weight: 600; color: var(--on-ink); font-variant-numeric: tabular-nums; }
#cp-cycle .cy-mk .cy-tag { left: -1px; top: 0; border-bottom-left-radius: 0; }
#cp-cycle .cy-stem { position: absolute; left: -.5px; width: 1px; background: rgba(223,227,222,.5); }
#cp-cycle .cy-mk .cy-stem { top: 30px; bottom: 6px; }
#cp-cycle .cy-pin { position: absolute; left: -3.5px; bottom: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--on-ink); transition: background-color .35s var(--ease); }
#cp-cycle .cy.is-clear .cy-mk .cy-pin { background: var(--clear); }
#cp-cycle .cy.is-clear .cy-mk .cy-tag { color: var(--on-ink-50); }
#cp-cycle .cy.is-clear .cy-mk .cy-tag b { color: var(--on-ink-70); }

/* sweep: the green bracket the paycheck draws back across the days it cleared */
#cp-cycle .cy-sweep {
  position: absolute; left: 0; top: calc(84px + 44px + 8px); height: 3px; border-radius: 2px; background: var(--clear);
  width: calc(14 * (100% + var(--g)) / 30 - var(--g)); transform-origin: 100% 50%;
}

/* day numbers */
#cp-cycle .cy-axis { position: relative; height: 26px; margin-top: 16px; }
#cp-cycle .cy-axis span { top: 0; transform: translateX(-50%); font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; line-height: 1; color: var(--on-ink-50); font-variant-numeric: tabular-nums; }
#cp-cycle .cy-axis span:first-child { transform: translateX(-30%); }
#cp-cycle .cy-axis span:last-child { transform: translateX(-70%); }
#cp-cycle .cy-axis span { transition: color .4s var(--ease); }
#cp-cycle .cy-axis .cy-ax-td.on { color: var(--on-ink); }

/* payday flag: hangs under day 14 */
#cp-cycle .cy-pay { top: calc(84px + 44px + 39px); }
#cp-cycle .cy-pay .cy-stem { top: 0; height: 16px; background: rgba(111,203,159,.7); }
#cp-cycle .cy-pay .cy-tag { top: 16px; left: 0; transform: translateX(-50%); color: var(--clear); background: rgba(111,203,159,.1); border-color: rgba(111,203,159,.38); }
#cp-cycle .cy-pay .cy-tag b { color: var(--clear); }
#cp-cycle .cy-pay .cy-tag svg { width: 14px; height: 14px; flex: none; }
#cp-cycle .cy-trk { padding-bottom: 60px; }

/* foot */
#cp-cycle .cy-f { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 0 var(--px); border-top: 1px solid var(--line); font-size: 14px; color: var(--on-ink-70); white-space: nowrap; transition: border-color .6s var(--ease); }
#cp-cycle .cy.is-clear .cy-f { border-top-color: rgba(111,203,159,.2); }
#cp-cycle .cy-note b { font-weight: 600; color: var(--on-ink); font-variant-numeric: tabular-nums; }
#cp-cycle .cy-st { display: grid; font-weight: 500; color: var(--on-ink); }
#cp-cycle .cy-st > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 9px; transition: opacity .4s var(--ease), transform .4s var(--ease); }
#cp-cycle .cy-sq { width: 8px; height: 8px; border-radius: 1.5px; background: var(--on-ink); }
#cp-cycle .cy-st-b { color: var(--clear); }
#cp-cycle .cy-st-b svg { width: 20px; height: 20px; flex: none; padding: 3px; border-radius: 50%; background: var(--clear); color: var(--ink); }
#cp-cycle .cy-st-a { opacity: 0; transform: translateY(-6px); }
#cp-cycle .cy:not(.is-clear) .cy-st-a { opacity: 1; transform: none; }
#cp-cycle .cy:not(.is-clear) .cy-st-b { opacity: 0; transform: translateY(6px); }

@media (max-width: 900px) {
  #cp-cycle .cy { justify-self: stretch; max-width: none; }
}
@media (max-width: 640px) {
  #cp-cycle .cy-panel { --px: 18px; --g: 2px; }
  #cp-cycle .cy-lab, #cp-cycle .cy-day, #cp-cycle .cy-axis span { font-size: 12.5px; }
  #cp-cycle .cy-m { padding-top: 22px; }
  #cp-cycle .cy-trk { padding-top: 26px; }
  #cp-cycle .cy-tag { font-size: 13px; padding: 0 9px; height: 28px; }
  #cp-cycle .cy-mk .cy-stem { top: 28px; }
  #cp-cycle .cy-cells { height: 38px; }
  #cp-cycle .cy-sweep { top: calc(84px + 38px + 7px); }
  #cp-cycle .cy-pay { top: calc(84px + 38px + 38px); }
  #cp-cycle .cy-f { font-size: 13.5px; }
}
