/* Case Study — template 2 (from "Case Study Info 4.pdf", 1920px design).
   The hero is a fixed composition: every size/position below is the design value in px at
   1920px wide, scaled with the container width (--p = 1 design px). Below 1024px it stacks. */

.cst2-hero {
  container-type: inline-size;
  position: relative;
  width: 100%;
  background: var(--black, #1b1b1e);
  overflow: hidden;
}

.cst2-stage {
  --p: calc(100cqw / 1920);
  position: relative;
  height: calc(var(--p) * 888);
}

/* ---------- quote ---------- */
.cst2-quote__mark,
.cst2-quote__text {
  position: absolute;
  margin: 0;
  font-family: 'Cal Sans', sans-serif;
  font-weight: normal;
}

.cst2-quote__mark {
  font-size: calc(var(--p) * 103);
  line-height: 1;
  color: var(--cream-light, #f9f6e8);
}

.cst2-quote__mark--open { left: calc(var(--p) * 49); top: calc(var(--p) * 147); }
.cst2-quote__mark--close { left: calc(var(--p) * 457); top: calc(var(--p) * 258.5); }

.cst2-quote__text {
  left: calc(var(--p) * 101);
  top: calc(var(--p) * 178.5);
  font-size: calc(var(--p) * 46.5);
  line-height: calc(var(--p) * 52);
  white-space: nowrap;
  background: linear-gradient(90deg, #9ccb5f 0%, var(--blue, #0337bc) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding-right: 0.1em;
}

/* ---------- challenge / solution ---------- */
.cst2-block {
  position: absolute;
  left: calc(var(--p) * 47);
}

.cst2-block--challenge { top: calc(var(--p) * 337); left: calc(var(--p) * 49); width: calc(var(--p) * 560); }
.cst2-block--solution { top: calc(var(--p) * 590); left: calc(var(--p) * 45); width: calc(var(--p) * 600); }

.cst2-block__title {
  margin: 0 0 calc(var(--p) * 15);
  font-family: 'Cal Sans', sans-serif;
  font-size: calc(var(--p) * 28.9);
  line-height: calc(var(--p) * 44);
  font-weight: normal;
  color: var(--green-bright, #b8ff47);
}

.cst2-block__text {
  margin: 0;
  font-family: 'Helvetica', 'HelveticaL', sans-serif;
  font-size: calc(var(--p) * 17);
  line-height: calc(var(--p) * 23.2);
  color: var(--cream-light, #f9f6e8);
}

/* ---------- centre: brand + model ---------- */
.cst2-brand {
  position: absolute;
  left: calc(var(--p) * 748);
  top: calc(var(--p) * 132);
  width: calc(var(--p) * 426);
  text-align: center;
}

.cst2-brand__logo {
  display: block;
  width: calc(var(--p) * 424);
  height: auto;
}

.cst2-title {
  margin: calc(var(--p) * 1) 0 0 calc(var(--p) * -3);
  font-family: 'Cal Sans', sans-serif;
  font-size: calc(var(--p) * 64.2);
  line-height: calc(var(--p) * 74);
  font-weight: normal;
  white-space: nowrap;
  color: var(--cream-light, #f9f6e8);
}

.cst2-title span { color: var(--green-bright, #b8ff47); }

.cst2-model {
  position: absolute;
  left: calc(var(--p) * 560);
  top: calc(var(--p) * 300);
  width: calc(var(--p) * 713);
  height: auto;
  display: block;
}

/* ---------- stats ---------- */
.cst2-stats { display: contents; }

.cst2-stat {
  position: absolute;
  left: calc(var(--p) * (var(--cx) - 150));
  top: calc(var(--p) * var(--top));
  width: calc(var(--p) * 300);
  text-align: center;
}

.cst2-stat__num {
  font-family: 'Cal Sans', sans-serif;
  font-size: calc(var(--p) * 62.1);
  line-height: calc(var(--p) * 85);
  font-weight: normal;
  letter-spacing: 0;
  display: inline-block;
  position: relative;
  top: calc(var(--p) * 5.5);
  background: linear-gradient(90deg, var(--green, #acdb55) 0%, var(--blue, #0337bc) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  padding: 0 0.04em;
}

.cst2-stat__label {
  margin-top: calc(var(--p) * 2);
  font-family: 'Helvetica', 'HelveticaL', sans-serif;
  font-size: calc(var(--p) * 23.4);
  line-height: calc(var(--p) * 28);
  color: var(--cream-light, #f9f6e8);
}

/* ---------- image strip ---------- */
.cst2-strip {
  width: 100%;
  background: var(--black, #1b1b1e);
  container-type: inline-size;
}

.cst2-strip__row {
  --p: calc(100cqw / 1920);
  display: flex;
  justify-content: space-between;
  gap: calc(var(--p) * 17);
  padding: 0 calc(var(--p) * 46);
}

.cst2-strip__item {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 291 / 202;
  border-radius: calc(var(--p) * 16);
  overflow: hidden;
}

.cst2-strip__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- showreel (reuses .csd-showreel markup + modal) ---------- */
.cst2-showreel.csd-showreel {
  max-width: 1700px;
  width: calc(100% - 2 * clamp(20px, 5.73vw, 110px));
  margin: clamp(36px, 4.17vw, 80px) auto clamp(40px, 4.5vw, 87px);
  padding: 4px;
  background: linear-gradient(90deg, var(--blue, #0337bc) 0%, var(--green, #acdb55) 100%);
}

.cst2-showreel .csd-showreel__media {
  position: relative;
  height: auto;
  aspect-ratio: 1692 / 570;
  overflow: hidden;
}

.cst2-showreel .csd-showreel__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cst2-showreel .csd-showreel__title {
  font-size: clamp(30px, 4.1vw, 78.8px);
  color: #addc55;
}

.cst2-showreel .csd-showreel__play-btn {
  width: clamp(44px, 3.4vw, 66px);
}

/* hard line breaks follow the design on desktop only */
.cst2-block__text { white-space: nowrap; }

/* ---------- tablet / mobile: stack ---------- */
@media (max-width: 1023px) {
  .cst2-hero {
    padding: 110px 24px 28px;
  }

  .cst2-stage {
    --p: 1px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }

  .cst2-stage > * {
    position: static !important;
    width: 100% !important;
    max-width: 640px;
  }

  .cst2-brand { order: 1; text-align: center; }
  .cst2-brand__logo { width: min(320px, 70vw); margin: 0 auto; }
  .cst2-title { font-size: clamp(36px, 9vw, 56px); line-height: 1.1; margin-top: 8px; }
  .cst2-model { order: 2; width: min(520px, 100%) !important; margin: 0 auto; }

  .cst2-quote { order: 3; position: relative !important; display: block; text-align: center; }
  .cst2-quote__mark,
  .cst2-quote__text { position: static; display: inline; }
  .cst2-quote__mark { font-size: 48px; line-height: 0; vertical-align: -0.2em; }
  .cst2-quote__text { font-size: clamp(26px, 6.4vw, 40px); line-height: 1.15; white-space: normal; }

  .cst2-stats { order: 4; display: grid; grid-template-columns: 1fr 1fr; gap: 24px 12px; }
  .cst2-stat { position: static !important; width: auto !important; }
  .cst2-stat__num { font-size: clamp(36px, 9vw, 54px); line-height: 1.2; }
  .cst2-stat__label { font-size: 16px; line-height: 1.3; margin-top: 2px; }

  .cst2-block { order: 5; }
  .cst2-block--solution { order: 6; }
  .cst2-block__title { font-size: 28px; line-height: 1.2; margin-bottom: 10px; }
  .cst2-block__text { font-size: 16px; line-height: 1.55; white-space: normal; }
  .cst2-br { display: none; }

  /* strip becomes a swipe slider (scroll-snap) with dots */
  .cst2-strip { padding: 0 0 4px; }
  .cst2-strip__row {
    --p: 1px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 0 24px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 24px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cst2-strip__row::-webkit-scrollbar { display: none; }
  .cst2-strip__item {
    flex: 0 0 78%;
    border-radius: 12px;
    scroll-snap-align: start;
  }
}

@media (min-width: 600px) and (max-width: 1023px) {
  .cst2-strip__item { flex: 0 0 44%; }
}

/* slider dots (built by case-study-t2.js, only shown on tablet / mobile) */
.cst2-strip__dots { display: none; }

@media (max-width: 1023px) {
  .cst2-strip__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 14px 0 0;
  }
  .cst2-strip__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(249, 246, 232, 0.3);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
  }
  .cst2-strip__dot.is-active {
    background: var(--green, #acdb55);
    transform: scale(1.25);
  }
}

/* Quote roll-in (assets/js/case-study-t2.js): hidden until the letters are built; each
   letter slides down inside its own slot and carries its slice of the gradient */
.cst2-quote__text:not(.is-ready) { visibility: hidden; }
.cst2-quote__text.is-ready {
  background: none;
  -webkit-text-fill-color: initial;
  color: inherit;
}
.cst2-quote__word { display: inline-block; white-space: nowrap; }
.cst2-quote__slot {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.cst2-quote__ghost { visibility: hidden; }
.cst2-quote__letter {
  position: absolute;
  left: 0;
  top: 0;
  background-image: linear-gradient(90deg, #9ccb5f 0%, var(--blue, #0337bc) 100%);
  background-repeat: no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  will-change: transform;
}
.elementor-editor-active .cst2-quote__text { visibility: visible; }

/* ===================================================================================
   Template 2 for every case study (.cst2-hero--flow = content converted from Template 1).
   Same composition as case-study-template-2.html: every element keeps the design's own
   position/size above (1920 design px via --p, stage 888 high). Only what the content
   needs changes: text wraps inside the design widths, the quote's closing mark follows
   its last word, stats sit on the design's zig-zag spots (set inline by the widget), and
   the centre image stands on the bottom edge like the OPPO model. case-study-t2.js only
   pushes a block down if a longer text would otherwise run into the next one.
   =================================================================================== */
@media (min-width: 1024px) {
  /* quote: text starts at the design's spot (101, 178.5); open mark 52 left / 31.5 up */
  .cst2-hero--flow .cst2-quote {
    position: absolute;
    left: calc(var(--p) * 101);
    top: calc(var(--p) * 178.5);
    width: calc(var(--p) * 470);
    z-index: 2;
  }
  .cst2-hero--flow .cst2-quote__text {
    position: static;
    display: inline;
    white-space: normal;
  }
  .cst2-hero--flow .cst2-quote__mark--open { left: calc(var(--p) * -52); top: calc(var(--p) * -31.5); }
  .cst2-hero--flow .cst2-quote__mark--close {
    position: static;
    display: inline-block;
    line-height: 0;
    vertical-align: -0.45em;
    margin-left: calc(var(--p) * 6);
  }

  /* challenge / solution: design spots and widths, text wraps naturally */
  .cst2-hero--flow .cst2-block { z-index: 2; }
  .cst2-hero--flow .cst2-block__text { white-space: normal; }
  .cst2-hero--flow .cst2-br { display: none; }

  /* brand: logo at the design height (OPPO logo 424×66), title on one line below it —
     a longer title may use a little more width than the logo, centred on it */
  .cst2-hero--flow .cst2-brand { z-index: 2; display: flex; flex-direction: column; align-items: center; }
  .cst2-hero--flow .cst2-title {
    width: calc(var(--p) * 640);
    margin: calc(var(--p) * 1) 0 0;
    text-align: center;
  }
  .cst2-hero--flow .cst2-title__main { display: block; white-space: nowrap; }

  /* centre image: the design's 713×588 box (left 560, bottom of the stage);
     a cut-out stands on the bottom edge, a normal photo sits in a rounded frame */
  .cst2-hero--flow .cst2-model {
    top: auto;
    bottom: 0;
    left: calc(var(--p) * 560);
    width: calc(var(--p) * 713);
    height: calc(var(--p) * 588);
    object-fit: contain;
    object-position: center bottom;
    z-index: 1;
  }
  .cst2-hero--flow:not(.cst2-hero--cutout) .cst2-model {
    left: calc(var(--p) * 616);
    bottom: calc(var(--p) * 40);
    width: calc(var(--p) * 600);
    height: calc(var(--p) * 410);
    object-fit: cover;
    border-radius: calc(var(--p) * 16);
  }

  .cst2-hero--flow .cst2-stat { z-index: 2; }
}

/* brand logo: every logo at the OPPO logo's height (wide ones capped in width); dark logos
   keep a white chip inside that height; a brand with no logo file shows its name */
.cst2-hero--flow .cst2-brand__logo {
  width: auto;
  height: calc(var(--p) * 66);
  max-width: calc(var(--p) * 300);
  object-fit: contain;
  box-sizing: border-box;
}
.cst2-brand__logo--chip {
  background: #fff;
  padding: calc(var(--p) * 8) calc(var(--p) * 16);
  border-radius: calc(var(--p) * 10);
}
.cst2-brand__name {
  font-family: 'Cal Sans', sans-serif;
  font-size: calc(var(--p) * 56);
  line-height: calc(var(--p) * 66);
  color: var(--cream-light, #f9f6e8);
}

/* title: main text cream, the subtitle (e.g. "Influencer Marketing") a small green line */
.cst2-title .cst2-title__main { color: var(--cream-light, #f9f6e8); }
.cst2-hero--flow .cst2-title .cst2-title__accent {
  display: block;
  margin-top: calc(var(--p) * 4);
  font-size: calc(var(--p) * 24);
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.cst2-title .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* strip with fewer than 6 images: the design's thumbnail size, centred */
@media (min-width: 1024px) {
  .cst2-strip--few .cst2-strip__row { justify-content: center; }
  .cst2-strip--few .cst2-strip__item { flex: 0 0 calc((100% - var(--p) * 177) / 6); }
}

/* tablet / mobile: stacks exactly like case-study-template-2 (rules above) */
@media (max-width: 1023px) {
  .cst2-hero--flow .cst2-brand__logo { height: 52px; max-width: min(240px, 70vw); }
  .cst2-brand__logo--chip { padding: 6px 12px; border-radius: 8px; }
  .cst2-brand__name { font-size: 40px; line-height: 52px; }
  .cst2-hero--flow .cst2-title__main { white-space: nowrap; }
  .cst2-hero--flow .cst2-title .cst2-title__accent { font-size: 15px; margin-top: 6px; }
  .cst2-hero--flow:not(.cst2-hero--cutout) .cst2-model { border-radius: 12px; }
}

/* stats: same centre points as the design; a long label wraps inside 240 design px (the
   design's labels are short) so neighbouring stats never touch or leave the screen */
@media (min-width: 1024px) {
  .cst2-hero--flow .cst2-stat {
    left: calc(var(--p) * (var(--cx) - 120));
    width: calc(var(--p) * 240);
  }
}

/* showreel on tablet / mobile: the desktop strip shape (1692×570) is too flat on narrow
   screens, so it gets taller proportions with the title and play button sized to fit */
@media (max-width: 1023px) {
  .cst2-showreel.csd-showreel {
    width: calc(100% - 48px);
    margin: 32px auto 44px;
    padding: 3px;
  }
  .cst2-showreel .csd-showreel__media { aspect-ratio: 16 / 9; height: auto !important; }
  .cst2-showreel .csd-showreel__content { gap: 16px !important; padding: 0 20px; }
  .cst2-showreel .csd-showreel__title { font-size: clamp(28px, 5.6vw, 44px); line-height: 1.1; }
  .cst2-showreel .csd-showreel__play-btn { width: 58px !important; }
}
@media (max-width: 767px) {
  .cst2-showreel.csd-showreel { width: calc(100% - 32px); margin: 24px auto 36px; }
  .cst2-showreel .csd-showreel__media { aspect-ratio: 4 / 3; }
  .cst2-showreel .csd-showreel__content { gap: 12px !important; }
  .cst2-showreel .csd-showreel__title { font-size: clamp(24px, 7.4vw, 32px); }
  .cst2-showreel .csd-showreel__play-btn { width: 48px !important; }
}

/* laptop tiers in style.css force .csd-showreel to a fixed height + 16px padding (the
   Template 1 showreel); Template 2 keeps its own shape and thin gradient border */
@media (min-width: 1024px) {
  .cst2-showreel.csd-showreel { padding: 4px !important; }
  .cst2-showreel .csd-showreel__media { height: auto !important; }
}

/* mobile phones: the strip slider is swiped without pagination dots (tablet keeps them) */
@media (max-width: 767px) {
  .cst2-strip__dots { display: none !important; }
}

/* cut-out size: the design's 713×588 box scaled per image (--ms, set by the widget from
   cutout/scales.json), still centred on the design's model spot and standing on the bottom */
@media (min-width: 1024px) {
  .cst2-hero--cutout .cst2-model {
    width: calc(var(--p) * 713 * var(--ms, 1));
    height: calc(var(--p) * 588 * var(--ms, 1));
    left: calc(var(--p) * (var(--mcx, 916.5) - 356.5 * var(--ms, 1)));
  }
}
