/* A money page's hero board and stage picker (kit/RolloutHero.astro) and hero numbers (kit/HeroStats.astro), rule 478; split from
   kit-rollout.css (one file under 1000 lines). Linked with it by SectionRenderer. */

.krh {
  --st-done: #00c875;
  --st-work: #fdab3d;
  --st-stuck: #c9304a;
  --st-todo: #c3c6d4;
  --st-on-light: #0b1015;
}
:root[data-theme='dark'] .krh {
  --st-todo: #3a3f4b;
}
.krh [hidden] {
  display: none !important;
}

/* ---------- the hero's rollout board ---------- */

.hero__rollout {
  align-self: center;
  min-width: 0;
}
.krh {
  display: grid;
}
.krh__card {
  position: relative;
  padding: var(--s-5);
  border: 1px solid var(--line);
  background:
    radial-gradient(90% 60% at 100% 0%, var(--accent-tint) 0%, transparent 65%),
    var(--paper);
  box-shadow: var(--shadow-card);
}
.krh__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.krh__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.krh__title > span:last-child {
  display: grid;
  gap: 2px;
}
.krh__name {
  font-weight: 550;
  color: var(--ink);
  line-height: 1.2;
}
.krh__sub {
  font-size: var(--fs-mono-sm);
}
.krh__replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.krh__replay:hover {
  color: var(--ink);
  border-color: var(--accent);
}
.krh__table {
  position: relative;
  display: grid;
  gap: 6px;
}
.krh__ruler,
.krh__row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 104px;
  align-items: center;
  gap: 10px;
}
.krh__ruler {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--faint);
}
.krh__marks {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.krh__marks span {
  padding-left: 4px;
  border-left: 1px dashed var(--line-2);
  white-space: nowrap;
}
.krh__row {
  min-height: 34px;
  padding: 0 0 0 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--st-todo);
  background: var(--paper);
  transition: border-color 400ms var(--ease);
}
.krh__row[data-status='work'] {
  border-left-color: var(--st-work);
}
.krh__row[data-status='done'] {
  border-left-color: var(--st-done);
}
.krh__row[data-status='stuck'] {
  border-left-color: var(--st-stuck);
}
.krh__lname {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.krh__lname svg {
  flex: none;
  color: var(--muted);
}
.krh__track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--paper-3);
  overflow: hidden;
}
.krh__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--st-todo);
  transition: width 900ms var(--ease), background-color 400ms var(--ease);
}
.krh__row[data-status='work'] .krh__fill {
  width: 46%;
  background: var(--st-work);
}
.krh__row[data-status='done'] .krh__fill {
  width: 100%;
  background: var(--st-done);
}
.krh__row[data-status='stuck'] .krh__fill {
  width: 58%;
  background: var(--st-stuck);
}
.krh__status {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 6px;
  background: var(--st-todo);
  color: var(--st-on-light);
  font-size: 12px;
  font-weight: 550;
  text-align: center;
  line-height: 1.15;
  transition: background-color 400ms var(--ease), color 400ms var(--ease);
}
:root[data-theme='dark'] .krh__row[data-status='todo'] .krh__status {
  color: var(--ink-2);
}
.krh__row[data-status='work'] .krh__status {
  background: var(--st-work);
}
.krh__row[data-status='done'] .krh__status {
  background: var(--st-done);
}
.krh__row[data-status='stuck'] .krh__status {
  background: var(--st-stuck);
  color: #fff;
}
.krh__row[data-status='stuck'] {
  animation: krh-nudge 600ms var(--ease) 1;
}
@keyframes krh-nudge {
  30% {
    transform: translateX(-3px);
  }
  60% {
    transform: translateX(3px);
  }
}
/* the "today" line runs from week 1 to month 3 while the board plays */
.krh__now {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(122px);
  width: 2px;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.krh.is-playing .krh__now {
  animation: krh-now 2.8s var(--ease) forwards;
}
.krh.is-done .krh__now {
  opacity: 0.55;
  left: calc(100% - 114px - 2px);
  animation: none;
}
@keyframes krh-now {
  from {
    opacity: 0.9;
    left: 122px;
  }
  to {
    opacity: 0.55;
    left: calc(100% - 114px - 2px);
  }
}
.krh__line {
  margin: var(--s-3) 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--st-stuck);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  line-height: 1.5;
}
.krh__stages {
  margin: var(--s-4) 0 0;
  padding: var(--s-4) 0 0;
  border: 0;
  border-top: 1px dashed var(--line-2);
  min-width: 0;
}
.krh__ask {
  margin-bottom: var(--s-2);
  padding: 0;
  color: var(--accent-deep);
}
.krh__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.krh__opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.krh__opt svg {
  color: var(--accent-deep);
}
.krh__opt:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.krh__opt[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 550;
}
.krh__opt[aria-pressed='true'] svg {
  color: var(--on-accent);
}
.krh__opt:focus-visible,
.krh__replay:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.krh__go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--s-3);
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* the hero's numbers row (HeroStats.astro) */
.hstats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: var(--s-6) 0 0;
  border-top: 1px solid var(--line);
  max-width: 640px;
}
.hstats__item {
  padding: 14px 14px 0 0;
}
.hstats__item + .hstats__item {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.hstats__n {
  color: var(--ink);
  font-size: 1.625rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hstats__w {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  .krh__fill,
  .krh__status,
  .krh__row {
    transition: none;
  }
  .krh__row[data-status='stuck'] {
    animation: none;
  }
}

@media (max-width: 640px) {
  .hstats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hstats__item:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .hstats__item:nth-child(n + 3) {
    margin-top: 12px;
  }
  .krh__card {
    padding: var(--s-4);
  }
  .krh__ruler,
  .krh__row {
    grid-template-columns: 92px minmax(0, 1fr) 88px;
  }
  .krh__status {
    font-size: 11px;
  }
  .krh__now {
    display: none;
  }
}
