/**
 * DJ Refresh — Series Slider.
 * Figma node 41:1148. Each slide spotlights a product series: oversized name + tagline +
 * description + CTA on the left, a full-bleed lifestyle image on the right, and a featured
 * product card floating over the image's lower-left. Vertical dots (left) + prev/next arrows
 * (top right). js/djr-series.js crossfades between slides.
 *
 * Layout: a natural-height two-column grid (copy | image), so the section is only as tall as
 * its content — no dead space above. Slides are grid-stacked (all in one cell) so the tallest
 * sets the height and they can crossfade. The product card anchors to the image wrapper so its
 * overhang stays put as the boxed page scales.
 */

.djr-series {
  background: var(--djr-white);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.djr-series__inner {
  position: relative;
  /* Full boxed width — the .djr-shell already caps the page at 1600. */
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------- Slide stage ---------- */

.djr-series__stage {
  display: grid; /* grid-stack: every slide shares cell 1/1 */
}

.djr-series__slide {
  grid-area: 1 / 1;
  display: grid;
  /* Proportional columns (copy 40% | image 47%) with the leftover ~13% pushed BETWEEN them —
     that middle gap is where the card's overhang lives. Fixed-px widths here (e.g. 543px copy,
     44vw image) left no gap below 1600 and the card collided with the copy. */
  grid-template-columns: minmax(0, 40%) minmax(0, 47%);
  justify-content: space-between;
  column-gap: 0;
  align-items: center;
  /* Even left/right gutters (the left was way over-indented); top stays tight and the bottom
     keeps a little extra room for the card's overhang before the next section. */
  padding: clamp(16px, 2vw, 32px) clamp(40px, 6vw, 100px) clamp(48px, 5vw, 76px);
  box-sizing: border-box;

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  pointer-events: none;
}

.djr-series__slide.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---------- Copy (left) ---------- */

.djr-series__copy {
  max-width: 543px;
}

.djr-series__name {
  font-size: clamp(44px, 5.2vw, 72px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--djr-ink);
}

.djr-series__tagline {
  margin-top: 18px;
  font-size: clamp(19px, 1.7vw, 24px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--djr-red);
}

.djr-series__desc {
  margin-top: 20px;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.5;
  /* --djr-body (readable), not --djr-muted, which is far too light on white. */
  color: var(--djr-body);
}

.djr-series__cta {
  margin-top: 28px;
}

/* ---------- Showcase: lifestyle image + floating card ----------
 * Figma: image w642 (right column). The card sticks ~16% of the image width out to the left
 * and hangs ~5% below the image bottom.
 */

.djr-series__showcase {
  position: relative;
  width: 100%; /* fills its 47% column */
}

.djr-series__media {
  width: 100%;
  aspect-ratio: 642 / 554;
  border-radius: 16px;
  overflow: hidden;
}

.djr-series__lifestyle {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.djr-series__card {
  position: absolute;
  z-index: 3;
  left: -16%;
  bottom: -10%;
  width: 44%;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* The plugin sheet underlines links inside content — the card must never inherit it. */
  text-decoration: none !important;
}

.djr-series__card-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 282 / 279;
  padding: 8px;
  border-radius: 8px;
  background: #e0e0e0;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(12, 16, 22, 0.22);
  transition: transform 0.2s ease;
}

.djr-series__card-image {
  max-width: 92%;
  max-height: 92%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.djr-series__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--djr-red);
  color: var(--djr-white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  transition: transform 0.2s ease;
}

.djr-series__badge-icon {
  width: 10px;
  height: 12px;
  fill: currentColor;
}

.djr-series__card-name {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--djr-ink);
  transition: transform 0.2s ease, color 0.2s ease;
}

/*
 * Hover: the whole card lifts as one unit. The badge and name sit OUTSIDE the media box (the
 * badge is absolutely positioned on the card, the name is below it), so each needs its own
 * lift or the box would slide up and leave them behind. The name also warms to red, matching
 * the other product cards.
 */
.djr-series__card:hover .djr-series__card-media,
.djr-series__card:hover .djr-series__badge,
.djr-series__card:hover .djr-series__card-name {
  transform: translateY(-3px);
}

.djr-series__card:hover .djr-series__card-name {
  color: var(--djr-red);
}

/* ---------- Vertical position dots ----------  Figma: x30, vertically centred. */

.djr-series__dots {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 51px;
  padding: 18px 0;
  border-radius: var(--djr-radius-pill);
  background: var(--djr-surface);
}

.djr-series__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #bdbdbd;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.djr-series__dot:hover {
  background: #8a8a8a;
}

