/* Section 01 Pace. OWNER: pace worker. Fixed geometry: every box that shows a changing value has an explicit size. */
/* ---------- 01 pace ----------
   Fixed-geometry instrument: every box that shows a changing value has an explicit size,
   changing text is left-anchored, and motion is transform/opacity/clip-path only. */
.pace { padding-top: 24px; }
.pace-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gut);
  contain: layout;
}
.pace-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 16px; align-items: baseline;
  height: 16px; line-height: 16px;
}
.sec-title-sm { margin: 0; font: 500 var(--t-xs) var(--f-mono); line-height: 16px; }
.hero-label { margin: 0; color: var(--grey-t); transition: color .2s; white-space: nowrap; line-height: 16px; position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 12px; margin-left: -12px; }
.hero-label::before { content: ''; position: absolute; left: 0; top: 5px; width: 6px; height: 6px; background: var(--red); transform: scale(0); transition: transform .3s var(--expo); }
.hero-label.scrub { color: var(--ink); }
.hero-label.scrub::before { transform: none; }
.sync-mobile { display: none; }

/* hero numeral: a box sized for "Rp 99.999.999"; slots are absolutely placed and moved with transforms.
   Wider values (9 IDR digits, a minus sign) are scaled down inside the box by odometer.ts (transform only). */
.hero { grid-column: 1 / 4; margin-top: 16px; min-width: 0; }
.hero-num {
  --hs: min(clamp(96px, 11vw, 168px), calc((min(100vw, var(--maxw) + 2 * var(--pad)) - 2 * var(--pad)) / 4.5));
  position: relative; margin: 0;
  font-size: var(--hs);
  width: 4.43em; height: .8em; line-height: .8;
  font-weight: 760; letter-spacing: -.035em; white-space: nowrap;
  font-variation-settings: 'wdth' 75;
  contain: layout size;
}
.rp {
  position: absolute; left: 0; top: .035em;
  font-size: .17em; font-weight: 600; letter-spacing: 0; line-height: 1;
  font-variation-settings: 'wdth' 100;
}
.odo { position: absolute; left: 0; top: 0; width: 100%; height: .8em; transform-origin: 0 100%; }
.odo-in { position: absolute; inset: 0; transform-origin: 0 100%; transition: transform .75s var(--expo); }
.odo-digits { position: absolute; inset: 0; transition: opacity .3s var(--ease); }
.odo-compact { position: absolute; left: .36em; top: 0; height: .8em; line-height: .8em; white-space: nowrap; }
html[data-motion="off"] .odo-in, html[data-motion="off"] .odo-digits { transition: none; }
.oc, .osep {
  position: absolute; left: 0; top: 0; height: .8em;
  clip-path: inset(0 -.12em);           /* clip vertically for the roll, allow side overhang */
  opacity: 0;
}
.oc { width: .455em; }
.osep { width: .215em; line-height: .8em; }
.odo.ready .oc, .odo.ready .osep { transition: transform .75s var(--expo), opacity .35s var(--ease); }
.os { display: block; will-change: transform; }
.os i { font-style: normal; display: block; height: .8em; line-height: .8em; }

/* caption: the day under the scrubber, fixed rows updated in place */
.caption {
  grid-column: 4; align-self: end;
  height: 108px; overflow: hidden;
  border-left: 1px solid var(--hair); padding-left: 16px; color: var(--ink);
  contain: layout size;
}
.caption .cap-date, .caption li, .caption .cap-more {
  display: grid; grid-template-columns: minmax(0, 1fr) 14ch; column-gap: 12px;
  height: 18px; line-height: 18px; margin: 0;
}
.caption .cap-date span:last-child, .caption li span:last-child { text-align: right; }
.caption .cap-date { grid-template-columns: minmax(0, 1fr) 22ch; }
.caption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption .cap-date .cap-amt { color: var(--grey-t); }
.caption ul { list-style: none; margin: 0; padding: 0; }
.caption li { color: var(--grey-t); }
.caption li.rec span:first-child::after { content: ', fixed'; }
.caption .cap-more { display: block; color: var(--grey-t); }

