/* Design 1 — "Shop By Categories": a heading, then a slider of category
 * tiles. The template's most shared category row; its tile has three looks
 * (the section's `tile_style`):
 *   round   index.html ~1754 / home-decor: .category-v01.hover-img, picture
 *           in a circle (radius 50%), margin-bottom 16px, name .h5
 *           (clamp 22-24px / 28-30px, fw 500) centred; slider gaps
 *           30 / 15 / 10 (>=1200 / >=768 / below).
 *   rounded home-auto: .category-v01.style-2, the same with a 12px corner.
 *   card    home-mental ~1664: .category-v02.hover-img on var(--bg) with a
 *           16px corner and 28px/15px padding, picture max 120px
 *           (.overflow-visible: its zoom is not clipped), name .h6 20/28
 *           with 4px under it, count .cl-text-2 body text; gap 10px at every
 *           width. Its offer tile (.category-v02.style-2) is the same card on
 *           rgba(205,62,52,.10) with a --primary circle (max 120px) holding
 *           the value (.h3) and a word (.h6) in white, the name in --primary.
 * Section: .flat-spacing (80px both sides; 60px up to 991px; 40px up to
 * 425px) inside the plain .container (1440px, this section's default).
 * Heading .sect-heading.type-2: centred, or .has-col-right (title block at
 * the start, a .tf-btn-line-2.style-primary.py-4 "View all" at the end,
 * aligned to the bottom, 12px gap, wraps under on a narrow screen).
 * Pager .sw-line-default.style-2, 20px above it (.tf-swiper .tf-sw-pagination).
 */
.mt-section.amer-category-carousel--d1 { padding-block: var(--mt-space-top, 80px) var(--mt-space-bottom, 80px); }
@media (max-width: 991px) {
  .mt-section.amer-category-carousel--d1 { padding-block: var(--mt-space-top, 60px) var(--mt-space-bottom, 60px); }
}
@media (max-width: 767px) {
  .mt-section.amer-category-carousel--d1 { padding-block: var(--mt-space-top-mobile, var(--mt-space-top, 60px)) var(--mt-space-bottom-mobile, var(--mt-space-bottom, 60px)); }
}
@media (max-width: 425px) {
  .mt-section.amer-category-carousel--d1 { padding-block: var(--mt-space-top-mobile, var(--mt-space-top, 40px)) var(--mt-space-bottom-mobile, var(--mt-space-bottom, 40px)); }
}

/* ---- Heading ------------------------------------------------------------ */
/* .sect-heading .s-title keeps 8px under it even with no description; the
   description is .text-body-1 (18px/28px; 14px/22px up to 575px). */
.amer-category-carousel--d1 .amer-head__main { gap: 0; }
/* Centred, .s-title and .s-desc are full-width blocks with centred text. */
.amer-category-carousel--d1 .amer-head--center .amer-head__main { inline-size: 100%; justify-items: stretch; }
.amer-category-carousel--d1 .amer-head__title { margin-block-end: 8px; }
.amer-category-carousel--d1 .amer-head__text { line-height: 28px; }
@media (max-width: 575px) { .amer-category-carousel--d1 .amer-head__text { line-height: 22px; } }
.amer-category-carousel--d1 .amer-cat-head--split { gap: 12px; }
.amer-category-carousel--d1 .amer-head--center .amer-cat-head__all { margin-block-start: 4px; }
/* «مكان زرار عرض الكل» = «تحت القسم»: the same link, centred under the slider, a short step below it (24px, 20px on a
   phone), as product tabs draw theirs (Mohamed, 2026-10-29: «ليه مفيش اوبشن انى اخلي زرار عرض الجميع تحت القسم؟»). */
.amer-category-carousel--d1 .amer-cat-foot { display: flex; justify-content: center; margin-block-start: 24px; }
@media (max-width: 767px) {
  .amer-category-carousel--d1 .amer-cat-foot { margin-block-start: 20px; }
}

