/* ============================================================
   mayurkakade.dev — Standpulse hero: "a board that breathes"
   All classes prefixed sp- (zero collision with styles.css /
   hero.css / casestudy.css). Requires styles.css first (tokens).

   DEFAULT DOM STATE = COMPLETED REST FRAME.
   The markup is the fully-populated board: bars full at their
   colours, blocker card present, clock red at 01:12:44.
   JS adds .sp-anim to .sp-hero, which only MUTES the pieces the
   timeline will bring back in. No JS / reduced motion / mobile
   => the finished board is simply what the markup renders.
   ============================================================ */

/* ---- hero-local tokens (NOT added to styles.css) ---- */
.sp-hero {
  --sp-amber:        #E8912B;   /* in progress          */
  --sp-amber-tint:   #FDF1E1;
  --sp-amber-border: #F6D9AE;
  --sp-crit:         #E5484D;   /* overdue / blocked    */
  --sp-crit-tint:    #FDECEC;
  --sp-crit-border:  #F7C7C8;

  position: relative;
}

/* ---- radial edge fade, same grammar as the home hero ---- */
.sp-fademask {
  -webkit-mask-image: radial-gradient(105% 96% at 50% 48%, #000 66%, rgba(0, 0, 0, 0) 99%);
  mask-image: radial-gradient(105% 96% at 50% 48%, #000 66%, rgba(0, 0, 0, 0) 99%);
  padding: 14px 10px 30px;
}

/* ---- the board ---- */
.sp-board {
  max-width: 980px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 22px 26px 26px;
}

/* ---- topbar: live badge + week strip ---- */
.sp-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.sp-live {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  color: var(--text-2); white-space: nowrap;
}
.sp-live__dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-tint);
}
.sp-week { display: inline-flex; gap: 5px; }
.sp-day {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  color: var(--text-3);
  padding: 4px 8px; border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.sp-day--today {
  color: var(--accent); font-weight: 700;
  background: var(--accent-tint);
  border-color: var(--accent-border);
}
.sp-anim .sp-day:not(.sp-on) { opacity: 0; transform: translateY(-5px); }

/* ---- two columns ---- */
.sp-cols {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 26px;
  align-items: start;
}
.sp-colhead {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 13px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.sp-colhead i {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
}
.sp-colhead--flow i { background: var(--accent); }
.sp-colhead--matrix i { background: var(--sp-crit); }
.sp-anim .sp-colhead:not(.sp-on) { opacity: 0; transform: translateY(4px); }

/* ---- task rows: assignee + progress bar + status tag ---- */
.sp-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 6px 0;
}
.sp-who {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.4s ease;
}
.sp-anim .sp-row:not(.sp-on) .sp-who { opacity: 0.4; }

.sp-track {
  position: relative; display: block;
  height: 28px;
  background: var(--bg-2);
  border-radius: 9px;
  overflow: hidden;
}
/* the fill's authored width IS the rest state; .sp-anim only mutes it to 0
   so removing the mute (adding .sp-on) transitions it back left->right */
.sp-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: var(--sp-w, 100%);
  border-radius: 9px;
  overflow: hidden; white-space: nowrap;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.sp-anim .sp-row:not(.sp-on) .sp-fill { width: 0; }

.sp-row--done .sp-fill { background: var(--green); }
.sp-row--prog .sp-fill { background: var(--sp-amber); }
.sp-row--late .sp-fill { background: var(--sp-crit); }

.sp-task {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  color: #FFFFFF; letter-spacing: 0.2px;
}

.sp-tag {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
  /* the .55s delay lets the bar mostly fill before its verdict lands */
  transition: opacity 0.35s ease 0.55s, transform 0.35s var(--ease-spring) 0.55s;
}
.sp-anim .sp-row:not(.sp-on) .sp-tag { opacity: 0; transform: scale(0.88); }
.sp-tag--done { color: var(--green);    background: var(--green-tint);    border-color: #BEEBD4; }
.sp-tag--prog { color: var(--sp-amber); background: var(--sp-amber-tint); border-color: var(--sp-amber-border); }
.sp-tag--late { color: var(--sp-crit);  background: var(--sp-crit-tint);  border-color: var(--sp-crit-border); }

/* ---- blocker card ---- */
.sp-bcard {
  background: var(--surface);
  border: 1px solid var(--sp-crit-border);
  border-radius: 14px;
  padding: 15px 17px 14px;
  box-shadow: 0 10px 26px rgba(229, 72, 77, 0.09);
  transition: opacity 0.5s ease, transform 0.5s var(--ease-spring);
}
.sp-anim .sp-bcard:not(.sp-on) { opacity: 0; transform: translateY(10px) scale(0.97); }

.sp-bcard__top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.sp-bchip {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--sp-crit); background: var(--sp-crit-tint);
  border: 1px solid var(--sp-crit-border);
  border-radius: 999px; padding: 3px 9px;
}
.sp-bwho { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.sp-btask {
  font-family: var(--display); font-size: 15px; font-weight: 700;
  color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em;
}
.sp-bresolve { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-bottom: 13px; }
.sp-bresolve b { color: var(--text-2); font-weight: 600; }

.sp-bclock { display: flex; flex-direction: column; gap: 2px; }
.sp-bclock__label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase; color: var(--text-3);
}
.sp-ticker {
  font-family: var(--mono); font-size: 30px; font-weight: 700;
  letter-spacing: 1px; line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.sp-ticker--late { color: var(--sp-crit); }
.sp-bhint { font-family: var(--mono); font-size: 10.5px; color: var(--sp-crit); margin-top: 4px; }

/* ---- replay control (same grammar as hx-replay) ---- */
.sp-replay {
  position: absolute; right: 10px; bottom: 2px;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-3);
  background: none; border: 0; padding: 6px 8px; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease, color 0.2s ease;
}
.sp-replay.sp-show { opacity: 1; pointer-events: auto; }
.sp-replay:hover { color: var(--accent); }

/* ---- replay reset: kill every transition for one reflow so the
   mute-frame snaps into place instead of animating backwards ---- */
.sp-reset *, .sp-reset *::before, .sp-reset *::after {
  transition: none !important;
  animation: none !important;
}

/* ---- reduced motion: no transitions; JS renders the rest frame
   with a static clock (no live ticking) ---- */
@media (prefers-reduced-motion: reduce) {
  .sp-day, .sp-colhead, .sp-who, .sp-fill, .sp-tag, .sp-bcard, .sp-ticker {
    transition: none !important;
  }
}

/* ---- mobile <=760px: simplified static board (JS finalizes) ---- */
@media (max-width: 760px) {
  .sp-fademask { padding: 6px 0 14px; }
  .sp-board { padding: 16px 15px 18px; border-radius: 16px; }
  .sp-week { display: none; }               /* week strip off at small sizes */
  .sp-topbar { margin-bottom: 14px; }
  .sp-cols { grid-template-columns: 1fr; gap: 18px; }
  .sp-row { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; }
  .sp-who { font-size: 10.5px; }
  .sp-task { font-size: 10.5px; left: 9px; }
  .sp-tag { font-size: 9.5px; padding: 3px 8px; }
  .sp-ticker { font-size: 24px; }
  .sp-replay { display: none; }
}
