/* Amer — Product tabs, design 2: a promo banner per tab beside a product
 * grid (template: home-construction.html:1696, `.section-top-pick-v02
 * .flat-animate-tab`, «Top Picks This Week»). Measured against the template
 * with measure_styles.mjs at 1440/1024/768/390
 * (D:/tmp/amer-build/r5/build-product-tabs/spec-construction.json):
 *  - section: no spacing of its own (the template's section has no
 *    .flat-spacing; its neighbours carry the space). The four spacing
 *    settings set it.
 *  - heading (.sect-heading.type-2.has-col-right): title + line at the
 *    start, the tab pills at the end, bottom-aligned, wrapping under the
 *    title when the row is too narrow; 12px between; 44px under it from
 *    992px, 24px below (amer-core's .amer-head).
 *  - pills (.tab-btn-wrap-v2): 12px apart, 7px 23px padding, a 1px line
 *    that turns the accent on hover and on the open tab, 68px corners,
 *    600 on a 26px line; the row scrolls sideways when it does not fit.
 *  - pane (.wrap-prd): from 1025px a row, 20px apart, the banner column
 *    `flex: 20%` and the grid column `flex: 40.284%` (552 + 838 at 1440);
 *    below, one column. The banner is 552x376 (the picture's own ratio),
 *    16px corners, 20px over its two cards, 450px tall at least under
 *    768px; its text 36px in from the edges, white: title (h3 type, 8px
 *    under it), text 18/28 (28px under it), a white pill. Typed line
 *    breaks hold from 1400px only (the template's d-xxl-block <br>).
 *  - grids (.tf-grid-layout gap-20): two columns beside the banner, three
 *    in the second column from 992px (two below), 20px apart; 20px rows and
 *    15px columns below 992px.
 */
.mt-section.amer-product-tabs--d2 {
  padding-block-start: var(--mt-space-top, 0px);
  padding-block-end: var(--mt-space-bottom, 0px);
}
@media (max-width: 767px) {
  .mt-section.amer-product-tabs--d2 {
    padding-block-start: var(--mt-space-top-mobile, var(--mt-space-top, 0px));
    padding-block-end: var(--mt-space-bottom-mobile, var(--mt-space-bottom, 0px));
  }
}