/* "View all": .tf-btn-line-2.style-primary.py-4 around a .fw-semibold span.
   The text is a two-colour gradient clipped to the glyphs: --text at rest,
   --primary sweeping in from the reading start on hover; under it a 2px
   --text rule with a --primary rule growing over it. 0.3s linear. */
.amer-category-carousel--d1 .amer-cat-head__all {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-block: 4px;
  font-size: var(--amer-fs-body);
  line-height: var(--amer-lh-body);
  font-weight: 400;
  color: var(--amer-heading);
  text-decoration: none;
  background: linear-gradient(to right, var(--amer-accent) 50%, var(--amer-heading) 50%);
  background-size: 200% 100%;
  background-position: right;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background-position .3s linear;
}
.amer-category-carousel--d1 .amer-cat-head__all::after,
.amer-category-carousel--d1 .amer-cat-head__all::before {
  content: "";
  position: absolute;
  inset-block-end: 0;
  inset-inline-start: 0;
  block-size: 2px;
}
.amer-category-carousel--d1 .amer-cat-head__all::after { inset-inline-end: 0; background-color: var(--amer-heading); }
.amer-category-carousel--d1 .amer-cat-head__all::before { inline-size: 0; z-index: 1; background-color: var(--amer-accent); transition: inline-size .3s linear; }
.amer-category-carousel--d1 .amer-cat-head__all:hover,
.amer-category-carousel--d1 .amer-cat-head__all:focus-visible { background-position: left; }
.amer-category-carousel--d1 .amer-cat-head__all:hover::before,
.amer-category-carousel--d1 .amer-cat-head__all:focus-visible::before { inline-size: 100%; }
.amer-category-carousel--d1 .amer-cat-head__all-text { font-weight: 600; }
[dir="rtl"] .amer-category-carousel--d1 .amer-cat-head__all { background-image: linear-gradient(to left, var(--amer-accent) 50%, var(--amer-heading) 50%); background-position: left; }
[dir="rtl"] .amer-category-carousel--d1 .amer-cat-head__all:hover,
[dir="rtl"] .amer-category-carousel--d1 .amer-cat-head__all:focus-visible { background-position: right; }

/* ---- Tile, every look ---------------------------------------------------- */
.amer-category-carousel--d1 .amer-cat-tile--d1 {
  display: grid;
  align-content: start;
  color: inherit;
  text-decoration: none;
  transition: all .3s ease; /* the template's `a` */
}
.amer-category-carousel--d1 .amer-cat-tile__media {
  display: block;
  position: relative;
  inline-size: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin-block-end: 16px;
}
.amer-category-carousel--d1 .amer-cat-tile__media img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transition: opacity .5s ease, transform 1.5s cubic-bezier(0, 0, .44, 1.18);
}
.amer-category-carousel--d1 .amer-cat-tile--d1:hover .amer-cat-tile__media img,
.amer-category-carousel--d1 .amer-cat-tile--d1:focus-visible .amer-cat-tile__media img { transform: scale(1.1); }
/* No picture: the tag icon centred on the surface colour, in the picture's
   own frame (the same markup server-side and from the JS). */
.amer-category-carousel--d1 .amer-cat-tile__media > .ai {
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  block-size: 100%;
  background: var(--amer-surface);
  font-size: 40px;
  color: var(--amer-muted);
}
.amer-category-carousel--d1 .amer-cat-tile__content { display: block; min-inline-size: 0; text-align: center; }
.amer-category-carousel--d1 .amer-cat-tile__name {
  display: block;
  font-family: var(--amer-font-heading);
  font-weight: var(--amer-fw-heading);
  color: var(--amer-heading);
  overflow-wrap: anywhere;
  /* .link.link-underline: the name turns --primary with a --primary
     underline under the pointer (the picture's zoom is the tile's hover). */
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: all .3s ease;
}
.amer-category-carousel--d1 .amer-cat-tile__name:hover,
.amer-category-carousel--d1 .amer-cat-tile--d1:focus-visible .amer-cat-tile__name { color: var(--amer-accent); text-decoration-color: var(--amer-accent); }
.amer-category-carousel--d1 .amer-cat-tile__count {
  display: block;
  font-size: var(--amer-fs-body);
  line-height: 1.625;
  color: var(--amer-muted);
}
.amer-category-carousel--d1 .amer-lines { margin-block-start: 20px; }

