/* ==========================================================================
   lamoda.css — the size-data figure: two size charts, line by line, and the
   gates in front of the table.

   The picture: a conveyor across the top — SKU, the brand's site, the
   rendered page, the extracted table, normalisation — ending in a panel
   where the brand's numbers land against Lamoda's row by row; and under
   it the trust layer, each piece where it acts: the identity gate with
   its quarantine tray, the vision-LLM under the extractor, the golden
   test on the extractor itself.

   Division of labour, the same one the other figures use:

     this file            the look — boxes, the panel, the chips, the gate,
                          the little browser window, the counters
     lamoda-timeline.css  where every chip is at every beat, what lights,
                          which cell flashes and which stays lit — generated
                          from the one schedule in tools/lamoda.py

   Layering: the drawing (wires) sits over the boxes and the chips over
   both, because a chip has to be seen inside a box.

   The static values below are the figure's LAST frame — the panel full
   with its one discrepancy lit, the golden test passed — so with the
   animations off (prefers-reduced-motion) the picture holds the end of the
   story. Below 1000px the wires and chips go and the boxes stack in
   reading order with what they hold.
   ========================================================================== */

.lmd {
  --lmd-cycle: 30s;               /* lamoda-timeline.css sets the real ones */
  --lmd-ratio: 1000 / 440;
  --c: var(--c-blue);
  margin: var(--s-5) 0 var(--s-6);
}
.lmd, .lmd figure { margin-inline: 0; }

/* --- the caption ---------------------------------------------------------- */
.lmd__cap {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.lmd__h {
  font-weight: 640; font-size: var(--fs-md); letter-spacing: -.015em;
  color: var(--ink);
}
.lmd__note {
  flex: 1 1 22ch; min-width: 0;
  font-size: var(--fs-3xs); line-height: 1.45; color: var(--ink-3);
}

/* --- the stage ------------------------------------------------------------ */
.lmd__body { position: relative; aspect-ratio: var(--lmd-ratio); }
.lmd__art {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; pointer-events: none; overflow: visible;
}
.lmd-wire { fill: none; stroke: var(--ink-3); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; opacity: .3; }
.lmd-wire--gate, .lmd-wire--units { stroke: var(--ink-3); stroke-dasharray: 3 4; }
.lmd-wire--vllm { stroke: var(--c-violet); }

/* --- the boxes ------------------------------------------------------------ */
.lmd__box {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--w); height: var(--h);
  z-index: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
}
.lmd__box-h {
  position: absolute; left: var(--s-3); top: var(--s-2); right: var(--s-3);
  font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-3xs);
  letter-spacing: .04em; line-height: 1.3; color: var(--ink-2);
}
.lmd__box--vllm { --c: var(--c-violet); }
.lmd__box--quar { border-style: dashed; background: transparent; }

/* The SKU box: a stack of cards waiting to go. */
.lmd-stack { position: absolute; left: 50%; bottom: 14px; width: 46px; height: 22px; transform: translateX(-50%); }
.lmd-stack > i {
  position: absolute; inset: 0; border-radius: 3px;
  border: 1px solid var(--line-strong); background: var(--bg-2);
}
.lmd-stack > i:nth-child(2) { transform: translate(3px, -4px); }
.lmd-stack > i:nth-child(3) { transform: translate(6px, -8px); }

/* The identity gate, at the foot of the site box. */
.lmd-gate {
  position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--s-2);
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: var(--fs-3xs); letter-spacing: .04em; color: var(--ink-3);
}
.lmd-gate > b { position: absolute; right: 0; font-weight: 700; opacity: 0; }
.lmd-gate__ok { color: var(--c-teal); }
.lmd-gate__no { color: var(--c-coral); }

/* The little browser window: the page as the buyer sees it, drawn while a
   chip is in the box. */
.lmd-win {
  position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--s-2); height: 44px;
  border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg-2);
  overflow: hidden;
}
.lmd-win__bar { position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--surface-2); }
.lmd-win__l, .lmd-win__t {
  position: absolute; left: 6px; height: 3px; border-radius: 2px; background: var(--ink-3);
  transform-origin: 0 50%; transform: scaleX(1);
}
.lmd-win__l--0 { top: 12px; width: 60%; }
.lmd-win__l--1 { top: 18px; width: 45%; }
.lmd-win__l--2 { top: 24px; width: 52%; }
.lmd-win__t { top: 31px; width: 70%; height: 8px; background: color-mix(in oklab, var(--c-blue) 55%, transparent); }

/* The golden test, on the extractor: a label, a bar that fills while it
   runs, and a tick when it has passed. One line, ellipsised rather than
   ever wider than its box. */
