/* ==========================================================================
   InfiniDataLabs — products.css
   Shared PRODUCT COMPONENT: the SeroState and Koshtur chapters and their
   illustrations. Used by /portfolio.html and /index.html (markup in
   docs/partials-products.html). Core tokens/classes only; no page layout here.
   Line language: 1.5px outlines, 0.75–1px detail and dimension lines, dashed
   hidden lines, Plex Mono labels. One accent per viewport: the say/body gap.
   ========================================================================== */

/* ---------- Chapter ----------------------------------------------------- */
.product { position: relative; scroll-margin-top: calc(var(--header-h) + 24px); }
.product + .product { margin-top: clamp(112px, 13vw, 216px); }

.product__rule { display: flex; align-items: center; gap: var(--s-4); margin-bottom: clamp(28px, 3.4vw, 52px); }
.product__rule .rule { flex: 1; }
.product__sector { color: var(--tx-3); }

.product__head {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-5);
  align-items: end; margin-bottom: clamp(32px, 4vw, 60px);
}
.product__name {
  grid-column: 1 / span 8;
  font-size: clamp(3rem, 1.75rem + 4.6vw, 6rem); line-height: 0.88; letter-spacing: -0.038em;
  font-stretch: 88%; font-weight: 500; color: var(--tx-1);
}
.product__intro { grid-column: 9 / span 4; display: grid; gap: 14px; padding-bottom: 0.35em; }
.product__line { font-size: var(--t-lead); line-height: 1.3; letter-spacing: -0.006em; color: var(--tx-1); font-weight: 420; max-width: 30ch; }
.product__role { display: flex; gap: 14px; align-items: baseline; font-size: var(--t-small); line-height: 1.5; color: var(--tx-2); max-width: 46ch; }
.product__role .k { flex: none; font-family: var(--font-mono); font-size: 11px; line-height: 1; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
@media (max-width: 899px) {
  .product__name, .product__intro { grid-column: 1 / -1; }
  .product__intro { padding-bottom: 0; }
}

.product__body {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-7);
  margin-top: clamp(40px, 5vw, 72px);
}
.product__col { grid-column: span 4; min-width: 0; }
.product__k {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--tx-3); font-weight: 500; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line-2);
}
.product__text { color: var(--tx-2); max-width: 46ch; }
.product__link { margin-top: var(--s-4); }
.product__col .spec { gap: 12px 24px; grid-template-columns: 96px minmax(0, 1fr); }
.product__built { list-style: none; padding: 0; counter-reset: built; display: grid; }
.product__built li {
  counter-increment: built; display: grid; grid-template-columns: 2.75em 1fr; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line-1); color: var(--tx-1); font-size: var(--t-small);
}
.product__built li:first-child { padding-top: 0; }
.product__built li::before { content: counter(built, decimal-leading-zero); font-family: var(--font-mono); font-size: 11px; color: var(--tx-3); letter-spacing: 0.04em; }
@media (max-width: 1023px) {
  .product__col { grid-column: span 6; }
  .product__col:first-child { grid-column: 1 / -1; }
}
@media (max-width: 639px) { .product__col, .product__col:first-child { grid-column: 1 / -1; } }

/* ---------- Figure frame ------------------------------------------------- */
.pfig { margin: 0; --pad: clamp(16px, 2.4vw, 32px); }
.pfig__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 52px; padding: 10px var(--pad); border-bottom: 1px solid var(--line-1);
}
.pfig__title { font-family: var(--font-mono); font-size: 12px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-2); font-weight: 500; }
.pfig__title .idx { color: var(--tx-3); margin-right: 0.9em; }
.pfig__foot {
  display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px var(--pad); border-top: 1px solid var(--line-1);
  font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.07em; text-transform: uppercase; color: var(--tx-3); font-weight: 500;
}
.pfig__foot .lg { display: inline-flex; align-items: center; gap: 10px; }
.pfig__foot .lg::before { content: ""; width: 18px; height: 0; border-top: 1.5px solid var(--tx-1); }
.pfig__foot .lg--eda::before { border-top-color: var(--tx-2); }
.pfig__foot .lg--clin::before { border-top: 1.5px dashed var(--tx-3); }
.pfig__foot .lg--client::before { border-top: 6px solid var(--tx-2); }