/* ---- round / rounded (.category-v01) ------------------------------------- */
.amer-category-carousel--d1.amer-category-carousel--round .amer-cat-tile__media { border-radius: 50%; }
.amer-category-carousel--d1.amer-category-carousel--rounded .amer-cat-tile__media { border-radius: 12px; }
.amer-category-carousel--d1.amer-category-carousel--round .amer-cat-tile__name,
.amer-category-carousel--d1.amer-category-carousel--rounded .amer-cat-tile__name { font-size: clamp(22px, 3vw, 24px); line-height: clamp(28px, 3.5vw, 30px); }

/* ---- card (.category-v02) ------------------------------------------------ */
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile--d1 {
  place-items: center;
  block-size: 100%;
  padding-block: 28px;
  padding-inline: 15px;
  border-radius: 16px;
  background: var(--amer-surface);
}
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile__media { inline-size: 120px; max-inline-size: 100%; overflow: visible; }
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile__media > .ai { border-radius: 50%; background: var(--amer-bg); }
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile__name { margin-block-end: 4px; font-size: var(--amer-fs-h6); line-height: 28px; }

/* The offer tile: a --primary circle holding the value and a word, on a
   tint of the accent; the name in the accent. Any look can carry it. */
.amer-category-carousel--d1 .amer-cat-tile__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  inline-size: 100%;
  aspect-ratio: 1 / 1;
  margin-block-end: 16px;
  border-radius: 50%;
  background: var(--amer-accent);
  /* The look's text-on-accent (white on looks 1-2, dark on the light
     accents of 3-6): white on the wellness coral read 2.03:1 (visual review
     2026-09-23), dark 7.0:1. */
  color: var(--amer-on-accent, #fff);
  font-family: var(--amer-font-heading);
  font-weight: var(--amer-fw-heading);
  text-align: center;
}
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile__badge { inline-size: 120px; max-inline-size: 100%; }
.amer-category-carousel--d1 .amer-cat-tile__badge-value { display: block; font-size: var(--amer-fs-h3); line-height: clamp(36px, 4.5vw, 48px); letter-spacing: .05em; }
.amer-category-carousel--d1 .amer-cat-tile__badge > .ai { font-size: 40px; }
.amer-category-carousel--d1 .amer-cat-tile__badge-note { display: block; font-size: var(--amer-fs-h6); line-height: 28px; }
.amer-category-carousel--d1.amer-category-carousel--card .amer-cat-tile--offer { background: color-mix(in srgb, var(--amer-accent) 10.2%, transparent); }
.amer-category-carousel--d1 .amer-cat-tile--offer .amer-cat-tile__name { color: var(--amer-accent); }
.amer-category-carousel--d1 .amer-cat-tile--offer .amer-cat-tile__name:hover,
.amer-category-carousel--d1 .amer-cat-tile--offer:focus-visible .amer-cat-tile__name { text-decoration-color: var(--amer-accent); }

/* Before the slider script runs the pager is empty; it shows only where
   the row has more tiles than one view holds, so nothing moves when Swiper
   arrives (6 / 4 / 3 / 2 per view). */
.amer-category-carousel--d1 .swiper:not(.swiper-initialized) > [data-amer-dots] { display: none; }
.amer-category-carousel--d1 .swiper:not(.swiper-initialized):has(> .swiper-wrapper > .swiper-slide:nth-child(3)) > [data-amer-dots] { display: flex; }
@media (min-width: 575px) { .amer-category-carousel--d1 .swiper:not(.swiper-initialized):not(:has(> .swiper-wrapper > .swiper-slide:nth-child(4))) > [data-amer-dots] { display: none; } }
@media (min-width: 768px) { .amer-category-carousel--d1 .swiper:not(.swiper-initialized):not(:has(> .swiper-wrapper > .swiper-slide:nth-child(5))) > [data-amer-dots] { display: none; } }
@media (min-width: 1200px) { .amer-category-carousel--d1 .swiper:not(.swiper-initialized):not(:has(> .swiper-wrapper > .swiper-slide:nth-child(7))) > [data-amer-dots] { display: none; } }

