/**
 * The shop's product list and the variables its components read: the shop's lists and cart and the
 * site-wide live search draw the same component, so it loads on every page.
 */

/* One place for the decisions every component repeats. Changing a corner
   radius or a line colour here changes it everywhere rather than in the dozens
   of rules that would otherwise each state it. */
:root {
  /* Single source: the values live in Tailwind's @theme (assets/src/app.css),
     which emits them as --color-* / --font-*. These aliases let the components
     not yet converted to utilities read the same numbers, so a change in one
     place moves both systems. The literals are fallbacks for the case where
     app.css has not loaded. */
  --fw-font: var(--font-sans, "Montserrat", "Open Sans", sans-serif);
  --fw-brand: var(--color-brand, #e1001a);

  --fw-ink: var(--color-ink, #111);
  --fw-muted: var(--color-muted, #6b6b6b);
  --fw-line: var(--color-line, #e4e4e4);
  --fw-surface: var(--color-surface, #fafafa);
  --fw-danger: var(--color-danger, #b3261e);
  --fw-success: var(--color-success, #1f7a3d);

  /* Shape */
  --fw-radius: 3px;
  --fw-border: 1px solid var(--fw-line);
  --fw-field-border: 1px solid #dcdcdc;

  /* Rhythm — components space themselves from these rather than each
     inventing their own numbers. */
  --fw-gap: 0.5rem;
  --fw-pad: 1.25rem;
  --fw-field-height: 2.3rem;
  --fw-field-font-size: 0.85rem;

  --fw-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 18px rgb(0 0 0 / 0.05);
  --fw-shadow-raised: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 28px rgb(0 0 0 / 0.12);
}

/* Tables */

.fw-ekspress__table {
  width: 100%;
  margin: 0 0 2rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.fw-ekspress__table th {
  padding: 0.9rem 1rem 0.9rem 0;
  border-bottom: 1px solid var(--fw-line);
  color: var(--fw-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.fw-ekspress__table td {
  padding: 0.9rem 1rem 0.9rem 0;
  border-bottom: 1px solid var(--fw-line);
  vertical-align: middle;
}

.fw-ekspress__table tr:last-child td {
  border-bottom: 0;
}

.fw-ekspress__table td:last-child,
.fw-ekspress__table th:last-child {
  padding-right: 0;
}

.fw-ekspress__name {
  font-weight: 500;
}

.fw-ekspress__num {
  color: var(--fw-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* A column header belongs over its column. `.fw-ekspress__table th` sets
   text-align:left and outweighs a bare class, so the header sat left while its
   cells sat right — scoping this to the table gives it the specificity to
   follow the content it labels. */
.fw-ekspress__table th.fw-ekspress__actions,
.fw-ekspress__table td.fw-ekspress__actions {
  text-align: right;
}

/* The card is the white surface; the table inside it stays transparent so the
   header row sits on the same sheet as the rows. */
.fw-ekspress__card {
  padding: 0.5rem 1.25rem;
  border-radius: var(--fw-radius);
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 18px rgb(0 0 0 / 0.05);
}

.fw-ekspress__card .fw-ekspress__table {
  margin: 0;
}

.fw-ekspress__name a {
  color: inherit;
  text-decoration: none;
}

.fw-ekspress__name a:hover {
  text-decoration: underline;
}

/* Dividers span the whole card: padding moves from the card onto the cells,
   so the rules meet both edges instead of stopping short. */
.fw-ekspress__card {
  padding: 0;
  overflow: hidden;
}

.fw-ekspress__card .fw-ekspress__table th:first-child,
.fw-ekspress__card .fw-ekspress__table td:first-child {
  padding-left: 1.25rem;
}

.fw-ekspress__card .fw-ekspress__table th:last-child,
.fw-ekspress__card .fw-ekspress__table td:last-child {
  padding-right: 1.25rem;
}

/* A pending row is not a name: don't let it inherit the name weight. */
.fw-ekspress__name .fw-ekspress__empty {
  color: var(--fw-muted);
  font-weight: 300;
  font-style: italic;
}

/* Destructive actions look destructive. */

/* The primary action sits on the right, always. */

/* Squared corners throughout; depth comes from a subtle shadow, not curves. */
.fw-ekspress__card,
.fw-ekspress__meta,
.fw-ekspress__gate {
  border-radius: var(--fw-radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 12px rgb(0 0 0 / 0.04);
}

/* A row that contains a link is a row you can click. Stated in CSS rather
   than by a class added at load, so it is still true of rows that arrive from
   a filter or a page change. The old class is kept for any markup that still
   sets it. */

.fw-ekspress__table tbody tr:has(a[href]) {
  cursor: pointer;
}

.fw-ekspress__table tbody tr:has(a[href]):hover {
  background: #fafafa;
}

.fw-ekspress__name--quiet {
  color: var(--fw-muted);
  font-weight: 300;
}

/* Product rows */

.fw-prod__thumb { width: 4.5rem; padding-left: 1.25rem; }

/* WordPress emits width/height attributes at full thumbnail size, so the
   dimensions have to be forced rather than merely suggested. */
.fw-ekspress .fw-prod__thumb img {
  display: block;
  width: 3.5rem !important;
  height: 3.5rem !important;
  max-width: 3.5rem;
  object-fit: contain;
}

.fw-prod__pricecol {
  text-align: right;
  white-space: nowrap;
}
.fw-prod__zoom img,
.fw-prod__thumbimg img { transition: opacity 0.2s ease; }
.fw-prod__zoom:hover img,
.fw-prod__thumbimg:hover img { opacity: 0.85; }
.fw-prod__thumbimg { transition: outline-color 0.2s ease; }

.fw-prod__thumbimg { display: block; cursor: zoom-in; outline: 1px solid var(--fw-line, #e4e4e4); }
.fw-prod__thumbimg:hover { outline-color: var(--fw-ink, #111); }
.fw-prod__thumbimg img { aspect-ratio: 1; object-fit: contain; background: #fff; }

@media (prefers-reduced-motion: reduce) {
  .fw-lightbox,
  .fw-lightbox::backdrop,
  .fw-lightbox img,
  .fw-prod__zoom img,
  .fw-prod__thumbimg,
  .fw-prod__thumbimg img { transition: none; }
}

/* The product list is a white surface like every other card. */
.fw-prod { margin: 0; }

/* The price header must follow its column: `.fw-ekspress__table th` is more
   specific than the column class alone, so it was staying left-aligned. */
.fw-ekspress__table th.fw-prod__pricecol {
  text-align: right;
}

/* Last cell, so it would otherwise inherit padding-right:0 and sit flush
   against the card edge while the thumbnail keeps its 1.25rem inset. */
.fw-ekspress__table td.fw-prod__buycol,
.fw-ekspress__table th.fw-prod__buycol {
  padding-right: 1.25rem;
}

/* Stock sits beside the order control: an empty buy cell then has a reason. */
.fw-prod__stockcol {
  width: 1%;
  padding-right: 1rem !important;
  white-space: nowrap;
  /* Centred, so a count and a "Tellimisel" that spans into the order column
     still sit on the same axis instead of drifting apart row to row. */
  text-align: center;
  vertical-align: middle;
}

.fw-ekspress__table th.fw-prod__stockcol {
  text-align: center;
}

@media all {
  /* Tiles: the same table laid out as cards. The head goes, each row becomes
     a column of its own cells, and the picture leads. The stock cell says
     what it is, since no heading is left to say it. */
  .fw-ekspress .fw-prod--grid {
    display: block;
    margin-bottom: 1.5rem;
  }

  .fw-ekspress .fw-prod--grid thead { display: none; }

  /* The tiles are the cards: the list's white box around them would stand empty beside a short row. */
  .fw-ekspress .fw-ekspress__card:has(> .fw-prod--grid) { background: none; box-shadow: none; }
  .fw-ekspress .fw-ekspress__card > .fw-prod--grid { margin-bottom: 0; }

  /* 2, 3, 4 or 5 columns by width, so a page of 20 (or a phone's 10, CatalogueModule::perPage) ends on a full row. */
  .fw-ekspress .fw-prod--grid tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    padding: 1px;
  }
  @media (min-width: 40rem) { .fw-ekspress .fw-prod--grid tbody { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (min-width: 64rem) { .fw-ekspress .fw-prod--grid tbody { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (min-width: 80rem) { .fw-ekspress .fw-prod--grid tbody { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

  .fw-ekspress .fw-prod--grid tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* A card may be narrower than a long word in its name, which then breaks rather than spilling out. */
    min-width: 0;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 0 0 1px var(--fw-line);
  }

  .fw-ekspress .fw-prod--grid tbody tr:hover { background: #fafafa; }

  .fw-ekspress .fw-prod--grid td,
  .fw-ekspress .fw-prod--grid td.fw-prod__buycol,
  .fw-ekspress .fw-prod--grid td.fw-prod__stockcol {
    display: block;
    width: auto;
    padding: 0 !important;
    border: 0;
    text-align: left;
    white-space: normal;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__thumb {
    margin-bottom: 0.5rem;
  }

  /* Outranks the list's own 2.5rem thumbnail rule, which is more specific
     and later in the file. */
  .fw-ekspress .fw-prod.fw-prod--grid .fw-prod__thumb img {
    width: 100% !important;
    max-width: none;
    height: 9rem !important;
    object-fit: contain;
  }

  .fw-ekspress .fw-prod--grid td:nth-child(2) {
    flex: 1 1 auto;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .fw-ekspress .fw-prod--grid .fw-ekspress__num {
    color: var(--fw-muted);
    font-size: 0.8rem;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__pricecol {
    font-size: 1.05rem;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__stockcol {
    color: var(--fw-muted);
    font-size: 0.8rem;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__stockcol::before {
    content: attr(data-label) ": ";
  }

  .fw-ekspress .fw-prod--grid .fw-prod__buycol {
    margin-top: 0.5rem;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__buy--row {
    justify-content: flex-start;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__buycol .fw-prod__stock--out {
    display: block;
    text-align: left;
  }

  .fw-ekspress .fw-prod--grid .fw-prod__buy--row input[type="number"] {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* A buying list is scanned, not read: tighter rows put more of the catalogue
   on screen without crowding the controls. */
.fw-prod td {
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
}

.fw-prod th {
  padding-top: 0.6rem !important;
  padding-bottom: 0.6rem !important;
}

.fw-ekspress .fw-prod .fw-prod__thumb img {
  width: 2.5rem !important;
  height: 2.5rem !important;
  max-width: 2.5rem;
}

.fw-prod .fw-prod__thumb { width: 3.25rem; }

/* The express cart is the catalogue table with quantity and a line total. */
.fw-ekspress__table th.fw-cart__qtycol {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
}

.fw-ekspress__table th.fw-cart__qtycol { text-align: right; }

/* Spanning the order column, so it lines up with the table edge like the
   controls it replaces. */
/* Every cell in a product row shares one vertical axis. */
.fw-prod td,
.fw-prod th {
  vertical-align: middle;
}

.fw-prod .fw-prod__thumb img {
  margin: 0;
}

@media (max-width: 60rem) {

  

  

  

  

  .fw-ekspress__card {
    overflow-x: auto;
  }
}

@media (max-width: 34rem) {
  /* The thumbnail is the first thing to go: on a phone the name and the price
     are what a buyer is scanning for. */
  .fw-prod .fw-prod__thumb { display: none; }
}

/* Quantities read as a column when centred; money reads as a column when the
   decimal points line up on the right. */
.fw-ekspress__table .fw-orders__qty {
  text-align: center;
}

.fw-ekspress__table .fw-orders__sum,
.fw-orders__sum {
  text-align: right;
}

.fw-received .fw-ekspress__name a {
  color: var(--fw-ink);
  text-decoration: none;
}

.fw-received .fw-ekspress__name a:hover {
  text-decoration: underline;
}

/* The orders list is the same kind of surface as the order it links to, so it
   is the same card. Without the last-row rule the table's final border sits a
   card-padding away from the bottom edge and reads as an empty row. */
.fw-orders__card .fw-ekspress__table {
  margin: 0;
}

.fw-orders__card .fw-ekspress__table tbody tr:last-child td {
  border-bottom: 0;
}

/* The cart's rows are as tall as their thumbnail and quantity box; the
   header row, carrying only its small caps, sat visibly shorter above them.
   Same height, same rhythm — scoped to the cart, whose rows are the tall ones. */

.fw-ekspress__table.fw-cart th {
  height: 3.4375rem;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
}

@media (max-width: 40rem) {
  .fw-ekspress .fw-prod--list,
  .fw-ekspress .fw-prod--list tbody { display: block; width: 100%; }
  .fw-ekspress .fw-prod--list thead { display: none; }

  .fw-ekspress .fw-prod--list tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.4rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--fw-line, #e4e4e4);
  }

  .fw-ekspress .fw-prod--list tbody td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .fw-ekspress .fw-prod--list tbody td.fw-prod__thumb { flex: none; width: auto; padding: 0 !important; }

  .fw-ekspress .fw-prod--list .fw-prod__thumb img { width: 3rem !important; height: 3rem !important; max-width: none; padding: 0 !important; object-fit: contain; }

  .fw-ekspress .fw-prod--list .fw-ekspress__name {
    flex: 1 0 calc(100% - 3.75rem);
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .fw-ekspress .fw-prod--list .fw-ekspress__num { font-size: 0.85rem; }
  .fw-ekspress .fw-prod--list .fw-prod__buycol { margin-left: auto; width: auto; }
  .fw-ekspress .fw-prod--list .fw-prod__buy--row input[type="number"] { width: 2.75rem; }

  /* Without the column heading a bare number is ambiguous: "Laos 3". */
  .fw-ekspress .fw-prod--list .fw-prod__stockcol { width: auto; padding-right: 0 !important; color: var(--fw-muted, #6b6b6b); font-size: 0.85rem; }
  .fw-ekspress .fw-prod--list .fw-prod__stockcol::before { content: attr(data-label) " "; }
}

@media (max-width: 40rem) {
  .fw-ekspress .fw-prod--grid tbody tr { padding: 0.75rem; }
}

/* Tiles line up: the order area is one height whether it holds the quantity
   and button or the "Tellimisel" word. */
.fw-ekspress .fw-prod--grid td.fw-prod__buycol {
  display: flex;
  align-items: center;
  min-height: 2.1rem;
}

@media (max-width: 40rem) {

  /* Tables of companies and people: each row a two-line card, the status or action under the name. */
  .fw-ekspress__table:has(.fw-ekspress__name) thead { display: none; }
  .fw-ekspress__table:has(.fw-ekspress__name) tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.75rem; row-gap: 0.5rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--fw-line); }
  .fw-ekspress__table:has(.fw-ekspress__name) tr:last-child { border-bottom: 0; }
  .fw-ekspress__table:has(.fw-ekspress__name) td { display: block; padding: 0; border: 0; }
  .fw-ekspress__table:has(.fw-ekspress__name) td.fw-ekspress__actions { grid-column: 1 / -1; text-align: left; white-space: normal; }
}

@media (max-width: 40rem) {

  .fw-ekspress table.fw-cart tr.cart_item td.fw-prod__thumb { display: none; }
  .fw-ekspress table.fw-cart .fw-ekspress__name { grid-area: name; }
  .fw-ekspress table.fw-cart .fw-ekspress__num { grid-area: code; font-size: 0.85rem; }
  .fw-ekspress table.fw-cart td.fw-prod__pricecol:not(.fw-cart__linetotal) { grid-area: price; }
}

@media (max-width: 40rem) {

  .fw-order__table .fw-ekspress__name { flex: 1 0 100%; min-width: 0; overflow-wrap: anywhere; }
  .fw-order__table .fw-ekspress__num { font-size: 0.85rem; }
  .fw-order__table .fw-prod__pricecol { margin-left: auto; }
}

.fw-return .fw-ekspress__card {
  margin: 0 0 1.25rem;
}

.fw-prod__price { font-weight: 500; }

.fw-prod__was {
  margin-right: 0.4rem;
  color: var(--fw-muted, #6b6b6b);
  font-size: 0.85rem;
}