/* ---------- SeroState: one session, time-aligned -------------------------
   Lanes are HTML; each plot is an SVG with preserveAspectRatio="none" and
   non-scaling strokes, so line weights hold at every width and every label is
   real text. Positions are minutes: left = (t − t0) / span. On small screens
   the plot zooms to the second half of the session (t0 25, span 25). */
.sero {
  --key: 76px; --t0: 0; --span: 50;
  --h-mini: 0px; --h-ev: 48px; --h-hr: 220px; --h-eda: 60px; --h-voice: 40px; --h-words: 46px; --h-axis: 40px;
  position: relative; padding: clamp(20px, 2.6vw, 36px) var(--pad) clamp(24px, 3vw, 40px);
}
.sero__lanes { position: relative; }
.sero__row { display: grid; grid-template-columns: var(--key) minmax(0, 1fr); }
.sero__row--mini { height: var(--h-mini); display: none; }
.sero__row--ev { height: var(--h-ev); }
.sero__row--hr { height: var(--h-hr); }
.sero__row--eda { height: var(--h-eda); }
.sero__row--voice { height: var(--h-voice); }
.sero__row--words { height: var(--h-words); }
.sero__row--axis { height: var(--h-axis); }

.sero__key {
  position: relative; padding: 9px 12px 0 0; box-shadow: inset -1px 0 0 var(--line-1);
  font-family: var(--font-mono); font-size: 11px; line-height: 1.25; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-2); font-weight: 500;
}
.sero__row--ev .sero__key { box-shadow: none; }
.sero__key > span { display: block; }
.sero__key .u { text-transform: none; letter-spacing: 0.02em; color: var(--tx-3); }
.sero__key .y { position: absolute; right: 10px; top: calc((105 - var(--v)) / 40 * 100%); transform: translateY(-50%); color: var(--tx-3); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.sero__plot { position: relative; overflow: hidden; box-shadow: inset 0 1px 0 var(--line-1); }
.sero__row--ev .sero__plot { box-shadow: none; }
.sero__row--axis .sero__plot { box-shadow: inset 0 1px 0 var(--line-2); }
.sero__svg {
  position: absolute; top: 0; left: 0; height: 100%; max-width: none; overflow: visible;
  width: calc(50 / var(--span) * 100%); transform: translateX(calc(var(--t0) / 50 * -100%));
}
.sero path { fill: none; }
.sero__grid { stroke: var(--line-2); stroke-width: 0.75; stroke-dasharray: 3 4; }
.sero__trace { stroke: var(--tx-1); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.sero__trace--eda { stroke: var(--tx-2); }
.sero__clin { stroke: var(--tx-3); stroke-width: 1.5; }
.sero__client { stroke: var(--tx-2); stroke-width: 6; }
.sero__tick { stroke: var(--line-2); stroke-width: 0.75; }
.sero__tick--mid { stroke: var(--tx-3); stroke-opacity: 0.6; }
.sero__tick--major { stroke: var(--tx-3); stroke-width: 1; }
.sero__row--axis .sero__svg { height: 12px; top: 1px; }

/* shared minute → x position */
.sero__ev, .sero__vline, .sero__ring, .sero__t { left: calc((var(--t) - var(--t0)) / var(--span) * 100%); }

.sero__ev {
  position: absolute; bottom: 8px; padding-left: 8px; border-left: 1px solid var(--line-2); white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.06em; color: var(--tx-2); font-weight: 500;
}
.sero__ev b { font-weight: 500; color: var(--tx-3); margin-right: 0.35em; }
.sero__ev small { display: block; font-size: 10.5px; letter-spacing: 0.03em; color: var(--tx-3); font-weight: 400; }
.sero__ev--gap { color: var(--tx-1); border-left-color: var(--tx-3); }
.sero__ev--gap small { color: var(--tx-2); }

.sero__ring {
  position: absolute; top: calc(var(--y) * 100%); width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  background: var(--bg-1); box-shadow: inset 0 0 0 1.5px var(--tx-1);
}

.sero__quote {
  position: absolute; top: 50%; right: calc(100% - (var(--t) - var(--t0)) / var(--span) * 100% + 12px); transform: translateY(-50%);
  font-size: 15px; line-height: 1.2; color: var(--tx-1); white-space: nowrap; letter-spacing: 0;
}

.sero__t {
  position: absolute; top: 17px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1; letter-spacing: 0.04em; color: var(--tx-3); font-variant-numeric: tabular-nums;
}
.sero__t--first { transform: none; }
.sero__t--last { transform: translateX(-100%); }

/* overlay: event lines, gap dimension, session end, playhead */
.sero__over {
  position: absolute; left: var(--key); right: 0; pointer-events: none; overflow: hidden;
  top: calc(var(--h-mini) + var(--h-ev));
  height: calc(var(--h-hr) + var(--h-eda) + var(--h-voice) + var(--h-words));
}
.sero__vline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--line-2); }
.sero__vline--gap { border-left-color: var(--tx-3); }
.sero__end { position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: var(--tx-3); }