/* ---- On a dark background ------------------------------------------------ */
/* The template never puts this row on a background, but a merchant can (a
   picture with a dark overlay, or a dark colour). The section then carries
   --on-dark (decided server-side from the overlay colour and opacity) and
   everything drawn straight on the background turns light: the heading, the
   «View all» (text, rule and hover sweep keep the accent), the pager bars
   and the round/rounded names. The card look keeps its dark text on its own
   light cards, and the offer name stays in the accent. */
.amer-category-carousel--d1.amer-category-carousel--on-dark :is(.amer-cat-head, .amer-cat-foot, .amer-lines),
.amer-category-carousel--d1.amer-category-carousel--on-dark:not(.amer-category-carousel--card) .amer-cat-tile__content {
  --amer-heading: #fff;
  --amer-muted: rgba(255, 255, 255, .8);
}
/* The merchant's «لون الكلام» (text_color, 2026-10-13) wins over that white:
   the section carries it as --amer-ink. */
.amer-category-carousel--d1.amer-category-carousel--on-dark.amer-section--ink :is(.amer-cat-head, .amer-cat-foot, .amer-lines),
.amer-category-carousel--d1.amer-category-carousel--on-dark.amer-section--ink:not(.amer-category-carousel--card) .amer-cat-tile__content {
  --amer-heading: var(--amer-ink);
  --amer-muted: color-mix(in srgb, var(--amer-ink) 80%, transparent);
}
/* The card look's offer card is a 10% accent tint that lets the background
   through; over a dark background it gets the page colour under the tint,
   so it stays the same pale card as its neighbours. */
.amer-category-carousel--d1.amer-category-carousel--card.amer-category-carousel--on-dark .amer-cat-tile--offer { background: color-mix(in srgb, var(--amer-accent) 10.2%, var(--amer-bg, #fff)); }

/* Waiting for the store's categories: with an empty manual list the row is
   filled in the browser (zid.categories.list()). Until then it holds one row
   of tiles at their final size, so the section does not grow when they
   arrive (the tile row; see the pager note below): a square picture + 16px + one name line (28px, 30px from 858px) for round/rounded
   (6 / 4 / 3 / 2 across, the slider's own gaps), the 250px card for card. */
.amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before {
  content: "";
  display: block;
  flex: none;
  box-sizing: content-box;
  --cc-per: 2; --cc-gap: 10px;
  inline-size: calc((100% - (var(--cc-per) - 1) * var(--cc-gap)) / var(--cc-per));
  aspect-ratio: 1 / 1;
  padding-block-end: 44px;
}
@media (min-width: 575px) { .amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before { --cc-per: 3; } }
@media (min-width: 768px) { .amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before { --cc-per: 4; --cc-gap: 15px; } }
@media (min-width: 858px) { .amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before { padding-block-end: 46px; } }
@media (min-width: 1200px) { .amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before { --cc-per: 6; --cc-gap: 30px; } }
.amer-category-carousel--d1.amer-category-carousel--card [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide))::before { aspect-ratio: auto; block-size: 250px; padding-block-end: 0; }
/* Below 1200px (2-4 across) a store almost always has more categories than
   one view holds, so the line pager's 24px (20px above it + the 4px bars) is
   held too; from 1200px (6 across) it is not, as a store may have six or fewer. */
@media (max-width: 1199px) { .amer-category-carousel--d1 [data-amer-cat-auto="true"]:not([data-amer-cat-filled]) > .swiper-wrapper:not(:has(.swiper-slide)) { padding-block-end: 24px; } }
