/* S257: shared specification-card layout.
   One source of truth for every product page: the gallery tiles, the flat
   spec strips, the title row, and the horizontal rail for bands with more
   than four shots. Desktop only - below 992px the phone grid is untouched.

   Every page carries a base rule of `.mtc-ss-shots { width:70% }` plus a
   per-card column count, so the column rule here lists every count class
   with !important: it must outrank both the base rule and the per-card
   one, whichever page they sit in. */

@media (min-width: 992px) {

  /* ---------- 1. gallery: four equal tiles, whatever the card holds ---------- */
  .mtc-item-stack .mtc-ss-shots,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-1,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-2,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-3,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-4,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-5,
  .mtc-item-stack .mtc-ss-shots.mtc-ss-cols-6 {
    width: 100% !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: .45rem;
    margin: 0 0 .4rem !important;
  }
  .mtc-item-stack .mtc-ss-shot { width: 100%; min-width: 0; }

  /* A band with more than four shots becomes one horizontal rail: the tile
     size stays identical to the four-up band, the extra shots scroll. */
  .mtc-item-stack .mtc-ss-shots.is-scroll {
    display: flex !important;
    flex-wrap: nowrap;
    grid-template-columns: none !important;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
    margin: 0 -.2rem .4rem 0 !important;
  }
  .mtc-item-stack .mtc-ss-shots.is-scroll::-webkit-scrollbar { display: none; }
  .mtc-item-stack .mtc-ss-shots.is-scroll .mtc-ss-shot {
    flex: 0 0 auto;
    width: calc((100% - 1.35rem) / 4);
    scroll-snap-align: start;
    position: relative;
  }

  /* ---------- 3. the "+N" badge on the last visible tile ---------- */
  .mtc-ss-more {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 84, 165, 0.92);
    color:var(--on-dark);
    font: 700 12px/1.2 Arial, Helvetica, sans-serif;
    letter-spacing: .02em;
    pointer-events: none;
    transition: opacity .18s ease;
  }
  .mtc-item-stack .mtc-ss-shots.is-scrolled .mtc-ss-more { opacity: 0; }

  /* ---------- 4. card padding ---------- */
  .mtc-item-stack { padding: 12px 14px 13px !important; }

  /* ---------- 5. the title row: name + code, then a thin rule ---------- */
  .mtc-item-stack .mtc-item-block-head {
    padding-bottom: .25rem !important;
    margin-bottom: .4rem !important;
  }
  /* The SKU chip is a <p>, so it inherits the paragraph margin of the body
     text unless it is reset here. */
  .mtc-item-stack .mtc-item-block-id { margin: 0 !important; }

  /* ---------- 6. the three strips, flattened ---------- */
  .mtc-item-stack .mtc-ss-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: .55rem;
    padding: .32rem .7rem .38rem !important;
    margin-top: .32rem !important;
    border-radius: 7px;
    line-height: 1.2;
    min-height: 0 !important;
  }
  .mtc-item-stack .mtc-ss-headrow { margin-bottom: .16rem; align-items: baseline; }

  /* The heading and the target area share one line, target area pushed right. */
  .mtc-item-stack .mtc-ss-title {
    flex: 0 0 auto;
    font-size: .88rem;
  }
  .mtc-item-stack .mtc-ss-targetrow {
    flex: 0 0 auto;
    margin: 0 0 .18rem auto;
    align-items: center;
    gap: .35rem;
  }
  .mtc-item-stack .mtc-ss-targeticon { width: 1.15rem; height: 1.15rem; }
  .mtc-item-stack .mtc-ss-tlabel { font-size: .6rem; }
  .mtc-item-stack .mtc-ss-tvalue { font-size: .78rem; }

  /* The body of every strip sits on its own row below the heading. */
  .mtc-item-stack .mtc-ss-specbox,
  .mtc-item-stack .mtc-ss-pills,
  .mtc-item-stack .mtc-ss-apps { flex: 0 0 100%; }

  /* ---------- 7. Key Specifications: label above, value below ---------- */
  .mtc-item-stack .mtc-ss-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .06rem;
    padding: .24rem .7rem .3rem;
  }
  .mtc-item-stack .mtc-ss-slabel {
    margin: 0;
    font-size: .6rem;
    line-height: 1.1;
    white-space: nowrap;
  }
  .mtc-item-stack .mtc-ss-svalue { font-size: .78rem; line-height: 1.25; }

  /* ---------- 8. Design & Fit: smaller, denser chips ---------- */
  .mtc-item-stack .mtc-ss-pills { gap: .24rem .3rem; margin: 0; }
  .mtc-item-stack .mtc-ss-pill {
    padding: .12rem .55rem;
    font-size: .74rem;
    cursor: default;
  }

  /* ---------- 9. Applications: three columns, minimal row gap ---------- */
  .mtc-item-stack .mtc-ss-apps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: .9rem;
    row-gap: .06rem;
    margin: 0;
  }
  /* the target row shares the heading line, so the list below it needs a
     little air - at 3px it collides with the row once the font metrics differ */
  .mtc-item-stack .mtc-ss-targetrow + .mtc-ss-apps { margin-top: .45rem; }
  .mtc-item-stack .mtc-ss-apps li { font-size: .78rem; gap: .34rem; }
  .mtc-item-stack .mtc-ss-apps svg {
    width: .92rem;
    height: .92rem;
    margin-top: .1rem;
  }
}