.sero__gap {
  position: absolute; width: 1px; background: var(--accent); transform-origin: 50% 0;
  left: calc((var(--t) - var(--t0)) / var(--span) * 100% + 16px);
  top: calc(var(--h-hr) * var(--peak));
  height: calc(var(--h-hr) * (1 - var(--peak)) + var(--h-eda) + var(--h-voice) + var(--h-words) * 0.5);
}
.sero__gap::before, .sero__gap::after { content: ""; position: absolute; left: -3.5px; width: 8px; height: 9px; background: var(--accent); }
.sero__gap::before { top: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.sero__gap::after { bottom: 0; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.sero__gap .x { position: absolute; left: -16px; width: 22px; height: 1px; background: var(--accent); }
.sero__gap .x--t { top: 0; }
.sero__gap .x--b { bottom: 0; }
.sero__gaplabel {
  position: absolute; left: 10px; top: 14px; padding: 0;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1.25; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 500; white-space: nowrap;
}

.sero__head { position: absolute; inset: 0; opacity: 0; }
.sero__head i { position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: var(--tx-1); }

/* mini overview (small screens) */
.sero__row--mini svg { position: absolute; inset: 6px 0; width: 100%; height: calc(100% - 12px); }
.sero__row--mini .sero__trace { stroke: var(--tx-3); stroke-width: 1; }
.sero__window { position: absolute; top: 3px; bottom: 3px; right: 0; left: calc(var(--t0) / 50 * 100%); box-shadow: inset 0 0 0 1px var(--tx-3); }
.sero__row--mini .sero__plot { box-shadow: none; }

/* post-session record */
.sero__rec { position: relative; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line-2); padding: 16px 20px 18px; }
.sero__rec::before { content: ""; position: absolute; border: 0 dashed var(--tx-3); }
.sero__rec-h, .sero__rec-f { font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.sero__rec-h { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line-1); }
.sero__rec-f { padding-top: 12px; margin-top: 14px; border-top: 1px solid var(--line-1); }
.sero__code { margin: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; color: var(--tx-1); white-space: pre; tab-size: 2; }
.sero__code code { font: inherit; }
.sero__code .ln { display: inline; }
.sero__code b { font-weight: 500; color: var(--tx-1); letter-spacing: 0.02em; }
.sero__code i { font-style: normal; color: var(--tx-3); }
.sero__code em { font-style: normal; color: var(--tx-2); }

/* wide: record beside the session, joined to its end line */
@media (min-width: 1200px) {
  .sero { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 25%, 340px); column-gap: 56px; align-items: center; }
  .sero__out { align-self: start; padding-top: var(--h-ev); }
  .sero__rec::before { right: 100%; top: 23px; width: 56px; border-top-width: 1px; }
}
/* narrower: record below, right-aligned under the session end */
@media (max-width: 1199px) {
  .sero__out { display: flex; justify-content: flex-end; margin-top: 28px; }
  .sero__rec { width: min(100%, 352px); }
  .sero__rec::before { right: 0; bottom: 100%; height: calc(28px + var(--h-axis)); border-left-width: 1px; }
}
@media (max-width: 899px) {
  .sero { --key: 60px; --h-hr: 190px; --h-eda: 52px; }
}
@media (max-width: 639px) {
  .sero {
    --key: 42px; --t0: 26; --span: 24;
    --h-mini: 34px; --h-ev: 44px; --h-hr: 156px; --h-eda: 46px; --h-voice: 34px; --h-words: 42px; --h-axis: 36px;
    padding-inline: 14px;
  }
  .sero__row--mini { display: grid; }
  .sero__key { font-size: 10px; padding-right: 6px; letter-spacing: 0.06em; }
  .sero__key .u { display: none; }
  .sero__key .y { right: 6px; font-size: 10px; }
  .sero__key .y[style="--v:100"], .sero__key .y[style="--v:80"] { display: none; }
  .sero__quote { font-size: 14px; }
  .sero__rec { padding: 14px 14px 16px; }
  .sero__code { font-size: 11.5px; }
  .pfig__bar { flex-wrap: wrap; row-gap: 8px; }
}

