/**
 * BK Slider - Creative Elements hero slider widget
 *
 * Defaults reproduce the BudsKing design. Every colour reads a theme token
 * (`--bk-*`) first and falls back to a hard-coded value, so the widget renders
 * the same outside BudsKing. Creative Elements controls override these rules
 * through `{{WRAPPER}}`-scoped selectors (higher specificity).
 *
 * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 */

/* ---- Wrapper (optional "boxed" section) -------------------------------- */
.bk-slider-wrap {
  box-sizing: border-box;
}

.bk-slider-wrap--boxed {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 0;
}

/* ---- Slider frame ------------------------------------------------------ */
.bk-slider {
  --bk-slider-speed: 400ms;
  /* Room an overlay arrow needs from the frame edge: 16px inset + 42px control
     (see `.bk-slider__arrow`), plus a small breathing gap. Used below the tablet
     breakpoint to keep the prev/next arrows clear of the text column. */
  --bk-slider-arrow-gutter: 62px;

  position: relative;
  box-sizing: border-box;
  height: clamp(320px, 33vw, 430px);
  overflow: hidden;
  border: 1px solid var(--bk-border, #eadfc3);
  border-radius: var(--bk-radius-xl, 20px);
  background: var(--bk-surface, #fffdf6);
  /* Horizontal gestures are handled by the script (swipe), vertical ones scroll the page. */
  touch-action: pan-y;
}

.bk-slider *,
.bk-slider *::before,
.bk-slider *::after {
  box-sizing: border-box;
}

/* ---- Slides ------------------------------------------------------------ */
.bk-slider__track {
  position: absolute;
  inset: 0;
}

.bk-slider__slide {
  position: absolute;
  inset: 0;
  z-index: 0;
  visibility: hidden;
  opacity: 0;
}

.bk-slider__slide.is-active {
  z-index: 1;
  visibility: visible;
  opacity: 1;
}

/* Fade: incoming slide fades in, outgoing one stays visible until the end. */
.bk-slider--fade .bk-slider__slide {
  transition: opacity var(--bk-slider-speed) ease, visibility 0s linear var(--bk-slider-speed);
}

.bk-slider--fade .bk-slider__slide.is-active {
  transition: opacity var(--bk-slider-speed) ease, visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
  .bk-slider--fade .bk-slider__slide,
  .bk-slider--fade .bk-slider__slide.is-active {
    transition: none;
  }
}

/* ---- Image slide ------------------------------------------------------- */
.bk-slider__link {
  position: absolute;
  inset: 0;
  display: block;
}

.bk-slider__link:focus-visible {
  outline: 3px solid var(--bk-gold, #cfa544);
  outline-offset: -3px;
}

.bk-slider__picture {
  display: block;
  width: 100%;
  height: 100%;
}

.bk-slider .bk-slider__img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ---- Text + visual slide ----------------------------------------------- */
.bk-slider__content {
  --bk-slider-col-min: 260px;

  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(var(--bk-slider-col-min), 100%), 1fr));
  align-items: center;
  background: linear-gradient(105deg, var(--bk-surface, #fffdf6) 0%, #faf3dd 60%, #f4e9c9 100%);
}

.bk-slider__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 0 clamp(24px, 5vw, 72px);
}

.bk-slider .bk-slider__pill {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: var(--bk-radius-pill, 99px);
  background: var(--bk-gold, #cfa544);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bk-slider .bk-slider__pill--outline {
  border-color: var(--bk-gold, #cfa544);
  background: rgba(207, 165, 68, 0.18);
  color: var(--bk-gold-light, #e8cd85);
}

.bk-slider .bk-slider__title {
  margin: 0;
  color: var(--bk-ink, #191712);
  font-family: var(--bk-font-serif, "Marcellus", serif);
  font-size: clamp(30px, 5.5vw, 54px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: normal;
  text-transform: none;
  text-wrap: balance;
}

.bk-slider .bk-slider__offer {
  margin: 0;
  color: var(--bk-ink, #191712);
  font-family: var(--bk-font-serif, "Marcellus", serif);
  font-size: clamp(44px, 8vw, 72px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: normal;
  text-wrap: balance;
}

.bk-slider .bk-slider__desc {
  max-width: 44ch;
  margin: 0;
  color: var(--bk-muted, #6f6852);
  font-size: 16px;
}

/* ---- Category links row ------------------------------------------------- */
.bk-slider__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bk-slider__links-item {
  display: inline-flex;
  align-items: center;
}

/* Separator between links (not inside the anchor, so it is neither clickable
   nor underlined). */
.bk-slider__links-item:not(:first-child)::before {
  content: "\00B7";
  margin: 0 0.55em;
  color: var(--bk-muted, #6f6852);
}

.bk-slider .bk-slider__link-item {
  color: var(--bk-gold, #cfa544);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.bk-slider .bk-slider__link-item:hover,
.bk-slider .bk-slider__link-item:focus-visible {
  color: var(--bk-gold-dark, #b8902f);
  text-decoration: underline;
}

.bk-slider .bk-slider__link-item:focus-visible {
  outline: 2px solid var(--bk-gold, #cfa544);
  outline-offset: 2px;
}

/* Dark scheme: links stay legible on the forest background. */
.bk-slider .bk-slider__content--dark .bk-slider__link-item {
  color: var(--bk-gold-light, #e8cd85);
}

.bk-slider .bk-slider__content--dark .bk-slider__link-item:hover,
.bk-slider .bk-slider__content--dark .bk-slider__link-item:focus-visible {
  color: var(--bk-gold, #cfa544);
}

.bk-slider .bk-slider__cta {
  display: inline-block;
  padding: 15px 28px;
  border-radius: var(--bk-radius-pill, 99px);
  background: var(--bk-teal, #2f9d8c);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bk-slider .bk-slider__cta:hover,
.bk-slider .bk-slider__cta:focus-visible {
  background: var(--bk-teal-hover, #257f71);
  color: #fff;
  text-decoration: none;
}

.bk-slider .bk-slider__cta:focus-visible {
  outline: 3px solid var(--bk-gold, #cfa544);
  outline-offset: 3px;
}

.bk-slider__visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  padding: 32px;
}

.bk-slider .bk-slider__visual-img {
  display: block;
  width: auto;
  max-width: 100%;
}

.bk-slider .bk-slider__visual--round .bk-slider__visual-img {
  height: 100%;
  max-height: 360px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 6px solid #fff;
  border-radius: 50%;
  box-shadow: 0 24px 60px rgba(25, 23, 18, 0.18);
}

.bk-slider .bk-slider__visual--free {
  padding: 0;
}

.bk-slider .bk-slider__visual--free .bk-slider__visual-img {
  height: 64%;
  opacity: 0.95;
  filter: drop-shadow(0 20px clamp(16px, 4vw, 40px) rgba(0, 0, 0, 0.35));
}

/* Dark scheme (e.g. referral banner): forest background, light text, gold CTA. */
.bk-slider__content--dark {
  background: linear-gradient(105deg, var(--bk-forest, #17332c) 0%, var(--bk-forest-2, #1e453b) 100%);
}

.bk-slider .bk-slider__content--dark .bk-slider__title {
  color: var(--bk-bg, #fdf9ee);
}

.bk-slider .bk-slider__content--dark .bk-slider__desc {
  color: var(--bk-forest-text, #b9cfc4);
}

.bk-slider .bk-slider__content--dark .bk-slider__cta {
  background: var(--bk-gold, #cfa544);
  color: var(--bk-ink, #191712);
}

.bk-slider .bk-slider__content--dark .bk-slider__cta:hover,
.bk-slider .bk-slider__content--dark .bk-slider__cta:focus-visible {
  background: var(--bk-gold-light, #e8cd85);
  color: var(--bk-ink, #191712);
}

/* ---- Arrows ------------------------------------------------------------ */
.bk-slider .bk-slider__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--bk-border, #eadfc3);
  border-radius: var(--bk-radius-pill, 99px);
  background: rgba(255, 253, 246, 0.9);
  color: var(--bk-ink, #191712);
  font-family: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bk-slider .bk-slider__arrow--prev {
  left: 16px;
}

.bk-slider .bk-slider__arrow--next {
  right: 16px;
}

.bk-slider .bk-slider__arrow:hover,
.bk-slider .bk-slider__arrow:focus-visible {
  border-color: var(--bk-gold, #cfa544);
  background: #fff;
  color: var(--bk-ink, #191712);
}

.bk-slider .bk-slider__arrow:focus-visible,
.bk-slider .bk-slider__dot:focus-visible {
  outline: 2px solid var(--bk-gold, #cfa544);
  outline-offset: 2px;
}

/* ---- Dots -------------------------------------------------------------- */
.bk-slider__dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 2;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.bk-slider .bk-slider__dot {
  display: block;
  width: 8px;
  height: 8px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--bk-radius-pill, 99px);
  background: rgba(25, 23, 18, 0.3);
  cursor: pointer;
  transition: all 0.25s;
}

.bk-slider .bk-slider__dot[aria-current="true"] {
  width: 22px;
  background: var(--bk-gold, #cfa544);
}

/* ---- Tablet + mobile: keep the overlay arrows clear of the text ---------- *
 * The prev/next arrows are absolutely positioned overlays (16px from each edge,
 * 42px wide), so they occupy the first/last ~58px of the frame whatever the
 * viewport width. On the "Text + visual" slide the text column starts from its
 * own horizontal padding; on desktop (>= 992px) that padding grows to 72px
 * (`clamp(24px, 5vw, 72px)`) and clears the arrows, but between ~750px and
 * ~990px (and when the slide stacks below 768px) it shrinks below the arrow
 * footprint and the prev arrow overlaps the offer / title / links.
 *
 * Below the lg breakpoint (991px) we reserve the arrow gutter on the text
 * column only (`--content` slide), so the arrows stay visible but never cover
 * the text. The rule is scoped to `.bk-slider__slide--content .bk-slider__text`
 * (higher specificity than the base/mobile `.bk-slider__text`), so it sets the
 * horizontal padding without disturbing the mobile block's vertical padding, and
 * `max(...)` keeps the roomier responsive padding when it is already wide enough.
 * The "Image" slide has no `.bk-slider__text`, so it is untouched, and desktop
 * (>= 992px) keeps its pixel-perfect 16px arrows and unchanged padding. */
@media (max-width: 991px) {
  .bk-slider__slide--content .bk-slider__text {
    padding-inline: max(var(--bk-slider-arrow-gutter, 62px), clamp(20px, 6vw, 32px));
  }
}

/* ---- Mobile: stack the "Text + visual" slide without cropping ----------- *
 * Below the Creative Elements "md" breakpoint (Configuration
 * `elementor_viewport_md`, 768px by default -> mobile is < 768px) the text
 * slide collapses to a single column and its content (pill + title + text +
 * CTA + visual) grows taller than the fixed hero height, so it was clipped by
 * `height: clamp(...)` + `overflow: hidden`.
 *
 * The slides are absolutely stacked (`inset: 0`) to cross-fade, so the frame
 * can't become content-driven on its own. On mobile we let the ACTIVE slide
 * rejoin the normal flow (`position: relative`) so it defines the height, while
 * the inactive ones stay absolutely stacked underneath for the fade. The frame
 * switches to `height: auto` + a `min-height` floor:
 *   - a "Text + visual" slide grows past the floor (no more cropping);
 *   - an "Image" slide keeps a controlled height (it falls back to the floor
 *     and covers it, no stretch).
 * Everything stays tokenised (`var(--bk-*, fallback)`) and widget-generic.
 * The merchant "Height" control still wins when a mobile value is set via the
 * device switcher (it then reintroduces a fixed height, so leave it empty to
 * keep this auto-fit). */
@media (max-width: 767px) {
  .bk-slider {
    height: auto;
    min-height: var(--bk-slider-mobile-min, clamp(320px, 33vw, 430px));
  }

  .bk-slider__track {
    position: relative;
    inset: auto;
  }

  /* The active slide drives the height; the others overlay it (hidden). */
  .bk-slider__slide.is-active {
    position: relative;
    inset: auto;
    min-height: var(--bk-slider-mobile-min, clamp(320px, 33vw, 430px));
  }

  /* Active "Text + visual" slide: inner wrapper rejoins the flow and the two
     columns stack (text, then visual). */
  .bk-slider__slide--content.is-active .bk-slider__content {
    position: relative;
    inset: auto;
    gap: var(--bk-slider-mobile-row-gap, clamp(20px, 6vw, 32px));
  }

  .bk-slider__text {
    padding: var(--bk-slider-mobile-text-pad, clamp(28px, 8vw, 44px) clamp(20px, 6vw, 32px));
  }

  .bk-slider .bk-slider__title {
    font-size: clamp(26px, 7.5vw, 40px);
  }

  .bk-slider__visual {
    height: auto;
    padding: 0 clamp(20px, 6vw, 32px) clamp(28px, 8vw, 44px);
  }

  .bk-slider .bk-slider__visual--round .bk-slider__visual-img {
    width: var(--bk-slider-mobile-visual, clamp(170px, 46vw, 240px));
    height: auto;
    max-height: none;
  }

  .bk-slider .bk-slider__visual--free .bk-slider__visual-img {
    width: auto;
    height: auto;
    max-height: var(--bk-slider-mobile-visual-free, clamp(120px, 40vw, 200px));
  }
}
