/* ---------- 4b. A night shift in five seconds (sections/case.js) ----------
   Default (no JS, reduced motion): the finished morning, as a still.
   .ns.armed (set by case.js): the evening's empty start; case.js plays it through when in view. */

.ns { width: min(var(--wall), 100%); margin: 4rem 0 0; background: var(--paper); border: 1px solid var(--ui-line); }

.ns-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; padding: 1.75rem 2rem 1.5rem; border-bottom: 1px solid var(--ui-line); }
.ns-tag, .ns-label, .ns-phase, .ns-ends, .ns-held { font: 500 0.6875rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.ns-tag { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.ns-tag::after { content: ""; width: 2.5rem; height: 1px; background: var(--ui-line); }
.ns-title { font-size: clamp(1.5rem, 2.4vw, 2.25rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }

.ns-clock { display: grid; grid-template-columns: 1fr; justify-items: end; width: 13rem; flex: none; text-align: right; }
.ns-time { margin: 0.4rem 0 0.8rem; font: 600 clamp(2.2rem, 3.4vw, 3rem)/1 var(--font-sans); letter-spacing: -0.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.ns-track { position: relative; display: block; width: 100%; height: 1px; background: var(--ui-line); }
.ns-fill { position: absolute; inset: 0 auto 0 0; width: var(--p, 100%); background: var(--ink); }
.ns-fill::after { content: ""; position: absolute; right: -2.5px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.ns-ends { display: flex; justify-content: space-between; width: 100%; margin-top: 0.6rem; letter-spacing: 0.06em; }

.ns-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ns-panel { position: relative; padding: 1.5rem 2rem 2rem; }
.ns-panel + .ns-panel, .ns-side { border-left: 1px solid var(--ui-line); }
.ns-side { display: grid; grid-template-rows: auto 1fr; }
.ns-side .ns-panel + .ns-panel { border-left: 0; border-top: 1px solid var(--ui-line); }
.ns-label { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.9rem; color: var(--ink); }
.ns-label span { color: var(--muted); }

/* rows: a mono ledger line, same height in every panel so a sale lands exactly in its slot */
.ns-row {
  display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto 0.9rem; align-items: center; column-gap: 0.75rem;
  height: 2.6rem; border-top: 1px solid var(--ui-line);
  font: 400 0.8125rem/1 var(--font-mono); letter-spacing: 0; color: var(--ink); font-variant-numeric: tabular-nums;
  white-space: nowrap; will-change: transform, opacity; position: relative; z-index: 1;
}
.ns-row:last-child { border-bottom: 1px solid var(--ui-line); }
.ns-id { color: var(--muted); }
.ns-who { overflow: hidden; text-overflow: ellipsis; }
.ns-amt { text-align: right; }
.ns-src .ns-row.sent { color: var(--muted); }
.ns-src .ns-row.sent .ns-who, .ns-src .ns-row.sent .ns-amt { opacity: 0.55; transition: opacity 500ms var(--ease); }
.ns-row.fly { background: var(--paper); z-index: 3; border-color: transparent; box-shadow: 0 0 0 0.6rem var(--paper), 0 0 0 calc(0.6rem + 1px) var(--ui-line), 0 0.9rem 2rem -0.6rem rgb(0 0 0 / 0.22); }

.ns-tick { width: 0.9rem; height: 0.9rem; overflow: visible; }
.ns-tick path { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.ns-held { grid-column: 4; justify-self: end; font-size: 0.625rem; letter-spacing: 0.1em; color: var(--ink); }
.ns-hold .ns-row { grid-template-columns: 4.6rem minmax(0, 1fr) auto 2.8rem; }

.ns-why { padding-top: 1rem; font-size: 0.9375rem; line-height: 1.4; letter-spacing: -0.01em; }
.ns-why ul { margin-top: 0.9rem; display: grid; gap: 0.5rem; font: 400 0.8125rem/1 var(--font-mono); letter-spacing: 0; color: var(--muted); }
.ns-why li { display: flex; align-items: center; gap: 0.6rem; }
.ns-why li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1px solid currentColor; }

.ns-card { display: grid; gap: 0.45rem; font-size: 0.9375rem; line-height: 1.4; letter-spacing: -0.01em; }
.ns-card p:first-child { font-weight: 600; }
.ns-dim { color: var(--muted); }

.ns-empty { display: none; position: absolute; left: 2rem; top: 4.4rem; font: 400 0.8125rem/1 var(--font-mono); color: var(--muted); transition: opacity 300ms var(--ease); }

/* ---- armed: the evening before. Rows are positioned by case.js; the rest are class switches. */
.ns.armed .ns-empty { display: block; }
.ns.armed .has .ns-empty { opacity: 0; }
.ns.armed .ns-tick path { stroke-dashoffset: 1; transition: stroke-dashoffset 380ms var(--ease); }
.ns.armed .ns-row.done .ns-tick path { stroke-dashoffset: 0; }
.ns.armed .ns-held { opacity: 0; transition: opacity 300ms var(--ease); }
.ns.armed .ns-row.done .ns-held { opacity: 1; }
/* the sale only becomes an invoice once it lands */
.ns.armed .ns-dst .ns-id { transition: opacity 300ms var(--ease); }
.ns.armed .ns-dst .ns-row.fly .ns-id { opacity: 0; }
.ns.armed .ns-why, .ns.armed .ns-card { opacity: 0; transform: translateY(12px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
.ns.armed .on > .ns-why, .ns.armed .on > .ns-card { opacity: 1; transform: none; }
.ns.armed .ns-why li { opacity: 0; transition: opacity 500ms var(--ease) 350ms; }
.ns.armed .on .ns-why li + li { transition-delay: 450ms; }
.ns.armed .on .ns-why li { opacity: 1; }

@media (max-width: 1199px) {
  .ns-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ns-side { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; border-left: 0; border-top: 1px solid var(--ui-line); }
  .ns-side .ns-panel + .ns-panel { border-top: 0; border-left: 1px solid var(--ui-line); }
}

/* phone: two ledgers side by side, each row on two lines */
@media (max-width: 640px) {
  .ns { margin-top: 3rem; }
  .ns-head { flex-direction: column; align-items: stretch; gap: 1.1rem; padding: 1.1rem 0.75rem; }
  .ns-tag { margin-bottom: 0.7rem; }
  .ns-title { font-size: 1.375rem; }
  .ns-clock { width: 100%; grid-template-columns: auto 1fr; justify-items: start; align-items: end; column-gap: 1rem; text-align: left; }
  .ns-phase { grid-column: 1 / -1; }
  .ns-time { margin: 0.35rem 0 0; font-size: 1.75rem; }
  .ns-track { align-self: center; margin-top: 0.6rem; }
  .ns-ends { grid-column: 2; margin-top: 0.4rem; }
  .ns-panel { padding: 1rem 0.75rem 1.25rem; }
  .ns-label { padding-bottom: 0.7rem; }
  .ns-label span { display: none; }
  .ns-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 0.25rem; column-gap: 0.4rem; height: 2.75rem; align-content: center; font-size: 0.75rem; }
  .ns-id { grid-row: 1; grid-column: 1; }
  .ns-amt { grid-row: 1; grid-column: 2; }
  .ns-who { grid-row: 2; grid-column: 1; }
  .ns-tick, .ns-held { grid-row: 2; grid-column: 2; justify-self: end; }
  .ns-hold .ns-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ns-why, .ns-card { font-size: 0.8125rem; }
  .ns-why ul { font-size: 0.6875rem; }
  .ns-empty { left: 0.75rem; top: 3.4rem; font-size: 0.75rem; }
  .ns.armed .ns-empty { right: 0.75rem; border-top: 1px dashed var(--ui-line); padding-top: 0.8rem; }
}