/* ---------- Koshtur: one booking, one shift ----------------------------- */
.kosh { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.kosh__panel { display: flex; flex-direction: column; padding: clamp(24px, 3vw, 44px) var(--pad) clamp(24px, 3vw, 40px); min-width: 0; }
.kosh__panel + .kosh__panel { box-shadow: inset 1px 0 0 var(--line-1); }
.kosh__h { display: flex; gap: 0.9em; margin-bottom: clamp(28px, 3vw, 40px); font-family: var(--font-mono); font-size: 12px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-1); font-weight: 500; }
.kosh__h .idx { color: var(--tx-3); }
.kosh__sub, .kosh__shift dt { font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.kosh__note { margin-top: auto; padding-top: clamp(24px, 3vw, 36px); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--tx-3); letter-spacing: 0.01em; max-width: 44ch; }

/* A — state flow: request → counter-offer → accepted, then frozen terms (hatched) */
.kosh__flow { position: relative; height: 40px; margin: 22px 0 36px; }
.kosh__flowline { position: absolute; left: 0; top: 4px; width: 60%; height: 1px; background: var(--tx-3); }
.kosh__node {
  position: absolute; top: 0; left: calc(var(--x) * 100%); padding-top: 20px; white-space: nowrap; z-index: 1;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.2; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tx-3); font-weight: 500;
}
.kosh__node::before { content: ""; position: absolute; left: 0; top: 0; width: 9px; height: 9px; background: var(--bg-1); box-shadow: inset 0 0 0 1.5px currentColor; }
.kosh__node--on { color: var(--tx-1); }
.kosh__node--on::before { background: currentColor; }
.kosh__frozen {
  position: absolute; left: calc(60% + 14px); right: 0; top: 0; height: 9px;
  background: repeating-linear-gradient(-45deg, var(--tx-3) 0 1px, transparent 1px 5px); box-shadow: inset 0 0 0 1px var(--tx-3); opacity: 0.85;
}
.kosh__frozen-l {
  position: absolute; right: 0; bottom: calc(100% + 1px); white-space: nowrap;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.2; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tx-2); font-weight: 500;
}

.kosh__ledger { display: grid; }
.kosh__sub { margin-bottom: 6px; }
.kosh__row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line-1); font-size: 15px; line-height: 1.35; color: var(--tx-2); }
.kosh__row .v { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--tx-1); white-space: nowrap; }
.kosh__row--net { border-top: 1.5px solid var(--tx-3); border-bottom: 0; margin-top: -1px; color: var(--tx-1); font-weight: 500; }

/* chain dimensions: G over N + F */
.kosh__chain { position: relative; height: 64px; margin-top: 18px; }
.kosh__ext { position: absolute; top: 2px; bottom: 2px; left: calc(var(--x) * 100%); width: 0; border-left: 1px dashed var(--line-2); }
.kosh__ext:last-of-type { margin-left: -1px; }
.kosh__dim { position: absolute; left: calc(var(--a) * 100%); width: calc((var(--b) - var(--a)) * 100%); height: 1px; background: var(--tx-3); }
.kosh__dim:nth-of-type(1) { top: 16px; }
.kosh__dim:nth-of-type(2), .kosh__dim:nth-of-type(3) { top: 46px; }
.kosh__dim::before, .kosh__dim::after { content: ""; position: absolute; top: -5px; width: 1px; height: 11px; background: var(--tx-1); transform: rotate(45deg); }
.kosh__dim::before { left: 0; }
.kosh__dim::after { right: 0; }
.kosh__dim b {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 0 7px; background: var(--bg-1);
  font-family: var(--font-mono); font-size: 12px; line-height: 1; font-weight: 500; color: var(--tx-1);
}

