/* Product rail: ONE module for the home, the FFC / FPC / RFC long pages and the application pages (module/product-rail.html).
   Tabs centred above (PC only), fixed-width cards (390px) at every width: as many whole cards as fit, centred, both neighbours
   bleeding by the same amount; pager (prev 01 / 08 next) below. Home shows "view details" only; inner pages add "quote". Change the card here, never per page.
   Behaviour: public/modules/nw-edge-rail.js (data-nw-edge-rail-fit) + pl-landing.js (tabs, popup). Popup styles: nw-pl-form-dialog.css.
   Order: variables · tabs · rail geometry · card · pager · home footer row · tablet / phone · reduced motion. */

/* The viewport bleeds to both screen edges (100vw), so the section clips the sideways overflow. */
body[class] .variants-section { overflow-x: clip; }

body[class] .variant-products {
  --nw-fit-peek: 58px; /* min. room from a whole card to the screen edge, gap included (~40px strip of the neighbour); read by nw-edge-rail.js */
  --nw-card-w: min(390px, calc(100vw - 2 * var(--nw-fit-peek))); /* 390 wherever it fits; a phone narrower than 506px gets one narrower card */
  --apps-gap: 18px;
  --apps-side-gutter: 0px;
}

/* ---------- Tabs (the chips themselves are the shared nw-chips.css) ---------- */
body[class] .variant-toolbar { display: flex; justify-content: center; margin: 0 0 52px; } /* the viewport pulls 12px back up, so the visible gap is 40px */

/* ---------- Rail geometry ---------- */
body[class] .variant-viewport {
  overflow: hidden;
  /* Room for the card lift and its shadow inside the clipping box; cancelled by the negative margins, so spacing is unchanged. */
  padding: 12px 0 40px;
  margin: -12px calc(50% - 50vw) -40px;
  width: 100vw;
  max-width: 100vw;
  touch-action: pan-y; /* vertical scroll stays with the page; horizontal swipes go to NwEdgeRail */
  overscroll-behavior-x: contain;
}
body[class] .variant-track {
  display: flex;
  gap: var(--apps-gap);
  box-sizing: border-box;
  margin-left: var(--nw-fit-peek); /* before the script runs; NwEdgeRail then centres the whole cards */
  will-change: transform;
}

/* ---------- Card ---------- */
body[class] .variant-products .variant-card {
  display: flex;
  flex: 0 0 var(--nw-card-w);
  flex-direction: column;
  width: var(--nw-card-w);
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  background: #fff;
  transition: transform .35s var(--ease-lift);
  will-change: transform; /* own layer: the lift does not re-raster the card edges */
}
body[class] .variant-products .variant-card[hidden] { display: none; }

/* Picture: the whole product is shown, never cropped; it zooms inside its frame. */
body[class] .variant-art {
  position: relative;
  flex: none;
  aspect-ratio: 366 / 300;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
body[class] .variant-art > img { display: block; width: 100%; height: 100%; padding: 0; object-fit: contain; transition: transform .4s; }
body[class] .variant-art > span {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .88);
  color: #5d6b82;
  font-size: var(--nw-fs-meta);
  letter-spacing: .7px;
}
/* The hairline is drawn above the picture (not a border on the box that zooms), so neither zoom nor lift makes it flicker. */
body[class] .variant-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 1px; background: var(--nw-line-faint); pointer-events: none; }

/* Copy: colours = the about capability cards (ink title, muted text); sizes = the news / applications cards (title + secondary),
   so PC / tablet / phone follow nw-type.css. Title and summary stay on one line (ellipsis) so every card has the same height;
   the popup shows the full text. */
body[class] .variant-copy { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 22px 22px 20px; }
body[class] .variant-copy > h3 { margin: 0; color: var(--ink); font-size: var(--nw-fs-title); font-weight: 500; line-height: 1.3; letter-spacing: -.45px; }
body[class] .variant-copy > p { margin: 8px 0 0; color: var(--muted); font-size: var(--nw-fs-secondary); line-height: 1.65; }
body[class] .variant-copy > :is(h3, p) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Spec rows: label hugs its text, the value takes the rest, right-aligned; one line each (ellipsis) so every card has the same height. */
body[class] .variant-specs { margin: 20px 0 0; padding: 0; }
body[class] .variant-specs > div { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 28px; align-items: start; padding-block: 15px; border-top: 1px solid var(--nw-border); font-size: var(--nw-fs-secondary); line-height: 1.55; }
body[class] .variant-specs :is(dt, dd) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body[class] .variant-specs dt { color: var(--muted); }
body[class] .variant-specs dd { color: var(--ink); text-align: right; font-weight: 500; }

