/* ===================================================================
   Home sections - shared styles (hm-*)
   Used by: departments-grid, featured-products, featured-categories,
   featured-collections. Colours come from the design tokens
   (snippets/design-tokens.liquid); no hard-coded hex.
   =================================================================== */

.hm-sec { position: relative; box-sizing: border-box; }

.hm-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--container, 1440px);
  margin-inline: auto;
  padding-inline: var(--gutter, 64px);
}

/* ---- Section head: eyebrow + H2 on the start side, tools on the end ---- */
.hm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-block-end: 40px;
}

.hm-head__text { min-width: 0; }

.hm-eyebrow {
  display: block;
  margin: 0 0 14px;
  color: var(--c-blue);
  font: 700 12px/1 var(--f-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hm-title {
  margin: 0;
  max-width: 720px;
  font-size: var(--fs-h2, 44px);
  line-height: 1.14;
}

.hm-sub {
  margin: 12px 0 0;
  max-width: 720px;
  color: var(--c-gray);
  font: 400 var(--fs-lead, 19px)/1.5 var(--f-body);
}

.hm-head__tools {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.hm-viewall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-ink);
  font: 600 16px/1 var(--f-body);
  text-decoration: none;
  white-space: nowrap;
}
.hm-viewall:hover { color: var(--c-blue); }

.hm-arrows { display: none; align-items: center; gap: 10px; }

.hm-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--c-line);
  border-radius: 999px;
  background: transparent;
  color: var(--c-ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.hm-arrow:hover { border-color: var(--c-ink); }
.hm-arrow:focus-visible,
.hm-viewall:focus-visible,
.hm-card:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 3px; }

.hm-empty { margin: 0; text-align: center; color: var(--c-gray); }

/* ---- Grid / swipe engine: per-breakpoint classes live on the section root ---- */
.hm-grid {
  display: grid;
  gap: var(--hm-gap, 24px);
  grid-template-columns: repeat(var(--hm-cols, 4), minmax(0, 1fr));
}

@media (min-width: 992px) {
  .hm-sec.is-desktop-swipe .hm-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
  }
  .hm-sec.is-desktop-swipe .hm-grid::-webkit-scrollbar { display: none; }
  .hm-sec.is-desktop-swipe .hm-grid > * {
    flex: 0 0 calc((100% - (var(--hm-cols, 4) - 1) * var(--hm-gap, 24px)) / var(--hm-cols, 4));
    min-width: 0;
    scroll-snap-align: start;
  }
  .hm-sec.is-desktop-swipe .hm-arrows { display: flex; }
}

@media (min-width: 641px) and (max-width: 991px) {
  .hm-grid { grid-template-columns: repeat(var(--hm-cols-t, 3), minmax(0, 1fr)); }
  .hm-sec.is-tablet-swipe .hm-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
  }
  .hm-sec.is-tablet-swipe .hm-grid::-webkit-scrollbar { display: none; }
  .hm-sec.is-tablet-swipe .hm-grid > * {
    flex: 0 0 var(--hm-w-t, 240px);
    min-width: 0;
    scroll-snap-align: start;
  }
  .hm-sec.is-tablet-swipe .hm-arrows { display: flex; }
  .hm-title { font-size: calc(var(--fs-h2, 44px) * 0.85); }
}

@media (max-width: 640px) {
  .hm-head { flex-direction: column; align-items: flex-start; margin-block-end: 28px; }
  .hm-grid { grid-template-columns: repeat(var(--hm-cols-m, 2), minmax(0, 1fr)); gap: 16px; }
  .hm-sec.is-mobile-swipe .hm-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .hm-sec.is-mobile-swipe .hm-grid::-webkit-scrollbar { display: none; }
  .hm-sec.is-mobile-swipe .hm-grid > * {
    flex: 0 0 var(--hm-w-m, 190px);
    min-width: 0;
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hm-grid { scroll-behavior: auto !important; }
  .hm-card { transition: none !important; }
}

/* ---- Tinted category-style card (departments / categories / collections) ---- */
.hm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
  min-height: var(--hm-card-h, 352px);
  padding: 28px;
  overflow: hidden;
  border-radius: var(--r-card, 28px);
  text-decoration: none;
  transition: transform 0.2s ease;
}
.hm-card:hover { transform: translateY(-4px); }

.hm-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hm-card--img { color: var(--c-white); }
.hm-card--img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--c-ink) 70%, transparent), transparent 65%);
  pointer-events: none;
}

.hm-card__body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }

.hm-card__name {
  margin: 0;
  font-size: var(--fs-h3, 34px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.hm-card__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 16px/1.2 var(--f-body);
}

@media (max-width: 640px) {
  .hm-card { padding: 16px; min-height: min(var(--hm-card-h, 352px), 220px); }
  .cx-dg, .hm-sec.departments-grid { padding-top: 32px !important; padding-bottom: 40px !important; }
  .cx-fp, .hm-sec.featured-products { padding-bottom: 32px !important; }
  .hm-title { font-size: 28px; line-height: 1.15; }
  .hm-card__name { font-size: 20px; line-height: 1.2; }
  .hm-card__body { gap: 8px; }
  .hm-card__link { font-size: 13px; }
}
