/* vtw-featured-products.css */
/* VendTheWeb Section Library — vendtheweb.com */
/* Version: 1.0.0 */

/* ── Variable resolution ─────────────────────────────── */
.vtw-featured-products {
  --_bg:           var(--vtw-section-bg,     var(--vtw-brand-bg,     #faf9f7));
  --_text:         var(--vtw-section-text,   var(--vtw-brand-text,   #1a1a1a));
  --_accent:       var(--vtw-section-accent, var(--vtw-brand-accent, #5c6b3a));
  --_accent-text:  var(--vtw-section-accent-text, var(--vtw-brand-accent-text, #ffffff));
  --_heading-font: var(--vtw-section-heading-font,
                   var(--vtw-brand-heading-font, Georgia, serif));
  --_body-font:    var(--vtw-section-body-font,
                   var(--vtw-brand-body-font, 'Assistant', Georgia, serif));
  --_heading-weight: var(--vtw-brand-heading-weight, 700);
  --_padding:      var(--vtw-section-padding,
                   var(--vtw-brand-section-padding, 60px));
  --_gap:          var(--vtw-brand-element-gap, 24px);
  --_radius:       var(--vtw-brand-radius-md, 8px);
  --_max-width:    var(--vtw-brand-container-width, 1280px);
  --_speed:        var(--vtw-brand-speed, 250ms);
  --_border:       var(--vtw-brand-border, #e8e3dc);
  --_surface:      var(--vtw-section-surface, var(--vtw-brand-surface, #f0ede8));
  --_text-muted:   var(--vtw-section-text-muted, var(--vtw-brand-text-muted, #6b675f));
  --_focus:        var(--vtw-section-focus, var(--vtw-brand-focus, var(--_accent)));
  --_heading-scale: var(--vtw-brand-heading-scale, 1);
  --_body-size:    var(--vtw-brand-body-size, 16px);
  --_body-line-height: var(--vtw-brand-body-line-height, 1.6);
  --_button-radius: var(--vtw-brand-button-radius, var(--_radius));
  --_button-border-width: var(--vtw-brand-button-border-width, 1px);
  --_focus-width:  var(--vtw-brand-focus-width, 2px);
  --_media-radius: var(--vtw-brand-media-radius, var(--_radius));
  --_ease:         cubic-bezier(0.25, 0.1, 0.25, 1);
  /* Small accent text stays AA on warm surfaces (learnings 2026-09, #51). */
  --_accent-ink:   color-mix(in srgb, var(--_accent) 82%, var(--_text));

  --_col-gap: 16px;
  --_row-gap: var(--_gap);
}

/* ── Base layout ─────────────────────────────────────── */
.vtw-featured-products {
  background-color: var(--_bg);
  color: var(--_text);
  padding-top: var(--_padding);
  padding-bottom: var(--_padding);
  font-family: var(--_body-font);
  font-size: var(--_body-size);
  line-height: var(--_body-line-height);
}

.vtw-featured-products .vtw-container {
  max-width: var(--_max-width);
  margin-inline: auto;
  padding-inline: clamp(24px, 4vw, 48px);
}

.vtw-featured-products[data-section-width="full"] .vtw-container {
  max-width: none;
  padding-inline: clamp(24px, 6vw, 80px);
}

.vtw-featured-products__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Header ──────────────────────────────────────────── */
.vtw-featured-products__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-items: last baseline;
  justify-content: space-between;
  column-gap: 24px;
  row-gap: 12px;
  margin-bottom: clamp(24px, 3vw, 40px);
}

.vtw-featured-products__titles {
  min-width: 0;
}

.vtw-featured-products__eyebrow {
  margin: 0 0 12px;
  font-family: var(--_body-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--_accent-ink);
}

.vtw-featured-products__heading {
  margin: 0;
  font-family: var(--_heading-font);
  font-size: calc(clamp(26px, 4vw, 44px) * var(--_heading-scale));
  font-weight: var(--_heading-weight);
  line-height: 1.12;
  color: var(--_text);
  text-wrap: balance;
}

.vtw-featured-products__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-block: 4px;
  font-family: var(--_body-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--_text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--_accent) 60%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color var(--_speed) ease, text-decoration-color var(--_speed) ease;
}

.vtw-featured-products__link:hover {
  color: var(--_accent-ink);
  text-decoration-color: currentColor;
}

.vtw-featured-products__arrow {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -2px;
  transition: transform var(--_speed) var(--_ease);
}

.vtw-featured-products__link:hover .vtw-featured-products__arrow,
.vtw-featured-products__promo-link:hover .vtw-featured-products__arrow {
  transform: translateX(4px);
}

.vtw-featured-products__link:focus-visible,
.vtw-featured-products__promo-link:focus-visible,
.vtw-featured-products__quick-add:focus-visible {
  outline: var(--_focus-width) solid var(--_focus);
  outline-offset: 4px;
  border-radius: 4px;
}

.vtw-featured-products__editor-note {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--_text-muted);
}

/* ── Footer link ─────────────────────────────────────── */
.vtw-featured-products__footer {
  display: flex;
  justify-content: center;
  margin-top: clamp(32px, 4vw, 48px);
}

/* ── Grid ────────────────────────────────────────────── */
.vtw-featured-products__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--_cols-mobile, 2), minmax(0, 1fr));
  column-gap: var(--_col-gap);
  row-gap: var(--_row-gap);
}

.vtw-featured-products__item {
  min-width: 0;
  display: flex;
}

/* ── Card ────────────────────────────────────────────── */
.vtw-featured-products__card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.vtw-featured-products__media {
  position: relative;
  aspect-ratio: var(--_ratio, 4 / 5);
  overflow: hidden;
  border-radius: var(--_media-radius);
  background: var(--_surface);
}

.vtw-featured-products__img,
.vtw-featured-products__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform calc(var(--_speed) * 3) var(--_ease), opacity calc(var(--_speed) * 2) ease;
}

.vtw-featured-products__placeholder {
  color: var(--_text-muted);
}

.vtw-featured-products[data-image-fit="contain"] .vtw-featured-products__img {
  box-sizing: border-box;
  padding: 8%;
  object-fit: contain;
}

.vtw-featured-products[data-image-fit="contain"][data-well="light"] .vtw-featured-products__img {
  mix-blend-mode: multiply;
}

.vtw-featured-products[data-card-style="framed"][data-image-fit="contain"] .vtw-featured-products__media {
  background: transparent;
}

.vtw-featured-products[data-card-style="framed"][data-image-fit="contain"] .vtw-featured-products__badge {
  background: var(--_bg);
}

.vtw-featured-products[data-ratio="natural"] .vtw-featured-products__media {
  aspect-ratio: auto;
}

.vtw-featured-products[data-ratio="natural"] .vtw-featured-products__img:not(.vtw-featured-products__img--second) {
  position: static;
  height: auto;
}

.vtw-featured-products[data-ratio="natural"] .vtw-featured-products__placeholder {
  position: static;
  aspect-ratio: 4 / 5;
}

.vtw-featured-products__img--second {
  opacity: 0;
}

@media (hover: hover) {
  .vtw-featured-products__card:hover .vtw-featured-products__img {
    transform: scale(1.035);
  }

  .vtw-featured-products__card:hover .vtw-featured-products__img--second {
    opacity: 1;
  }
}

.vtw-featured-products__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--_bg);
  color: var(--_text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vtw-featured-products__item[data-available="false"] .vtw-featured-products__img:not(.vtw-featured-products__img--second) {
  filter: saturate(0.6);
  opacity: 0.72;
}

.vtw-featured-products__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
}

.vtw-featured-products__vendor {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--_text-muted);
}

.vtw-featured-products__title {
  margin: 0;
  font-family: var(--_body-font);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--_text);
}

.vtw-featured-products__title-link {
  color: inherit;
  text-decoration: none;
}

/* The title link covers the whole card, so one tab stop opens the product. */
.vtw-featured-products__title-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--_media-radius);
}

.vtw-featured-products__title-link:focus-visible {
  outline: none;
}

.vtw-featured-products__title-link:focus-visible::after {
  outline: var(--_focus-width) solid var(--_focus);
  outline-offset: 4px;
}

@media (hover: hover) {
  .vtw-featured-products__card:hover .vtw-featured-products__title-link {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
  }
}

.vtw-featured-products__price {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--_text-muted);
  font-variant-numeric: lining-nums tabular-nums;
}

