/* Masheen next-set calculator (T67 stream N). Loaded on /tools/next-set-calculator
   only. Tokens only, no colour literals. Motion: transform and opacity, each
   with a still path. */

/* ---------------------------------------------------------------- frame */
.ns { display: grid; gap: clamp(32px, 5.5vw, 56px); }
.ns [hidden] { display: none !important; }
.no-js .ns-js { display: none !important; }
.js .ns-go { display: none; }
.js .ns-row.is-spare { display: none; }
.ns-block { min-width: 0; margin: 0; padding: 0; border: 0; }
.ns-block > legend { padding: 0; margin-bottom: 12px; }
.ns-block > .hint { margin: -4px 0 12px; max-width: 34em; }

/* ---------------------------------------------------------------- last time, range, reps left */
.ns-in { display: grid; gap: 32px; }
@media (min-width: 900px) {
  .ns-in { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); column-gap: 72px; align-items: start; }
}
.ns-side { display: grid; gap: 32px; }
.ns-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.ns-head h2 { margin: 0; }
.ns-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--iron-raised); }
.ns-seg a { display: inline-grid; place-items: center; min-width: 56px; min-height: 44px; border-radius: var(--r-button); color: var(--chalk-dim); font: 700 18px/1 var(--f-display); letter-spacing: .5px; text-transform: uppercase; text-decoration: none; }
.ns-seg a[aria-current="true"] { background: var(--chalk); color: var(--on-chalk); }

.ns-rows { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.ns-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 4px 8px; }
.ns-field { position: relative; display: block; min-width: 0; }
.ns-field .input { min-height: 48px; padding: 0 12px; font: 700 24px/1 var(--f-display); letter-spacing: .3px; }
.ns-w .input { padding-right: 40px; text-align: right; }
.ns-u { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--chalk-dim); font-size: 13px; font-weight: 600; pointer-events: none; }
.ns-r .input { width: 52px; padding: 0; text-align: center; }
.ns-x { color: var(--chalk-dim); font: 700 20px/1 var(--f-display); }
.ns-reps { display: inline-flex; align-items: center; gap: 4px; }
.ns-reps .step-btn { width: 44px; height: 44px; flex: none; }
.ns-reps .step-btn svg { width: 16px; height: 16px; }
.ns-del { grid-column: 4; grid-row: 1; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--chalk-dim); }
.ns-del svg { width: 16px; height: 16px; }
.ns-del svg path { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.ns-del[disabled] { opacity: .25; }
.no-js .ns-row { grid-template-columns: minmax(0, 1fr) auto 84px; }
.no-js .ns-r .input { width: 100%; }
.ns-tag { display: none; grid-column: 1 / -1; grid-row: 2; padding-left: 2px; font: 600 11px/1.2 var(--f-body); letter-spacing: 1.3px; text-transform: uppercase; color: var(--chalk-dim); }
.ns-rows:has(.ns-row:not(.is-spare) ~ .ns-row:not(.is-spare)) .ns-row.is-best .ns-tag { display: block; }
.ns-rows:has(.ns-row:not(.is-spare) ~ .ns-row:not(.is-spare)) .ns-row.is-best .ns-w .input { border-color: var(--steel-light); }
.ns-add { margin-top: 12px; min-height: 44px; }
.ns-best { margin-top: 14px; max-width: 34em; color: var(--chalk-dim); font-size: 14px; line-height: 1.45; }

/* a pair of big numerals with their own steppers: the range, and the reps that earn a step */
.ns-range-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ns-stepper .step-btn { width: 48px; height: 48px; flex: none; }
.ns-stepper .step-btn svg { width: 18px; height: 18px; }
.ns-big { display: inline-flex; padding: 0 2px; }
.ns-big input { width: 2.1ch; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--chalk); text-align: center; font: 700 clamp(48px, 12vw, 64px)/1 var(--f-display); font-variant-numeric: tabular-nums; }
.ns-big input:focus { outline: none; border-bottom-color: var(--steel-light); }
.ns-to { color: var(--chalk-dim); font-size: 16px; }
.no-js .ns-big input { width: 3ch; border-bottom-color: var(--steel-light); }
@media (max-width: 479px) {
  .ns-range .ns-range-row { gap: 6px 8px; flex-wrap: nowrap; }
  .ns-range .ns-stepper { gap: 2px; }
  .ns-range .ns-stepper .step-btn { width: 44px; height: 44px; }
  .ns-range .ns-big input { width: 1.7ch; min-width: 44px; font-size: 44px; }
  .ns-range .ns-to-end { display: none; }
}