/* ledger strip */
.kosh__led { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 26px; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); }
.kosh__led > div { display: grid; gap: 6px; padding: 10px 12px 12px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.kosh__led dt { font-family: var(--font-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.09em; text-transform: uppercase; color: var(--tx-3); font-weight: 500; }
.kosh__led dd { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.3; color: var(--tx-1); }
.kosh__led dd::before { content: ""; width: 7px; height: 7px; background: var(--tx-2); flex: none; }

/* B — candidate scored against the shift */
.kosh__shift { display: flex; flex-wrap: wrap; gap: 14px clamp(24px, 3vw, 48px); margin-bottom: clamp(28px, 3vw, 40px); }
.kosh__shift > div { display: grid; gap: 6px; }
.kosh__shift dd { font-size: 15px; line-height: 1.35; color: var(--tx-1); }
.kosh__ok { display: inline-flex; align-items: center; gap: 8px; }
.kosh__ok::before { content: ""; width: 8px; height: 8px; background: var(--tx-2); }

.kosh__score-area { --namew: clamp(132px, 13vw, 176px); }
.kosh__scale { position: relative; height: 22px; margin-left: var(--namew); }
.kosh__scale span {
  position: absolute; left: calc(var(--x) * 100%); top: 0; transform: translateX(-50%); padding-bottom: 8px;
  font-family: var(--font-mono); font-size: 10.5px; line-height: 1; color: var(--tx-3); letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}
.kosh__scale span::after { content: ""; position: absolute; left: 50%; bottom: 0; height: 5px; border-left: 1px solid var(--tx-3); }
.kosh__scale span:first-child { transform: none; }
.kosh__scale span:first-child::after { left: 0; }
.kosh__scale span:last-child { transform: translateX(-100%); }
.kosh__scale span:last-child::after { left: auto; right: 0; }
.kosh__crit { list-style: none; padding: 0; border-top: 1px solid var(--line-1); }
.kosh__crit li { display: grid; grid-template-columns: var(--namew) minmax(0, 1fr); align-items: center; height: 46px; border-bottom: 1px solid var(--line-1); }
.kosh__crit .n { font-size: 15px; line-height: 1.25; color: var(--tx-2); padding-right: 12px; }
.kosh__bar {
  position: relative; height: 100%;
  background: linear-gradient(var(--line-1), var(--line-1)) 50% 0 / 1px 100% no-repeat;
  box-shadow: inset 1px 0 0 var(--line-2), inset -1px 0 0 var(--line-2);
}
.kosh__bar::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--line-2); }
.kosh__bar i { position: absolute; left: 0; top: calc(50% - 1.5px); height: 3px; width: calc(var(--v) * 100%); background: var(--tx-1); transform-origin: left center; }
.kosh__bar i::after { content: ""; position: absolute; right: 0; top: -5px; width: 1.5px; height: 14px; background: var(--tx-1); }
.kosh__result { display: grid; grid-template-columns: var(--namew) minmax(0, 1fr); align-items: end; padding-top: 14px; border-top: 1.5px solid var(--tx-3); margin-top: -1px; }
.kosh__rk { padding-bottom: 10px; font-family: var(--font-mono); font-size: 12px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-2); font-weight: 500; }
.kosh__score { justify-self: end; display: inline-flex; align-items: baseline; gap: 10px; }
.kosh__num { font-size: clamp(3.5rem, 2.2rem + 3.6vw, 5.75rem); line-height: 0.86; font-weight: 300; letter-spacing: -0.045em; font-stretch: 96%; color: var(--tx-1); font-variant-numeric: lining-nums tabular-nums; }
.kosh__of { font-family: var(--font-mono); font-size: 12px; color: var(--tx-3); letter-spacing: 0.04em; }

@media (max-width: 899px) {
  .kosh { grid-template-columns: minmax(0, 1fr); }
  .kosh__panel + .kosh__panel { box-shadow: inset 0 1px 0 var(--line-1); }
}
@media (max-width: 639px) {
  .kosh__panel { padding-inline: 14px; }
  .kosh__score-area { --namew: 118px; }
  .kosh__crit .n { font-size: 14px; }
  .kosh__node, .kosh__frozen-l { font-size: 10px; letter-spacing: 0.04em; }
}