.vtw-featured-products__compare {
  margin-right: 8px;
  opacity: 0.8;
}

/* ── Rating ──────────────────────────────────────────── */
.vtw-featured-products__rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--_text-muted);
}

.vtw-featured-products__stars {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 16px;
  flex-shrink: 0;
}

.vtw-featured-products__stars svg {
  display: block;
  width: 80px;
  height: 16px;
}

.vtw-featured-products__stars-base {
  fill: color-mix(in srgb, var(--_text) 18%, transparent);
}

.vtw-featured-products__stars-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--_rating, 0%);
  overflow: hidden;
  fill: var(--_accent);
}

/* ── Swatches ────────────────────────────────────────── */
.vtw-featured-products__swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--_text-muted);
}

.vtw-featured-products__swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--_swatch, transparent) center / cover;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--_text) 20%, transparent);
}

/* ── Quick add ───────────────────────────────────────── */
.vtw-featured-products__actions {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 12px;
}

.vtw-featured-products__form {
  margin: 0;
}

.vtw-featured-products__quick-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 16px;
  border: var(--_button-border-width) solid color-mix(in srgb, var(--_accent) 35%, transparent);
  border-radius: var(--_button-radius);
  background: var(--_qa-bg, var(--_surface));
  color: var(--_text);
  font-family: var(--_body-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--_speed) ease, color var(--_speed) ease;
}