/* reps left in the tank: a short track that fills from the left */
.ns-tank-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.ns-track { flex: 1 1 250px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 360px; }
.ns-tick { display: grid; gap: 8px; align-content: start; min-height: 52px; padding: 6px 0 4px; border: 0; background: transparent; color: var(--chalk-dim); text-align: center; }
.ns-tick i { position: relative; display: block; height: 14px; border-radius: 4px; background: var(--steel); }
.ns-tick i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--chalk); opacity: 0; transform: scaleX(.3); transform-origin: left; transition: opacity 160ms ease, transform 220ms cubic-bezier(.16, 1, .3, 1); }
.ns-tick.is-full i::after { opacity: 1; transform: none; }
.ns-tick:first-child i { background: transparent; box-shadow: inset 0 0 0 2px var(--steel); }
.ns-tick b { font: 600 15px/1 var(--f-body); }
.ns-tick[aria-pressed="true"] { color: var(--chalk); }
.ns-tick[aria-pressed="true"] b { font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ns-tick[aria-pressed="true"]:first-child i { box-shadow: inset 0 0 0 2px var(--chalk); }
.ns-tick:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; border-radius: 6px; }
.ns-unknown { flex: none; }

/* ---------------------------------------------------------------- the answer */
.ns-result { min-width: 0; }
.ns-next { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px .1em; margin: 8px 0 0; font: 700 clamp(64px, 18.5vw, 176px)/.9 var(--f-display); letter-spacing: -1px; }
.ns-fig { display: inline-flex; align-items: baseline; }
.ns-next .unit { font-size: .26em; letter-spacing: 0; }
.ns-next .roll { height: .9em; }
.ns-next .roll .c, .ns-next .roll .col span, .ns-next .roll .sep { height: .9em; line-height: .9; }
.ns-times { margin: 0 .1em; font-size: .46em; color: var(--chalk-dim); }
.ns-chip { align-self: center; margin-left: 4px; letter-spacing: .3px; }

/* the bar runs from gutter to gutter; its glow is never clipped */
.ns-bleed { margin-top: 22px; padding-inline: var(--gutter); }
.ns-stage { position: relative; }
.ns-stage > svg { display: block; width: 100%; height: auto; overflow: visible; }
.ns-svg .ns-kept .pm-label:not(.is-out) { fill: var(--on-chalk); }

.ns-under { display: grid; gap: 16px; margin-top: 18px; }
.ns-cap { font: 700 clamp(22px, 4vw, 30px)/1.05 var(--f-display); letter-spacing: .3px; }
.ns-says { display: grid; gap: 10px; }
.ns-why { max-width: 38em; font-size: clamp(18px, 2.4vw, 21px); line-height: 1.5; }
.ns-note { position: relative; max-width: 40em; padding-left: 16px; color: var(--chalk-dim); font-size: 15px; line-height: 1.5; }
.ns-note::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: var(--steel-light); }
.ns-share { color: var(--chalk-dim); font-size: 14px; }

/* the rep ladder: one rung a rep, last time filled, the next target marked */
.ns-ladder-box { margin-top: 6px; }
.ns-ladder { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); align-items: end; gap: 6px; max-width: calc(var(--n, 3) * 64px); }
.ns-cell { display: grid; gap: 7px; justify-items: stretch; text-align: center; color: var(--chalk-dim); }
.ns-cell i { position: relative; display: block; height: 56px; border-radius: 6px; background: var(--steel); }
.ns-cell i::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--chalk); box-shadow: inset 0 1.5px 0 var(--plate-hl); opacity: 0; transform: scaleY(.25); transform-origin: bottom; transition: opacity 180ms ease, transform 280ms cubic-bezier(.16, 1, .3, 1); }
.ns-cell.is-done i::after { opacity: 1; transform: none; }
.ns-cell.is-out i { height: 30px; }
@media (min-width: 900px) {
  .ns-ladder { max-width: calc(var(--n, 3) * 84px); gap: 8px; }
  .ns-cell i { height: 72px; border-radius: 8px; }
  .ns-cell.is-out i { height: 38px; }
  .ns-cell b { font-size: 15px; }
}
.ns-cell.is-out { margin-right: 6px; }
.ns-cell.is-out:last-child { margin: 0 0 0 6px; }
.ns-cell b { font: 600 13px/1 var(--f-body); font-variant-numeric: tabular-nums; }
.ns-cell.is-next:not(.is-done) i { background: var(--iron-floor); box-shadow: inset 0 0 0 2px var(--steel-light); }
.ns-cell.is-next b { color: var(--chalk); font-weight: 700; }
.ns-cell.is-next.is-live i { background: var(--ember); box-shadow: 0 0 22px var(--ember-glow); }
.ns-cell.is-next.is-live i::after { opacity: 0; }
.ns-cell.is-next.is-live b { color: var(--ember-text); }