/* summary: four fixed columns on the same grid as the hero + caption */
.stats {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gut);
  margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--ink);
}
.stat { min-width: 0; position: relative; }
.stat-k { margin: 0; height: 16px; line-height: 16px; color: var(--grey-t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.warn .stat-k::before { content: ''; position: absolute; left: -14px; top: 5px; width: 7px; height: 7px; background: var(--red); }
.stat-v {
  margin: 4px 0 0; height: 32px; line-height: 32px;
  font-size: 28px; font-weight: 620; font-stretch: 85%; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden;
}
.summary-sub { grid-column: 1 / -1; margin: 12px 0 0; height: 16px; line-height: 16px; color: var(--grey-t); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget-btn {
  font-weight: inherit; line-height: 1.1; min-width: 6ch; text-align: left;
  text-decoration: underline dotted 1.5px; text-underline-offset: 5px;
}
.budget-btn:hover { text-decoration-style: solid; text-decoration-color: var(--red); }
.budget-btn[hidden] { display: none; }
.budget-edit { display: flex; align-items: baseline; gap: 8px; position: relative; width: 100%; height: 100%; }
.budget-edit[hidden] { display: none; }
.budget-edit .be-cur { flex: none; font-size: .5em; font-weight: 600; color: var(--grey-t); }
.budget-edit input {
  flex: 0 1 6.2em; width: 6.2em; min-width: 0; border: 0; border-bottom: 2px solid var(--red); background: transparent;
  font-weight: inherit; padding: 0; outline: none; height: 30px; line-height: 30px; border-radius: 0;
  font-stretch: 85%;
}
.budget-edit input[aria-invalid="true"] { border-bottom-style: dashed; }
.budget-edit .btn-text { flex: none; line-height: 16px; }
.budget-edit .btn-text[disabled] { color: var(--grey-t); cursor: progress; }
.budget-edit .err-tip { position: absolute; left: 0; top: 100%; margin-top: 4px; max-width: 100%; font: 400 var(--t-xs) var(--f-mono); line-height: 16px; color: var(--red-t); white-space: normal; background: var(--paper); z-index: 2; letter-spacing: 0; }
.budget-edit .err-tip:empty { display: none; }
.stat-budget .stat-v { overflow: visible; position: relative; }

.pace-fig { margin: 24px auto 0; max-width: calc(var(--maxw) + 2 * var(--pad)); }
.chart-box { position: relative; }
.chart { position: relative; width: 100%; touch-action: pan-y; outline: none; user-select: none; -webkit-user-select: none; }
.chart:focus-visible { box-shadow: inset 0 0 0 2px var(--red); }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--f-mono); font-size: 11px; fill: var(--grey-t); paint-order: stroke; stroke: var(--paper); stroke-width: 5px; stroke-linejoin: round; }
.scrub text { stroke: none; }
.chart .t-ink { fill: var(--ink); }
.chart .t-red { fill: var(--red-t); }
.g-grid line { stroke: var(--hair); stroke-width: 1; }
.c-area { fill: var(--ink); opacity: .045; transition: opacity .6s; }
.c-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-over { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-ideal { fill: none; stroke: var(--grey); stroke-width: 1; }
.c-proj { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 5; stroke-linecap: round; transition: opacity .5s; }
.c-proj.over { stroke: var(--red); }
.c-budget { stroke: var(--ink); stroke-width: 1; }
.c-today { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 1 3; transition: opacity .5s; }
.c-enddot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.c-hl-area { fill: var(--red); opacity: 0; transition: opacity .35s var(--ease); }
.c-hl-line { fill: none; stroke: var(--red); stroke-width: 1.5; opacity: 0; transition: opacity .35s var(--ease); }
.hl-on .c-hl-area { opacity: .13; }
.hl-on .c-hl-line { opacity: 1; }
.hl-on .c-line, .hl-on .c-over { stroke: var(--ink); opacity: .35; }
.hl-on .tk-v { fill: var(--mute); }
.tk-v { fill: var(--ink); transition: fill .3s; }
.tk-hl { fill: var(--red); }
.tk-r { fill: none; stroke: var(--ink); stroke-width: 1; }
.tk-n { stroke: var(--grey); stroke-width: 2; stroke-dasharray: 2 2; }
.tk-f { fill: var(--mute); }
.tk-break { fill: var(--paper); }
.tk-pulse { fill: var(--red) !important; }
.c-base { stroke: var(--ink); stroke-width: 1; }
.scrub { pointer-events: none; transition: opacity .2s; }
.scrub line { stroke: var(--red); stroke-width: 1; }
.scrub circle { fill: var(--red); stroke: var(--paper); stroke-width: 2.5; }
.scrub rect { fill: var(--red); }
.scrub text { fill: var(--paper); font-weight: 500; }

/* intro: ticks rise, lines draw */
.tk-v, .tk-hl { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .9s var(--expo) var(--td, 0ms), fill .3s; }
svg.intro .tk-v { transform: scaleY(0); }
.tk-r, .tk-n { transition: opacity .6s var(--ease) calc(var(--td, 0ms) + 300ms); }
svg.intro .tk-r, svg.intro .tk-n { opacity: 0; }
.draw { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s cubic-bezier(.65, 0, .35, 1) var(--dd, 0ms); }
svg.intro .draw { stroke-dashoffset: 1; }
svg.intro .c-area, svg.intro .c-proj, svg.intro .c-today, svg.intro .c-enddot, svg.intro .lbl { opacity: 0; }
.lbl { transition: opacity .6s var(--ease) .9s; }
.c-enddot { transition: opacity .4s 1.4s; }

.legend { display: flex; justify-content: space-between; align-items: center; gap: 24px; height: 24px; margin: 0 auto 8px; color: var(--grey-t); }
.legend-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; padding: 0; }
.legend-list li { display: inline-flex; align-items: center; gap: 8px; line-height: 16px; }
#tableToggle { width: 13ch; text-align: right; flex: none; }
.lg { display: inline-block; width: 18px; height: 10px; position: relative; }
.lg-line::after, .lg-ideal::after, .lg-proj::after { content: ''; position: absolute; left: 0; right: 0; top: 4px; }
.lg-line::after { border-top: 2px solid var(--ink); }
.lg-ideal::after { border-top: 1px solid var(--grey); transform: rotate(-18deg); }
.lg-proj::after { border-top: 2px dotted var(--ink); }
.lg-var { width: 2px; height: 12px; background: var(--ink); margin: 0 8px; }
.lg-rec { width: 6px; height: 10px; border: 1px solid var(--ink); margin: 0 6px; }

/* the table covers the chart box (same size), so showing it moves nothing */
.table-wrap { position: absolute; inset: 0; z-index: 2; overflow: auto; background: var(--paper); padding: 8px var(--pad) 0; border-top: 1px solid var(--ink); }
.table-wrap[hidden] { display: none; }
.table-wrap:focus-visible { outline-offset: -2px; }
.table-wrap table { border-collapse: collapse; width: 100%; max-width: 640px; font: 400 var(--t-xs) var(--f-mono); }
.table-wrap th, .table-wrap td { text-align: right; padding: 5px 12px 5px 0; border-bottom: 1px solid var(--hair); }
.table-wrap th:first-child, .table-wrap td:first-child { text-align: left; }
.table-wrap th { color: var(--grey-t); font-weight: 400; position: sticky; top: 0; background: var(--paper); }

@media (max-width: 760px) {
  .pace { padding-top: 16px; }
  .pace-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
  .pace-head { grid-template-columns: auto auto minmax(0, 1fr); grid-template-rows: 16px 16px; row-gap: 4px; height: 36px; }
  .pace-head .hero-label { grid-column: 1 / -1; grid-row: 2; }
  .hero { grid-column: 1 / -1; margin-top: 16px; }
  .summary-sub { order: 4; }
  .stats { order: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 12px; margin-top: 20px; }
  .stat-v { font-size: 22px; height: 28px; line-height: 28px; }
  .stat.warn .stat-k::before { left: auto; right: 0; }
  .summary-sub { height: 32px; white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; margin-top: 12px; }
  .caption { grid-column: 1 / -1; order: 5; height: 72px; margin-top: 16px; border-left: 0; border-top: 1px solid var(--hair); padding: 8px 0 0; box-sizing: content-box; }
  .caption li:nth-child(n+3) { display: none; }
  .pace-fig { margin-top: 16px; display: flex; flex-direction: column; }
  .legend { order: 2; height: auto; flex-direction: column; align-items: flex-start; gap: 8px; margin: 12px 0 0; }
  .legend-list { gap: 8px 16px; }
  #tableToggle { width: auto; text-align: left; }
  .pace-fig .chart-box { order: 1; }
  /* narrow: the budget editor overlays the Projected cell next to it instead of squeezing into one column */
  .stat-budget .budget-edit { position: absolute; left: 0; top: 0; width: calc(200% + 16px); height: 28px; background: var(--paper); z-index: 2; }
  .budget-edit input { height: 26px; line-height: 26px; }
}