.vtw-featured-products__quick-add:hover,
.vtw-featured-products__quick-add[data-state="added"] {
  background: var(--_accent);
  color: var(--_accent-text);
}

.vtw-featured-products__quick-add[disabled] {
  cursor: progress;
  opacity: 0.7;
}

.vtw-featured-products__quick-status {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--_text-muted);
}

.vtw-featured-products__quick-status:empty {
  display: none;
}

/* ── Promo tile ──────────────────────────────────────── */
.vtw-featured-products__promo {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-height: 280px;
  overflow: hidden;
  padding: clamp(20px, 2.5vw, 32px);
  border-radius: calc(var(--_media-radius) + 4px);
  background: var(--_surface);
}

.vtw-featured-products__promo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vtw-featured-products__promo[data-promo-style="image"]::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgb(0 0 0 / 0.72) 0%, rgb(0 0 0 / 0.5) 45%, rgb(0 0 0 / 0.12) 80%, rgb(0 0 0 / 0) 100%);
}

.vtw-featured-products__promo-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.vtw-featured-products__promo[data-promo-style="surface"] .vtw-featured-products__promo-copy {
  flex: 1;
}

.vtw-featured-products__promo[data-promo-style="surface"] .vtw-featured-products__promo-eyebrow {
  margin-bottom: auto;
  padding-bottom: 24px;
}

.vtw-featured-products__promo[data-promo-style="surface"] .vtw-featured-products__promo-heading {
  font-size: calc(clamp(22px, 2.4vw, 30px) * var(--_heading-scale));
}

.vtw-featured-products__promo-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--_accent-ink);
}

.vtw-featured-products__promo-heading {
  margin: 0;
  font-family: var(--_heading-font);
  font-size: calc(clamp(20px, 2vw, 24px) * var(--_heading-scale));
  font-weight: var(--_heading-weight);
  line-height: 1.2;
  color: var(--_text);
  text-wrap: balance;
}

.vtw-featured-products__promo-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--_text-muted);
}