/* ---- Heading row --------------------------------------------------------- */
.amer-product-tabs--d2 .amer-product-tabs__head { gap: 12px; }
.amer-product-tabs--d2 .amer-product-tabs__nav-scroll {
  max-inline-size: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.amer-product-tabs--d2 .amer-product-tabs__nav-scroll::-webkit-scrollbar { display: none; }
.amer-product-tabs--d2 .amer-product-tabs__nav { display: flex; align-items: center; gap: 12px; }
.amer-product-tabs--d2 .amer-product-tabs__tab {
  flex: none;
  padding: 7px 23px;
  border: 1px solid var(--amer-line);
  border-radius: 68px;
  background: transparent;
  font-weight: 600;
  line-height: 26px;
  white-space: nowrap;
}
.amer-product-tabs--d2 .amer-product-tabs__tab:hover,
.amer-product-tabs--d2 .amer-product-tabs__tab.is-active { border-color: var(--amer-accent); }

/* ---- Pane: banner column + grid column ----------------------------------- */
.amer-product-tabs--d2 .amer-product-tabs__wrap { display: flex; flex-direction: column; gap: 20px; }
.amer-product-tabs--d2 .amer-product-tabs__col { min-inline-size: 0; }
@media (min-width: 1025px) {
  .amer-product-tabs--d2 .amer-product-tabs__wrap { flex-direction: row; }
  .amer-product-tabs--d2 .amer-product-tabs__col--lead { flex: 1 1 20%; }
  .amer-product-tabs--d2 .amer-product-tabs__col--rest { flex: 1 1 40.284%; }
}

.amer-product-tabs--d2 .amer-product-tabs__banner {
  position: relative;
  display: block;
  margin-block-end: 20px;
  border-radius: 16px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}
/* The box keeps the picture's 552x376 ratio through a padding spacer, not
   aspect-ratio: with aspect-ratio, the 450px phone minimum below was carried
   over to the width (660px, measured) and the picture was cropped from one
   side instead of the middle. */
.amer-product-tabs--d2 .amer-product-tabs__banner-media {
  position: relative;
  display: block;
  background: var(--amer-surface);
}
.amer-product-tabs--d2 .amer-product-tabs__banner-media::before { content: ""; display: block; padding-block-start: 68.116%; }
/* No picture yet: a dark ground, so the white text still reads. */
.amer-product-tabs--d2 .amer-product-tabs__banner-media--empty { background: var(--amer-heading); }
/* The words are always white and sit in the top corner: a dark shade from
   the top keeps them readable over a light picture (the small line was 2.7:1
   on the red drill, the headphone text 2.5:1 on the gold headband; 8.5:1 and
   6.1:1 with it, visual review 2026-09-23). Fades out by 65%. */
.amer-product-tabs--d2 .amer-product-tabs__banner-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgb(0 0 0 / .62), rgb(0 0 0 / .3) 40%, rgb(0 0 0 / 0) 65%);
}
.amer-product-tabs--d2 .amer-product-tabs__banner-media--empty::after { content: none; }
.amer-product-tabs--d2 .amer-product-tabs__banner-media img {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transition: transform .6s var(--amer-ease);
}
.amer-product-tabs--d2 a.amer-product-tabs__banner:hover .amer-product-tabs__banner-media img { transform: scale(1.05); }
@media (max-width: 767px) {
  .amer-product-tabs--d2 .amer-product-tabs__banner-media::before { min-block-size: 450px; }
}
.amer-product-tabs--d2 .amer-product-tabs__banner-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 36px;
}
.amer-product-tabs--d2 .amer-product-tabs__banner-eyebrow { margin-block-end: 8px; color: #fff; }
/* The template's h3 on its own line box: clamp(36px, 4.5vw, 48px), as the
   section title (amer-core's h3 class says 1.2 x the size: 33.6px at 390). */
.amer-product-tabs--d2 .amer-product-tabs__banner-title { margin-block-end: 8px; line-height: clamp(36px, 4.5vw, 48px); color: #fff; }
@media (max-width: 1399px) {
  .amer-product-tabs--d2 .amer-product-tabs__br { display: none; }
}
.amer-product-tabs--d2 .amer-product-tabs__banner-text {
  display: block;
  margin-block-end: 28px;
  font-size: var(--amer-fs-lead);
  line-height: 28px;
  color: #fff;
}
.amer-product-tabs--d2 .amer-product-tabs__banner-content > :last-child { margin-block-end: 0; }
/* .tf-btn.btn-white.hv-primary: white, the accent on hover. */
.amer-product-tabs--d2 a.amer-product-tabs__banner:hover .amer-product-tabs__banner-btn,
.amer-product-tabs--d2 a.amer-product-tabs__banner:focus-visible .amer-product-tabs__banner-btn { background: var(--amer-accent); color: var(--amer-on-accent); }

.amer-product-tabs--d2 .amer-product-tabs__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 15px;
}
@media (min-width: 992px) {
  .amer-product-tabs--d2 .amer-product-tabs__grid { gap: 20px; }
  .amer-product-tabs--d2 .amer-product-tabs__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.amer-product-tabs--d2 .amer-product-tabs__cell { min-inline-size: 0; }
.amer-product-tabs--d2 .amer-product-tabs__cell > * { block-size: 100%; }

/* One grid from 1025px when a tab has its banner and products beside it (--rows; Framlna, 2026-10-29: «عايزين نوحد الارتفاعات
   بين الكروت»). The banner column and the products column were two boxes: the two cards under the banner started where the
   banner's own 552x376 picture ended, the row beside them where the first row's cards did, and with cards taller or shorter
   than the picture the two rows never met (13px apart on Framlna's page). Here both columns and their grids step aside
   (display: contents) and every card is a cell of one five-column grid, the same column width as before: the banner spans
   the first two columns of the first row and takes the height its cards give that row, and the cards under it share the
   second row with the others, so every card has one top and one height in its row and the two rows match. The banner's
   picture covers that box (no longer its own 552x376), so the tab's «الجزء اللي يفضل باين لما البانر يتقص» decides what a
   crop keeps. The banner gives the row no height of its own: kept at 552x376 it stretched shorter cards in the first row
   and left boxed and framed cards (card designs 2 and 3) taller there than in the second (review, 2026-10-29).
   A tab with no banner, or with nothing beside it, keeps the two boxes. */
@media (min-width: 1025px) {
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows :is(.amer-product-tabs__col, .amer-product-tabs__grid) { display: contents; }
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows .amer-product-tabs__banner {
    grid-column: 1 / span 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    margin-block-end: 0;
  }
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows .amer-product-tabs__banner-media { flex: 1 1 auto; }
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows .amer-product-tabs__banner-media::before { content: none; }
  .amer-product-tabs--d2 .amer-product-tabs__wrap--rows .amer-product-tabs__col--lead .amer-product-tabs__cell { grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .amer-product-tabs--d2 .amer-product-tabs__banner-media img { transition: none; }
}

/* A tab's picture (tabs[].image, 2026-10-13): 24px and round before the name
   inside the pill, on the light surface, shown whole; the pill keeps its
   26px line, so it is no taller. */
.amer-product-tabs--d2 .amer-product-tabs__tab--media { display: inline-flex; align-items: center; gap: 8px; }
.amer-product-tabs--d2 .amer-product-tabs__tab-media { display: block; flex: none; inline-size: 24px; block-size: 24px; border-radius: 50%; overflow: hidden; background: var(--amer-surface); }
.amer-product-tabs--d2 .amer-product-tabs__tab-media img { display: block; inline-size: 100%; block-size: 100%; object-fit: contain; }

/* «لون الكلام» (text_color, 2026-10-13): the banner keeps the theme's
   colours. Its words are always white over the picture, and a banner with no
   picture is filled with the heading colour, which the section's colour
   would otherwise turn white under white words. */
.amer-product-tabs--d2.amer-section--ink .amer-product-tabs__banner {
  --amer-heading: var(--amer-theme-heading);
  --amer-text: var(--amer-theme-text);
  --amer-muted: var(--amer-theme-muted);
}