/* ---------- the arrow buttons that scroll the rail ----------
   These live outside the desktop block on purpose: the script adds them to
   every band with more than four shots, whatever the viewport, so they need
   a hidden-by-default rule of their own. Below the desktop breakpoint the
   band is a plain two-column grid and the arrows stay hidden. */
.mtc-ss-nav {
  position: absolute;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c7d8ea;
  background: #fff;
  color:var(--brand);
  font: 700 15px/1 Arial, Helvetica, sans-serif;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 2px 7px rgba(16, 24, 40, 0.16);
}
.mtc-ss-nav:hover { background: #0054a5; color:var(--on-dark); border-color: #0054a5; }
.mtc-ss-nav:focus-visible { outline: 2px solid #f0a500; outline-offset: 1px; }
.mtc-ss-nav:disabled { opacity: .3; cursor: default; }
.mtc-ss-nav.prev { left: 5px; }
.mtc-ss-nav.next { right: 5px; }

@media (min-width: 992px) {
  .mtc-item-stack .mtc-ss-shots.is-scroll ~ .mtc-ss-nav { display: flex; }
}

/* ---------- single- and two-image cards: two-column shell ----------
   S287. A card that holds one picture puts it on the left and stacks the three
   strips on the right, so the wide empty band under a lone tile disappears.
   A card that holds two pictures uses the same shell, but its picture column
   becomes a horizontal rail: the second shot peeks at the right edge and the
   arrows (added by the card script) scroll it.
   The shell only opens from 1200px up: below that the main column is too
   narrow for a 300px picture plus readable text, so the plain stacked grid
   stays. */
@media (min-width: 1200px) {
  .mtc-item-stack.mtc-one-shot,
  .mtc-item-stack.mtc-two-shot {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    column-gap: 1.1rem;
    align-items: start;
  }
  .mtc-item-stack.mtc-one-shot > .mtc-item-block-head,
  .mtc-item-stack.mtc-two-shot > .mtc-item-block-head { grid-column: 1 / -1; }

  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots,
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots {
    grid-column: 1;
    grid-row: 2 / span 3;
    width: 100% !important;
    margin: 0 !important;
  }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots { grid-template-columns: 1fr !important; }

  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots .mtc-ss-shot,
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-ss-shot { width: 100%; }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots .mtc-ss-shot img,
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-ss-shot img {
    width: 100%;
    height: auto;
    display: block;
  }

  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots {
    display: flex !important;
    flex-wrap: nowrap;
    gap: .4rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    grid-template-columns: none !important;
    padding-bottom: 2px;
  }
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-ss-shot {
    flex: 0 0 80%;
    scroll-snap-align: start;
  }

  .mtc-item-stack.mtc-one-shot > .mtc-ss-zone:nth-of-type(3),
  .mtc-item-stack.mtc-two-shot > .mtc-ss-zone:nth-of-type(3) {
    grid-column: 2; grid-row: 2; margin-top: 0 !important; align-self: start;
  }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-zone:nth-of-type(4),
  .mtc-item-stack.mtc-two-shot > .mtc-ss-zone:nth-of-type(4) {
    grid-column: 2; grid-row: 3; align-self: start;
  }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-zone:nth-of-type(5),
  .mtc-item-stack.mtc-two-shot > .mtc-ss-zone:nth-of-type(5) {
    grid-column: 2; grid-row: 4; align-self: start;
  }

  /* the rail only exists in this width range, so do the arrows */
  .mtc-item-stack.mtc-two-shot > .mtc-ss-nav { display: flex; }

  /* ---------- picture column ends where the last panel ends ----------
     The band is stretched to the height of the three strips, and the picture
     is fitted inside that box without cropping, anchored to the bottom, so
     both columns finish on the same line whatever the text length is. */
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots,
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots {
    align-self: stretch;
    min-height: 0;
    height: auto;
    /* the band spans three rows, so its own picture height would otherwise
       push those rows taller than the text; contain:size takes it out of the
       track sizing and lets the band simply take the height it is given */
    contain: size;
  }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots .mtc-ss-shot { height: 100%; }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots .mtc-zoombox-trigger { height: 100%; }
  .mtc-item-stack.mtc-one-shot > .mtc-ss-shots .mtc-zoombox-trigger img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }

  /* the two-shot rail sizes each tile to the stretched height, so the first
     picture always reaches the bottom edge; the peek shrinks accordingly */
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-ss-shot {
    flex: 0 0 auto;
    height: 100%;
  }
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-zoombox-trigger {
    width: auto;
    max-width: 100%;
    height: 100%;
  }
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots .mtc-zoombox-trigger img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
  }
  /* the rail scrolls by arrow or finger; a bar under the picture would break
     the bottom line it is meant to share with the text column */
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots { scrollbar-width: none; }
  .mtc-item-stack.mtc-two-shot > .mtc-ss-shots::-webkit-scrollbar { display: none; }
}