.lmd-golden {
  position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--s-2);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 6px; row-gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: var(--fs-3xs); letter-spacing: .04em; color: var(--ink-3);
}
.lmd-golden__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-teal); }
.lmd-golden__ok { color: var(--c-teal); font-weight: 700; opacity: 1; }
.lmd-golden__bar { grid-column: 1 / -1; display: block; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.lmd-golden__bar > i {
  display: block; height: 100%; background: var(--c-teal);
  transform-origin: 0 50%; transform: scaleX(1);
}

/* Normalisation: the one conversion, spelled out. */
.lmd-units {
  position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--s-3);
  display: flex; justify-content: center; gap: 8px;
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--ink-2);
}
.lmd-units__arrow { color: var(--c); }

/* --- the comparison panel ------------------------------------------------- */
.lmd-panel {
  position: absolute; left: var(--s-3); right: var(--s-3); top: 30px;
  border-collapse: collapse; width: calc(100% - 2 * var(--s-3));
  font-family: var(--font-mono); font-size: var(--fs-3xs); letter-spacing: .02em;
  color: var(--ink-2); table-layout: fixed;
}
.lmd-panel th, .lmd-panel td { padding: 3px 4px; text-align: center; height: 22px; box-sizing: border-box; }
.lmd-panel th { font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.lmd-panel th:first-child, .lmd-panel td:first-child { text-align: left; color: var(--ink); width: 18%; }
.lmd-panel td:nth-child(2), .lmd-panel td:nth-child(4) { color: var(--ink-3); }
.lmd-panel td:nth-child(3), .lmd-panel td:nth-child(5) { border-left: 1px solid var(--line); }
.lmd-cell { color: var(--ink); border-radius: 3px; opacity: 1; background-color: transparent; }
.lmd-cell--bad { background-color: color-mix(in oklab, var(--c-coral) 42%, transparent); }

/* --- the chips ------------------------------------------------------------ */
.lmd-chip {
  position: absolute; left: var(--x); top: var(--y); z-index: 2;
  width: 46px; height: 22px; margin: -11px 0 0 -23px;
  border: 1px solid var(--line-strong); border-radius: 3px; background: var(--bg-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .03em; color: var(--ink);
  opacity: 0; pointer-events: none;
}
.lmd-chip__id, .lmd-chip__f {
  position: absolute; inset: 0; display: grid; place-items: center; font-style: normal;
}
.lmd-chip__f { opacity: 0; }
.lmd-chip__f > svg { width: 14px; height: 12px; fill: none; stroke: var(--c-blue); stroke-width: 1; }
.lmd-chip__f--bad, .lmd-chip__f--no { color: var(--c-coral); font-weight: 700; font-size: 12px; }
.lmd-chip__f--no { color: var(--ink-3); }

/* --- the counters --------------------------------------------------------- */
.lmd__counters {
  position: absolute; left: var(--x); top: var(--y);
  display: flex; gap: var(--s-4);
  font-family: var(--font-mono); font-size: var(--fs-3xs); letter-spacing: .04em; color: var(--ink-3);
}
.lmd-count { display: flex; gap: 6px; align-items: baseline; }
.lmd-count__n { position: relative; display: inline-block; width: 1ch; height: 1.2em; color: var(--ink); font-weight: 600; }
.lmd-count__d { position: absolute; left: 0; top: 0; font-style: normal; opacity: 0; }
.lmd-count--disc .lmd-count__n { color: var(--c-coral); }

/* --- what only the stacked layout shows ----------------------------------- */
.lmd-quar__m { display: none; }

@media (max-width: 1000px) {
  .lmd__body { aspect-ratio: auto; display: grid; gap: var(--s-3); }
  .lmd__art, .lmd-chip, .lmd-stack { display: none; }
  .lmd__box, .lmd__box * { animation: none !important; }
  .lmd__box {
    position: relative; left: auto; top: auto; width: auto; height: auto;
    padding: var(--s-5) var(--s-3) var(--s-3);
  }
  .lmd__box-h { position: static; display: block; margin-bottom: var(--s-2); }
  .lmd-gate, .lmd-win, .lmd-golden, .lmd-units { position: static; }
  .lmd-gate > b { display: none; }
  .lmd-win { height: 44px; max-width: 200px; }
  .lmd-golden { max-width: 260px; }
  .lmd-golden__label { color: var(--ink-3); } .lmd-golden__ok { opacity: 0; }
  .lmd-units { justify-content: flex-start; }
  .lmd-panel { position: static; width: 100%; max-width: 420px; }
  .lmd-quar__m { display: block; font-family: var(--font-mono); font-size: var(--fs-3xs); color: var(--ink-3); }
  .lmd__counters { position: static; flex-wrap: wrap; }
  .lmd__counters * { animation: none !important; }
  .lmd-count--checked .lmd-count__d:last-child,
  .lmd-count--disc .lmd-count__d:last-child,
  .lmd-count--quar .lmd-count__d:last-child { opacity: 1; }
}

/* --------------------------------------------------------------------------
   The last frame, held: the animations off, the statics above showing, plus
   the positions lamoda-timeline.css writes out for the same frame.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lmd__body *, .lmd__body { animation: none !important; }
}
