/* ==========================================================================
   Brand Bytes project case study
   Loaded after home.css on body.bb-home.bb-case and reuses its tokens.
   ========================================================================== */

/* ---------- Hero ---------- */
.bb-case-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: calc(84px + clamp(40px, 6vw, 96px)) 0 clamp(48px, 6vw, 88px);
  background: var(--bb-ink-900);
  color: #fff;
}
.bb-case-hero__chrome {
  z-index: -1;
  top: -30%;
  right: -12%;
  width: clamp(360px, 52vw, 820px);
  opacity: 0.55;
  filter: grayscale(1) blur(clamp(18px, 2vw, 30px));
}
.bb-case-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  row-gap: clamp(40px, 6vw, 96px);
}
.bb-case-hero__title {
  grid-column: 1 / -1;
  max-width: 17em;
  margin: 0;
  font-family: 'Manrope', var(--bb-font-display);
  font-size: clamp(1.75rem, 3.6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  color: #fbfbfb;
}
.bb-case-hero__tags {
  grid-column: 2;
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: 'Manrope', var(--bb-font);
  font-size: clamp(0.75rem, 0.95vw, 0.875rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

/* Scroll-linked handoff from hero to showcase; --bb-hero-out and --bb-rise run 0 to 1 (case-study.js) */
@media (prefers-reduced-motion: no-preference) {
  .bb-case-hero__grid {
    opacity: calc(1 - var(--bb-hero-out, 0) * 0.75);
    transform: translate3d(0, calc(var(--bb-hero-out, 0) * -56px), 0);
  }
  /* Scales from its top edge, so the gap below the hero stays the same while it grows */
  .bb-case-rise {
    transform: scale(calc(0.9 + var(--bb-rise) * 0.1));
    transform-origin: 50% 0;
    will-change: transform;
  }
  .bb-js .bb-case-rise { --bb-rise: 0; }

  /* The card is on screen at load, so its contents play in on load rather than on scroll */
  .bb-case-in { animation: bb-case-in 900ms var(--bb-ease) var(--bb-delay, 0ms) both; }
  .bb-tes__art.bb-case-in { animation-name: bb-case-pop; }
}

@keyframes bb-case-in {
  from { opacity: 0; transform: translate3d(0, 2cqw, 0); }
}
@keyframes bb-case-pop {
  from { opacity: 0; transform: scale(0.82) rotate(-4deg); }
}

/* ---------- Screenshots ---------- */
/* Kept tight so the image is already on screen below the hero at load */
.bb-case-showcase {
  padding-top: clamp(28px, 4vw, 56px);
  padding-bottom: clamp(56px, 7vw, 104px);
}
.bb-case-shot {
  margin: 0;
  padding: clamp(8px, 1.1vw, 16px);
  overflow: hidden;
  border-radius: var(--bb-radius-lg);
  background: #fff;
  box-shadow: var(--bb-shadow-card);
}
.bb-case-shot--wide { padding: clamp(10px, 1.6vw, 24px); }
/* Full-bleed photo; the radius also trims the dark corners baked into the export */
.bb-case-shot--photo { padding: 0; background: var(--bb-ink-900); }
.bb-case-shot--photo img { display: block; width: 100%; height: auto; }
/* Exported screens already include their white card and rounded corners */
.bb-case-screen {
  display: block;
  width: 100%;
  max-width: 528px;
  height: auto;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.1));
}

/* ---------- TE Sports homepage mock ---------- */
/* Everything is sized in cqw so the mock scales like a single image */
.bb-case-mock { container-type: inline-size; }
.bb-tes {
  font-family: 'Manrope', var(--bb-font);
  color: #141414;
  user-select: none;
}
.bb-tes__links,
.bb-tes__icons,
.bb-tes__meta,
.bb-tes__count { margin: 0; padding: 0; list-style: none; }
.bb-tes__nav {
  display: flex;
  align-items: center;
  padding: 1.6cqw 8cqw 2cqw;
  border-bottom: 1px solid #ececec;
}
.bb-tes__logo { display: block; width: 14cqw; height: auto; }
.bb-tes__links {
  display: flex;
  gap: 4.6cqw;
  margin-left: 6cqw;
  font-size: 1.15cqw;
  font-weight: 500;
  color: #3a3a3a;
}
.bb-tes__links .is-active { font-weight: 700; color: #d71920; }
.bb-tes__icons { display: flex; gap: 1.8cqw; margin-left: auto; font-size: 1.7cqw; color: #d71920; }

.bb-tes__hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  margin: 0 4.4cqw;
  padding: 6.4cqw 9cqw 12cqw;
  overflow: hidden;
  border-radius: 0 0 2cqw 2cqw;
  background: #efeff1;
}
.bb-tes__hero::before {
  content: "";
  position: absolute;
  top: -11cqw;
  right: 5.4cqw;
  z-index: -1;
  width: 37cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e1e1e3;
}
.bb-tes__title {
  margin: 0;
  font-family: 'Manrope', var(--bb-font-display);
  font-size: 3.3cqw;
  font-weight: 800;
  line-height: 1.18;
  text-transform: uppercase;
}
.bb-tes__meta { display: grid; gap: 0.7cqw; margin: 1.6cqw 0; font-size: 1.1cqw; font-weight: 500; color: #555; }
.bb-tes__meta i { width: 1.6cqw; margin-right: 0.6cqw; color: #d71920; }
.bb-tes__count { display: flex; gap: 0.6cqw; }
.bb-tes__count li {
  display: grid;
  place-content: center;
  width: 4.9cqw;
  aspect-ratio: 1;
  border-radius: 0.3cqw;
  background: #1d1d1d;
  font-size: 0.7cqw;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.bb-tes__count b { font-size: 2cqw; font-weight: 700; color: #fff; }
.bb-tes__btn {
  display: inline-block;
  padding: 1.1cqw 2.6cqw;
  border-radius: 0.4cqw;
  background: #d71920;
  font-size: 0.95cqw;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
}
.bb-tes__copy .bb-tes__btn { margin-top: 2.4cqw; }
.bb-tes__art img { display: block; width: 100%; max-width: 31cqw; height: auto; margin-inline: auto; }
.bb-tes__arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 2.6cqw;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  font-size: 0.9cqw;
  color: #9a9a9a;
  transform: translateY(-50%);
}
.bb-tes__arrow--prev { left: 2cqw; }
.bb-tes__arrow--next { right: 2cqw; }
.bb-tes__dots { position: absolute; bottom: 7.6cqw; left: 50%; display: flex; gap: 0.5cqw; transform: translateX(-50%); }
.bb-tes__dots i { width: 0.6cqw; height: 0.6cqw; border-radius: 1cqw; background: #cfcfd2; }
.bb-tes__dots i:first-child { width: 2cqw; background: #d71920; }
.bb-tes__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.4cqw;
  margin: -6.4cqw 15cqw 2.4cqw;
  padding: 2cqw 3.2cqw;
  border-radius: 0.8cqw;
  background: #1d1d1d;
  color: #fff;
}
.bb-tes__bar p { flex: 1; margin: 0; font-size: 1.2cqw; font-weight: 500; line-height: 1.45; }
.bb-tes__bar b { font-weight: 700; }
.bb-tes__bar .bb-tes__btn { padding-inline: 3cqw; }

/* ---------- Heading + copy blocks ---------- */
/* Visible overflow: a clipping ancestor would stop the heading from pinning */
.bb-case-block { overflow: visible; }
.bb-case-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(32px, 6vw, 96px);
}
.bb-case__title {
  position: sticky;
  top: 96px;
  font-family: 'Manrope', var(--bb-font-display);
  font-weight: 800;
}
.bb-case__text p {
  max-width: 640px;
  margin: 0;
  font-family: 'Manrope', var(--bb-font);
  font-size: clamp(0.9375rem, 1.1vw, 1.0625rem);
  font-weight: 500;
  line-height: 1.75;
  color: #1e1f21;
}
.bb-case__text p + p { margin-top: 1.25em; }

.bb-case-shots {
  display: grid;
  gap: clamp(14px, 1.6vw, 24px);
  margin: clamp(28px, 3.4vw, 48px) 0 0;
  padding: 0;
  list-style: none;
}

.bb-case-link {
  --bb-bracket: 9px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-top: clamp(24px, 3vw, 40px);
  padding: 8px 14px;
  font-family: 'Manrope', var(--bb-font);
  font-size: clamp(0.8125rem, 1vw, 0.9375rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bb-text);
  background:
    linear-gradient(currentColor, currentColor) left top / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right top / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) left top / var(--bb-bracket) 1px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / var(--bb-bracket) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right top / var(--bb-bracket) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / var(--bb-bracket) 1px no-repeat;
  transition: background-size 300ms var(--bb-ease);
}
.bb-case-link:hover {
  color: var(--bb-text);
  text-decoration: none;
  background-size: 1px 100%, 1px 100%, 51% 1px, 51% 1px, 51% 1px, 51% 1px;
}
.bb-case-link i { font-size: 0.8125rem; transform: rotate(45deg); transition: transform var(--bb-dur) var(--bb-ease); }
.bb-case-link:hover i { transform: rotate(45deg) translateY(-2px); }

/* ---------- Responsive ---------- */
@media (max-width: 767.98px) {
  .bb-case-hero__grid { grid-template-columns: minmax(0, 1fr); row-gap: 32px; }
  .bb-case-hero__tags { grid-column: 1; text-align: left; }
  .bb-case-hero__chrome { top: -10%; right: -40%; width: 120vw; }

  .bb-case-split { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .bb-case__title { position: static; }
}