.djr-series__dot.is-active {
  background: var(--djr-ink);
  transform: scale(1.2);
}

/* ---------- Prev / next ----------  Figma: top right. */

.djr-series__nav {
  position: absolute;
  top: clamp(28px, 3.5vw, 44px);
  right: clamp(40px, 5vw, 80px);
  z-index: 4;
  display: flex;
  gap: 12px;
}

.djr-series__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--djr-red);
  color: var(--djr-white);
  cursor: pointer;
  transition: background-color 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.djr-series__arrow svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.djr-series__arrow:hover:not(:disabled) {
  transform: scale(1.06);
}

.djr-series__arrow:disabled {
  background: transparent;
  color: var(--djr-ink);
  border: 1px solid var(--djr-line);
  opacity: 0.35;
  cursor: default;
}

/* ---------- Mobile (Figma: CDJ — Homepage Mobile 390, "Series Mobile — A REVISED") ----------
 * Full-bleed image (arrows floating over it) → copy → full-width CTA → full-width product
 * panel → horizontal dots. The image and card must interleave with the copy, so the showcase
 * wrapper is dissolved with display:contents and the three pieces are re-ordered.
 */
@media (max-width: 768px) {
  .djr-series__inner {
    display: flex;
    flex-direction: column;
    /* Cancel the shared .djr-container gutter so the image bleeds full-width; the copy and
       card re-apply their own 24px insets. */
    padding: 0 0 32px;
  }

  .djr-series__stage {
    order: 1;
  }

  .djr-series__slide {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }

  /* Dissolve the showcase so the image and card become siblings of the copy and can re-order. */
  .djr-series__showcase {
    display: contents;
  }

  /* 1 — full-bleed image */
  .djr-series__media {
    order: 1;
    width: 100%;
    aspect-ratio: 390 / 287;
    border-radius: 0;
  }

  /* 2 — copy: flattened too, so the card can slot between the text and the CTA. */
  .djr-series__copy {
    display: contents;
  }

  .djr-series__name {
    order: 2;
    margin: 26px 0 0;
    padding: 0 24px;
    font-size: clamp(38px, 12vw, 46px);
  }

  .djr-series__tagline {
    order: 3;
    padding: 0 24px;
  }

  .djr-series__desc {
    order: 4;
    padding: 0 24px;
  }

  /* 3 — full-width product panel, ABOVE the button */
  .djr-series__card {
    order: 5;
    /* relative (not static) so the absolutely-positioned TRENDING badge stays anchored to the
       card rather than escaping to the section. */
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    min-width: 0;
    margin: 24px 24px 0;
    gap: 14px;
  }

  /* 4 — CTA, now below the card. Stretches to full width via the slide's align-items:stretch. */
  .djr-series__cta {
    order: 6;
    margin: 24px 24px 0;
    display: flex;
    justify-content: center;
  }

  .djr-series__card-media {
    aspect-ratio: 342 / 279;
  }

  /* Arrows over the image top-right — outlined on the photo. */
  .djr-series__nav {
    top: 12px;
    right: 12px;
    z-index: 5;
  }

  .djr-series__arrow {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.85);
    color: var(--djr-white);
  }

  .djr-series__arrow:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    transform: none;
  }

  .djr-series__arrow:disabled {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.85);
    color: var(--djr-white);
    opacity: 0.35;
  }

  /* Dots — horizontal, centered, below the card. */
  .djr-series__dots {
    order: 2;
    position: static;
    left: auto;
    top: auto;
    transform: none;
    flex-direction: row;
    width: auto;
    padding: 0;
    margin: 26px auto 0;
    background: none;
  }
}