/* "View details" (+ "quote" on inner pages) side by side at the bottom of the card. */
body[class] .variant-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 18px; }
body[class] .variant-actions .variant-detail {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: var(--nw-fs-meta);
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition: background-color .2s, border-color .2s;
}

/* Quote = the site's primary .button (gradient from --nw-gradient-brand); the long-page sheets paint .button flat,
   so the gradient and hover shadow are restored here from the shared tokens. */
body[class] .variant-products .variant-quote.button {
  flex: 1 1 0;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-size: var(--nw-fs-meta);
  line-height: 1.3;
  background-color: var(--main-color);
  background-image: var(--nw-gradient-brand, var(--gradient-action));
  background-size: 150% 100%;
  background-position: 0% 50%;
  transition: background-position .65s ease, box-shadow .3s ease, transform .3s ease;
}

/* ---------- Pager (under the cards): same distance as the news pager (48 PC / 33 tablet / 23 phone) ---------- */
body[class] .variant-foot { display: flex; justify-content: center; margin-top: 48px; }
body[class] .variant-nav { display: flex; align-items: center; gap: 18px; }
body[class] .variant-page { min-width: 4.5em; color: #5d6b82; font-size: var(--nw-fs-secondary); font-variant-numeric: tabular-nums; letter-spacing: .04em; text-align: center; }

/* ---------- Home (single button): the card's classic footer row ----------
   Hairline above, brand-colour label left, round arrow right; on PC, hovering the card fills the arrow with the brand gradient and turns it. */
body[class] .variant-actions--row { padding-top: 0; }
body[class] .variant-actions--row .variant-detail {
  justify-content: space-between;
  gap: 16px;
  min-height: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--nw-border);
  border-radius: 0;
  background: none;
  color: var(--brand);
  font-size: var(--nw-fs-secondary);
  text-align: left;
}
body[class] .variant-actions--row .variant-detail > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--main-color-line);
  border-radius: 50%;
  transition: background .2s, color .2s;
}
body[class] .variant-actions--row .variant-detail > span > .icon { display: inline-flex; transition: transform var(--nw-motion-dur-fast, .28s) var(--nw-motion-ease, ease); }

/* ---------- Tablet / phone (≤1279) ---------- */
@media (max-width: 1279px) {
  body[class] .variant-toolbar { display: none; } /* no category tabs: the rail shows the first tab's cards */
  /* the shared pager (.nw-m-peek-nav, round blue buttons) replaces this one and sets its own distance */
  body[class] .variant-foot { margin-top: 0; }
  body[class] .variant-nav { display: none; }
  /* last spec row gets its closing hairline (the home footer row draws its own) */
  body[class] .variant-specs:has(+ .variant-actions:not(.variant-actions--row)) > div:last-child { border-bottom: 1px solid var(--nw-border); }
}
/* Phone (≤960): "view details" only, full width (the quote button does not fit). */
@media (max-width: 960px) {
  body[class] .variant-actions .variant-quote { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body[class] .variant-products .variant-card { transition: none; }
}

/* ---------- Hover: PC only ----------
   Tablet / phone are touch screens, so hover means nothing there. Every hover rule waits for a real pointer on a PC-width screen. */
@media (min-width: 1280px) and (hover: hover) {
  body[class] .variant-products .variant-card:hover { transform: var(--nw-card-lift); }
  body[class] .variant-card:hover .variant-art > img { transform: scale(1.045); }
  body[class] .variant-actions .variant-detail:hover { border-color: var(--nw-line-ui-hover); background: var(--nw-surface-soft); }
  body[class] .variant-products .variant-quote.button:hover {
    background-color: var(--main-color);
    background-position: 100% 50%;
    box-shadow: var(--nw-shadow-brand-hover, 0 10px 22px #615ced33);
    transform: translateY(-2px);
  }
  body[class] .variant-actions--row .variant-detail:hover { border-color: var(--nw-border); background: none; }
  body[class] .variant-card:hover .variant-actions--row .variant-detail > span > .icon { transform: rotate(var(--nw-motion-arrow-turn, 45deg)); } /* same turn as every other site arrow */
  body[class] .variant-card:hover .variant-actions--row .variant-detail > span { border-color: transparent; background: var(--gradient-action); color: #fff; box-shadow: 0 4px 10px #615ced33; }

  @media (prefers-reduced-motion: reduce) {
    body[class] .variant-products .variant-card:hover { transform: none; }
    body[class] .variant-card:hover .variant-art > img { transform: none; }
  }
}