/* ---------------------------------------------------------------- the next sessions */
.ns-run-say { margin-top: 10px; max-width: 38em; font-size: 17px; line-height: 1.5; }
.ns-run-list { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 22px 18px; margin: 20px 0 0; padding: 0; list-style: none; }
.ns-run-g { display: grid; gap: 10px; }
.ns-run-w { font: 700 24px/1 var(--f-display); letter-spacing: .3px; }
.ns-run-w small { margin-left: .22em; font-size: .58em; font-weight: 600; color: var(--chalk-dim); }
.ns-run-bar { position: relative; display: flex; align-items: center; gap: 4px; height: 92px; padding: 0 12px; }
.ns-run-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--steel); }
.ns-run-p { position: relative; display: grid; place-items: center; width: 28px; height: var(--h, 100%); border-radius: 7px; background: var(--chalk); color: var(--on-chalk); box-shadow: inset 0 1.5px 0 var(--plate-hl); }
.ns-run-p b { font: 700 17px/1 var(--f-display); }
.ns-run-note { margin-top: 16px; max-width: 44em; }
@media (min-width: 900px) {
  .ns-run-list { gap: 28px 26px; }
  .ns-run-bar { height: 124px; gap: 6px; padding: 0 16px; }
  .ns-run-p { width: 38px; border-radius: 9px; }
  .ns-run-p b { font-size: 22px; }
  .ns-run-w { font-size: 30px; }
}
@keyframes ns-rack { from { opacity: 0; transform: translateX(18px); } }
.js .ns-run-p { animation: ns-rack 340ms cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i, 1) * 45ms); }

/* ---------------------------------------------------------------- the rule's settings */
.ns-setup-grid { display: grid; gap: 30px; margin-top: 20px; padding-top: 24px; border-top: 1px solid var(--hairline); }
@media (min-width: 900px) {
  .ns-setup-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 72px; }
}
.ns-setup .chips + .hint { margin: 12px 0 0; max-width: 34em; }
.ns-hist { display: grid; gap: 12px; }
.ns-hrow { grid-template-columns: minmax(0, 1fr) auto 84px; max-width: 340px; }
.ns-hrow .ns-r .input { width: 100%; }
.ns-hname { grid-column: 1 / -1; font-size: 14px; font-weight: 600; }
.ns-verdict { position: relative; margin-top: 16px; max-width: 34em; padding-left: 16px; color: var(--chalk-dim); font-size: 15px; line-height: 1.5; }
.ns-verdict::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: var(--steel); }
.ns-stall[data-state="stalled"] .ns-verdict, .ns-stall[data-state="moving"] .ns-verdict { color: var(--chalk); font-size: 17px; }
.ns-stall[data-state="stalled"] .ns-verdict::before, .ns-stall[data-state="moving"] .ns-verdict::before { background: var(--chalk); }
.ns-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }

/* ---------------------------------------------------------------- under the tool */
.ns-tbl td, .ns-tbl th { vertical-align: top; }
.ns-ref { white-space: nowrap; }
.ns-sources { padding-left: 1.6em; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.ns-sources li { padding-left: 4px; scroll-margin-top: 96px; }
.ns-read { display: block; margin-top: 2px; font-size: 13px; color: var(--chalk-dim); }

@media (prefers-reduced-motion: reduce) {
  .ns-tick i::after, .ns-cell i::after { transition: none; }
  .js .ns-run-p { animation: none; }
}