.vtw-featured-products__promo-link {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  padding-top: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--_accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.vtw-featured-products__promo[data-promo-style="image"] .vtw-featured-products__promo-eyebrow,
.vtw-featured-products__promo[data-promo-style="image"] .vtw-featured-products__promo-heading,
.vtw-featured-products__promo[data-promo-style="image"] .vtw-featured-products__promo-text,
.vtw-featured-products__promo[data-promo-style="image"] .vtw-featured-products__promo-link {
  color: #ffffff;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.35);
}

.vtw-featured-products__promo-link .vtw-featured-products__arrow {
  margin-left: 8px;
}

.vtw-featured-products__nowrap {
  white-space: nowrap;
}

/* ── Card styles ─────────────────────────────────────── */
.vtw-featured-products[data-card-style="framed"] {
  --_col-gap: 12px;
  --_row-gap: 12px;
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__card {
  padding: 12px 12px 16px;
  border-radius: calc(var(--_media-radius) + 6px);
  background: var(--_surface);
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__media {
  background: var(--_bg);
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__body {
  padding-inline: 4px;
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__title-link::after {
  border-radius: calc(var(--_media-radius) + 6px);
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__badge {
  background: var(--_surface);
}

.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__card {
  --_qa-bg: var(--_bg);
}

/* Muted text sits on the surface tile here, where the page-level muted token
   drops below 4.5:1. Pull it toward the text colour. */
.vtw-featured-products[data-card-style="framed"] .vtw-featured-products__card,
.vtw-featured-products__promo[data-promo-style="surface"] {
  --_text-muted: color-mix(in srgb, var(--vtw-section-text-muted, var(--vtw-brand-text-muted, #6b675f)) 72%, var(--_text));
}

.vtw-featured-products[data-card-style="centered"] .vtw-featured-products__body {
  align-items: center;
  text-align: center;
}

.vtw-featured-products[data-card-style="centered"] .vtw-featured-products__rating,
.vtw-featured-products[data-card-style="centered"] .vtw-featured-products__swatches {
  justify-content: center;
}

.vtw-featured-products[data-card-style="tall"] .vtw-featured-products__body {
  padding-top: 16px;
}

.vtw-featured-products[data-card-style="tall"] .vtw-featured-products__title {
  font-family: var(--_heading-font);
  font-size: 20px;
  font-weight: var(--_heading-weight);
  line-height: 1.25;
}

/* Centered style: a short last row sits centred under the centred header. */
@media (max-width: 767px) {
  .vtw-featured-products[data-card-style="centered"][data-mobile-layout="grid"][data-cols-mobile="2"] .vtw-featured-products__item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - var(--_col-gap) / 2);
  }
}

@media (min-width: 768px) {
  .vtw-featured-products[data-card-style="centered"] .vtw-featured-products__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .vtw-featured-products[data-card-style="centered"] .vtw-featured-products__item {
    flex: 0 0 calc((100% - (var(--_cols-tablet) - 1) * var(--_col-gap)) / var(--_cols-tablet));
  }

  /* One or two products: cap the card instead of stretching it across half the page. */
  .vtw-featured-products[data-sparse] .vtw-featured-products__list {
    grid-template-columns: repeat(var(--_cols), minmax(0, 420px));
  }

  .vtw-featured-products[data-sparse] .vtw-featured-products__item {
    max-width: 420px;
  }

  .vtw-featured-products[data-sparse][data-text-align="center"] .vtw-featured-products__list {
    justify-content: center;
  }
}

@media (min-width: 1024px) {
  .vtw-featured-products[data-card-style="centered"] .vtw-featured-products__item {
    flex-basis: calc((100% - (var(--_cols) - 1) * var(--_col-gap)) / var(--_cols));
  }
}

/* ── Header alignment ────────────────────────────────── */
@media (max-width: 767px) {
  .vtw-featured-products[data-text-align-mobile="center"] .vtw-featured-products__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (min-width: 768px) {
  .vtw-featured-products[data-text-align="center"] .vtw-featured-products__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .vtw-featured-products[data-text-align="center"] .vtw-featured-products__titles {
    max-width: 720px;
  }
}

/* ── Responsive ──────────────────────────────────────── */
/* Inline padding is handled by clamp() above — per css-standards.md Rule 6b. */
@media (max-width: 767px) {
  .vtw-featured-products[data-mobile-layout="swipe"] .vtw-featured-products__list {
    display: flex;
    gap: var(--_col-gap);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: calc(-1 * clamp(24px, 4vw, 48px));
    padding-inline: clamp(24px, 4vw, 48px);
    scroll-padding-inline: clamp(24px, 4vw, 48px);
  }

  .vtw-featured-products[data-mobile-layout="swipe"] .vtw-featured-products__list::-webkit-scrollbar {
    display: none;
  }

  .vtw-featured-products[data-mobile-layout="swipe"] .vtw-featured-products__item {
    flex: 0 0 44%;
    scroll-snap-align: start;
  }

  .vtw-featured-products[data-mobile-layout="swipe"][data-cols-mobile="1"] .vtw-featured-products__item {
    flex-basis: 80%;
  }

  .vtw-featured-products[data-mobile-layout="swipe"][data-section-width="full"] .vtw-featured-products__list {
    margin-inline: calc(-1 * clamp(24px, 6vw, 80px));
    padding-inline: clamp(24px, 6vw, 80px);
    scroll-padding-inline: clamp(24px, 6vw, 80px);
  }

  .vtw-featured-products__promo {
    min-height: 240px;
    padding: 16px;
  }

  .vtw-featured-products__promo-heading,
  .vtw-featured-products__promo[data-promo-style="surface"] .vtw-featured-products__promo-heading {
    font-size: calc(18px * var(--_heading-scale));
  }

  .vtw-featured-products__promo-text {
    font-size: 14px;
  }
}

@media (min-width: 768px) {
  .vtw-featured-products {
    --_col-gap: 20px;
    --_row-gap: 32px;
  }

  .vtw-featured-products[data-card-style="framed"] {
    --_col-gap: 16px;
    --_row-gap: 16px;
  }

  .vtw-featured-products__list {
    grid-template-columns: repeat(var(--_cols-tablet, 2), minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .vtw-featured-products {
    --_col-gap: var(--_gap);
    --_row-gap: 40px;
  }

  .vtw-featured-products[data-card-style="framed"] {
    --_col-gap: 20px;
    --_row-gap: 20px;
  }

  .vtw-featured-products__list {
    grid-template-columns: repeat(var(--_cols, 4), minmax(0, 1fr));
  }
}

/* ── Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .vtw-featured-products.vtw-animate-ready .vtw-featured-products__item {
    opacity: 0;
    transform: translateY(20px);
  }

  .vtw-featured-products.vtw-animate-ready.vtw-is-visible .vtw-featured-products__item {
    opacity: 1;
    transform: none;
    transition: opacity 600ms var(--_ease), transform 600ms var(--_ease);
    transition-delay: calc(var(--_i, 0) * 80ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vtw-featured-products * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
