/* Lion Ink size run 1.2.0 (2026-10-19). Loaded only with the li-size-run.php flag on.
 * 1.2.0 design pass (Aramis 2026-10-19 "this needs to look better"): the per-size cards became one
 * table strip, the way a supplier order grid reads: size head row (ink), unit price row, quantity
 * row, every size visible. Style lock: 2px ink frame, zero radius, mono uppercase labels, tabular
 * numerals, red only as the accent. Phone: wraps to 2 rows past 5 sizes (no page scroll), inputs
 * 48px tall. Colours via the theme's surface tokens so both theme states work. Everything is
 * scoped to .li-sr or body.li-sizerun-on. */

/* The grid replaces the single size control. Only hidden once the script has rendered the grid. */
body.li-sizerun-on [data-li-size],
body.li-sizerun-on .li-woo form.cart .variations tr:has(select[name*="size"]) { display: none !important; }
/* Designer: the grid takes the quantity box's place (FPD sets display:block inline on .quantity). */
body.li-sizerun-on.hs-designing form.cart .quantity { display: none !important; }

/* Designer layout. form.cart is a flex row (theme v0.19.0); the theme's art gate ("Add your art to
 * unlock add to cart", form.cart::before) sat BESIDE the grid as a tall empty column. With the grid
 * on, the grid takes the full row and the gate drops beneath it, full width, where the Add to cart
 * button appears once art is on the canvas. Pure layout: the gate logic is untouched. */
body.li-sizerun-on.li-designer-mode .li-woo form.cart { flex-wrap: wrap; }
body.li-sizerun-on.li-designer-mode .li-woo form.cart .single_variation_wrap { order: 1; flex: 1 1 100%; width: 100%; min-width: 0; }
body.li-sizerun-on.li-designer-mode.fpd-customization-required .li-woo form.cart::before {
  order: 2; flex: 1 1 100%; justify-content: center; box-sizing: border-box;
}

.li-sr { margin: 0 0 1.1rem; min-width: 0; container: lisr / inline-size; }
.li-sr[hidden] { display: none; }
.li-sr--designer { flex-basis: 100%; width: 100%; margin: 0 0 0.9rem; }
.li-sr__h {
  margin: 0 0 0.25rem;
  font-family: var(--li-mono, monospace); font-weight: 600;
  font-size: var(--li-fs-xs, 0.8rem); letter-spacing: 0.06em; text-transform: uppercase;
}
.li-sr__sub { margin: 0 0 0.7rem; }

/* ---- the strip ---- */
.li-sr__scroll { position: relative; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.li-sr__grid {
  --li-sr-hair: rgba(13, 13, 15, 0.16);
  --li-sr-hair-ink: rgba(245, 242, 236, 0.24);
  display: grid;
  /* Columns share the step's width: never under 3.9rem (the strip scrolls instead), never over
   * 7.5rem (a short run of sizes does not stretch into wide empty fields). */
  grid-template-columns: repeat(var(--li-sr-n, 5), minmax(3.9rem, 1fr));
  grid-auto-rows: auto;
  box-sizing: border-box;
  width: 100%; min-width: calc(var(--li-sr-n, 5) * 3.9rem + 4px); max-width: calc(var(--li-sr-n, 5) * 7.5rem + 4px);
  margin: 0; padding: 0;
  border: 2px solid var(--li-ink, #0d0d0f); border-radius: 0;
  background: var(--li-surface, #f5f2ec); color: var(--li-on-surface, #0d0d0f);
  overflow: clip;   /* clips the cell separators to the frame */
}
/* One column per size; subgrid keeps the three rows level across columns, so a size with an
 * upcharge line is no taller than one without. */
.li-sr__cell {
  grid-row: span 3;
  display: grid; grid-template-rows: subgrid;
  min-width: 0;
  box-shadow: -1px 0 0 var(--li-sr-hair), 0 -2px 0 var(--li-ink, #0d0d0f);   /* left hairline; ink rule above a wrapped row */
}
.li-sr__size {
  display: flex; align-items: center; justify-content: center;
  min-height: 2.2rem; padding: 0.3rem 0.25rem;
  background: var(--li-ink, #0d0d0f); color: var(--li-on-ink, #f5f2ec);
  box-shadow: -1px 0 0 var(--li-sr-hair-ink);
  font-family: var(--li-mono, monospace); font-weight: 600;
  font-size: var(--li-fs-sm, 0.85rem); letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer;
}
.li-sr__pp {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.05rem;
  padding: 0.45rem 0.2rem 0.35rem;
  border-bottom: 1px solid var(--li-sr-hair);
  background: rgba(13, 13, 15, 0.035);   /* price row a shade under the white quantity row, both themes */
  font-family: var(--li-mono, monospace); font-variant-numeric: tabular-nums; text-align: center;
}
.li-sr__price { font-size: var(--li-fs-xs, 0.8rem); font-weight: 600; line-height: 1.2; }
.li-sr__from { font-weight: 400; }
.li-sr__up {
  min-height: 0.95rem;   /* reserved on every column: rows stay level with or without an upcharge */
  font-size: var(--li-fs-2xs, 0.72rem); line-height: 1.3; font-weight: 600;
  color: var(--li-red-text-light-bg, #c81e23);
}
.li-sr__qty {
  box-sizing: border-box; display: block; width: 100%; min-width: 0; min-height: 48px; margin: 0;
  padding: 0.35rem 0.25rem;
  border: 0; border-radius: 0; outline: 0;
  background: #fff; color: var(--li-on-surface, #0d0d0f);
  font-family: var(--li-mono, monospace); font-size: 1.05rem; font-weight: 400;
  font-variant-numeric: tabular-nums; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.li-sr__qty::placeholder { color: #767169; opacity: 1; }   /* a zero reads quiet (4.6:1 on white) */
.li-sr__qty::-webkit-outer-spin-button, .li-sr__qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.li-sr__qty:disabled { cursor: not-allowed; }
.li-sr__qty:disabled::placeholder { color: transparent; }

/* Filled column: the value goes heavy and the head takes a red plate. Focused column: the head
 * turns red and a 3px red ring sits inside the field (inset, so the frame's clip never cuts it). */
.li-sr__cell.has-qty .li-sr__qty { font-weight: 700; }
.li-sr__cell.has-qty .li-sr__size { box-shadow: inset 0 -4px 0 var(--li-red, #e32227), -1px 0 0 var(--li-sr-hair-ink); }
.li-sr__cell:focus-within .li-sr__size { background: var(--li-red-dark, #b81b1f); color: #fff; }
.li-sr__qty:focus, .li-sr__qty:focus-visible { outline: 3px solid var(--li-red, #e32227); outline-offset: -3px; }
.li-sr__cell.is-oos .li-sr__size { background: #6b675f; }
.li-sr__cell.is-oos .li-sr__pp { color: #57534b; }
.li-sr__cell.is-oos .li-sr__qty {
  background: repeating-linear-gradient(135deg, #f1eee8 0 6px, #e2ddd3 6px 7px);
}

/* Mid widths with more sizes than fit: the strip scrolls inside itself, and a hard red tab marks
 * the side that still has sizes (no blur, per the style lock). Never hides a size. */
.li-sr__scroll.is-more-r { box-shadow: inset -4px 0 0 var(--li-red, #e32227); }
.li-sr__scroll.is-more-l { box-shadow: inset 4px 0 0 var(--li-red, #e32227); }
.li-sr__scroll.is-more-l.is-more-r { box-shadow: inset 4px 0 0 var(--li-red, #e32227), inset -4px 0 0 var(--li-red, #e32227); }

/* Phone (the step is under ~32rem wide): no page scroll. Up to 5 sizes in one row, more wrap to two
 * rows of equal columns (9 sizes = 5 + 4), all visible. */
@container lisr (max-width: 32rem) {
  .li-sr__scroll { overflow: visible; }
  .li-sr__grid { min-width: 0; max-width: none; grid-template-columns: repeat(var(--li-sr-cm, 5), minmax(0, 1fr)); }
}
/* Same wrap at any width where one row of minimum-width columns does not fit (the script sets
 * .li-sr--wrap from the step's measured width). */
.li-sr--wrap .li-sr__scroll { overflow: visible; }
.li-sr--wrap .li-sr__grid { min-width: 0; max-width: calc(var(--li-sr-cm, 5) * 7.5rem + 4px); grid-template-columns: repeat(var(--li-sr-cm, 5), minmax(0, 1fr)); }

/* ---- notices ---- */
.li-sr__err {
  margin: 0.55rem 0 0; padding: 0.5rem 0.65rem;
  border: 2px solid var(--li-red, #e32227);
  color: var(--li-red-text-light-bg, #c81e23); font-weight: 600; font-size: var(--li-fs-sm, 0.85rem);
}
.li-sr__err[hidden] { display: none; }
/* F4: sizes dropped by a colour change; stays until the customer edits sizes or colour. */
.li-sr__warn {
  margin: 0.55rem 0 0; padding: 0.5rem 0.65rem;
  border: 2px dashed var(--li-red, #e32227);
  font-weight: 600; font-size: var(--li-fs-sm, 0.85rem);
}
.li-sr__warn[hidden] { display: none; }

/* ---- summary: breakdown once, discount / set-up, nudge, total once ---- */
.li-sr__sum { margin: 0.85rem 0 0; max-width: 30rem; }
.li-sr__line {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
  margin: 0 0 0.25rem;
  font-size: var(--li-fs-sm, 0.85rem); line-height: 1.4;
}
.li-sr__line span + span { font-family: var(--li-mono, monospace); font-variant-numeric: tabular-nums; white-space: nowrap; }
.li-sr__line--k { font-weight: 600; }
.li-sr__line--save span + span { color: var(--li-red-text-light-bg, #c81e23); font-weight: 600; }
.li-sr__line--nudge {
  display: block; margin: 0.4rem 0 0.2rem; padding-left: 0.6rem;
  border-left: 3px solid var(--li-red, #e32227);
  font-size: var(--li-fs-xs, 0.8rem);
}
.li-sr__line--total {
  margin-top: 0.5rem; padding-top: 0.45rem;
  border-top: 2px solid var(--li-on-surface, #0d0d0f);
  font-weight: 700; font-size: var(--li-fs-md, 0.95rem);
}
.li-sr__line--total span + span { font-size: 1.1rem; }
.li-sr__line--muted { display: block; color: #57534b; font-size: var(--li-fs-xs, 0.8rem); }
.li-sr__line--warn { display: block; color: var(--li-red-text-light-bg, #c81e23); font-size: var(--li-fs-xs, 0.8rem); }

/* "Your selections" heading (store.js #hs-lo-val, text set by li-size-run.js): Clash Display's word
 * space is so tight that "1 2XL" read as "12XL". Open it up a little on this one line. */
body.li-sizerun-on #hs-lo-val { word-spacing: 0.22em; }

.li-sr-reedit {
  flex-basis: 100%; margin: 0 0 0.7rem; padding: 0.55rem 0.7rem;
  border: 2px solid currentColor; font-size: var(--li-fs-sm, 0.85rem);
}
