/* ============================================================
   Music Discovery case study — page-specific styles.
   The page used to be one long baked image (md-full.*) with absolutely
   positioned overlays; it is now flowing HTML built on the shared case-page
   classes (case-hero / case-meta / case-section / other-projects / ending).
   All spacing comes from the tokens in styles.css :root.
   ============================================================ */

/* ---------- Hero: two campaign banners under the title ---------- */
.md-banners {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 1152px;
  margin: var(--gap-block) auto 0;
  padding: 0 var(--space-page);
  box-sizing: content-box;
}
.md-banners img { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }

/* ---------- Meta: two "about" paragraphs + stat pills ---------- */
.case-meta__about + .case-meta__about { margin-top: 12px; }
.md-pills {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.md-pills li {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: #d2d2d2;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 500;
}

/* ---------- Full map: timeline + 4 phones ----------
   Each step draws its own slice of the timeline (left/right halves), so the
   line stays continuous in the 4-column grid and in the phone scroller. */
.md-map {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 1180px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.md-map__step { position: relative; text-align: center; padding-top: 30px; display: flex; flex-direction: column; }
.md-map__step::before {                 /* timeline slice */
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.42);
}
.md-map__step:first-child::before { left: 50%; }
.md-map__step:last-child::before  { right: 50%; }
.md-map__step::after {                  /* dot */
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: #e2e2e2;
}
.md-map__kick {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 8px;
  line-height: 1.4;
}
.md-map__lbl {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lead);
  line-height: 1.3;
  color: #fff;
  margin: auto 0 24px;   /* label + phone sit at the bottom, so phones line up when labels wrap */
}
.md-map__phone {
  display: block;
  width: 76%;
  aspect-ratio: 720 / 1454;          /* source videos include the phone frame */
  margin: 0 auto;
  object-fit: fill;
  background: transparent;
}

/* ---------- Basic experience: full-bleed blue concert photo ---------- */
.md-basic {
  background: #020a8a url("assets/sabrina-bg.webp") left center / cover no-repeat;
}
.md-basic__inner {
  max-width: var(--max-content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--gap-block);
}
.md-basic__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #fff;
  margin: 0 0 var(--gap-title);
  max-width: 14em;
}
.md-basic__sub {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: #d8e0f2;
  margin: 0;
  font-weight: 400;
}
.md-dsps {
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 78px);
  column-gap: 80px;
  row-gap: 40px;
}
.md-dsps img {
  display: block;
  width: 100%;
  height: auto;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 22.37%;
}
.md-stats { display: flex; gap: 80px; margin-top: var(--gap-block); }
.md-stats__num { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-stat); line-height: 1; color: #fff; margin: 0; letter-spacing: -0.02em; }
.md-stats__lbl { font-family: var(--font-display); font-size: var(--fs-small); letter-spacing: 0.02em; color: #d8e0f2; margin: 8px 0 0; font-weight: 400; line-height: 1.5; }

/* Phone mock: 368×773 bezel, 4px white @30% stroke, 52px corners; video 348×753, 46px corners.
   Radii are % so the mock scales down cleanly on smaller screens. */
.md-phone {
  position: relative;
  width: 368px;
  aspect-ratio: 368 / 773;
  box-sizing: border-box;
  padding: 6px;
  border: 4px solid rgba(255, 255, 255, 0.30);
  border-radius: 14.13% / 6.727%;
}
.md-phone__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: 13.22% / 6.109%;
  background: #000;
}
.md-phone__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  line-height: 0;
  cursor: pointer;
}
.md-phone__play img { width: 100%; height: 100%; display: block; }

/* ---------- Building ecosystem: diagram in a framed card ---------- */
.md-card {
  max-width: 1152px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 42px 60px;
  border: var(--cover-stroke-w) solid var(--cover-stroke);
  border-radius: var(--radius-lg);
}
.md-card img { display: block; width: 100%; height: auto; }
.md-ds { width: 100%; height: auto; }

/* Diagrams are dense — on touch-size screens, say they can be enlarged. */
.md-zoom-hint {
  display: none;
  margin: 12px 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.02em;
  color: #8d8d8d;
  font-weight: 500;
  line-height: 1.4;
}
.case-section--light .md-zoom-hint { color: #777; }

/* ---------- Guided tour (pan/zoom over the journey map) ---------- */
.mv-journey { display: block; margin: 0 auto; }
.mv-journey * { box-sizing: border-box; }
.mv-frame {
  position: relative; width: 100%; max-width: 1100px; aspect-ratio: 16 / 10; margin: 0 auto;
  border: var(--cover-stroke-w) solid var(--cover-stroke); border-radius: var(--radius-md); overflow: hidden; background: #0a0a0c;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85);
}
.mv-img { position: absolute; top: 0; left: 0; display: block; max-width: none; transform-origin: 0 0; will-change: transform, width; }
.mv-scrim {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 48%; pointer-events: none;
  background: linear-gradient(to top, rgba(6, 6, 9, .9) 0%, rgba(6, 6, 9, .4) 55%, transparent 100%);
}
.mv-cap {
  position: absolute; left: clamp(20px, 5%, 52px); right: 48px; bottom: clamp(24px, 7%, 46px); max-width: 560px;
  opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease;
  font-family: var(--font-display); color: #e8e8ea;
}
.mv-cap.is-active { opacity: 1; transform: translateY(0); }
.mv-cap h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; line-height: 1.25; }
.mv-cap p { font-size: var(--fs-body); line-height: 1.6; color: #c6c6cc; margin: 0; font-weight: 400; }
.mv-dots {
  position: absolute; right: clamp(12px, 2.2%, 24px); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.mv-dots i { width: 6px; height: 6px; border-radius: 50%; background: #3a3a42; transition: all .4s ease; }
.mv-dots i.is-on { background: #E8FF3A; transform: scale(1.5); }
.mv-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: #E8FF3A; width: 0; box-shadow: 0 0 10px rgba(232, 255, 58, .6); }
.mv-fallback { display: none; max-width: 760px; margin: 0 auto; font-family: var(--font-display); }
.mv-fallback img { width: 100%; border-radius: var(--radius-md); display: block; margin-bottom: 28px; }
.mv-fallback .mv-row { margin-bottom: 18px; }
.mv-fallback h3 { font-size: 18px; margin: 0 0 3px; }
.mv-fallback p { color: #b8b8bf; line-height: 1.55; margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .mv-journey .mv-frame { display: none; }
  .mv-journey .mv-fallback { display: block; }
}

/* ---------- Strategy rows + Apple Music: labelled phone screens ---------- */
.md-strats { margin-top: calc(var(--gap-block) + 10px); display: flex; flex-direction: column; gap: calc(var(--gap-block) + 10px); }   /* +10 on every screen (Ivy) */
.md-strats__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 990px;
  margin: 0 auto;
  width: 100%;
}
.md-strats__row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1160px; }
.md-shot { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }   /* phones line up even when a caption wraps */
.md-shot figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lead);       /* labels above phones, not card titles → Lead 600 */
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: #fff;
  text-align: center;
}
.md-shot__emoji { font-size: 26px; line-height: 1; }
.md-shot img { display: block; width: min(240px, 100%); height: auto; }
/* TikTok × Apple Music row: labels sit under the phones (Ivy) */
.md-strats__row--4 .md-shot { flex-direction: column-reverse; justify-content: flex-end; }
.md-strats__row--4 .md-shot figcaption { margin: 20px 0 0; }

/* ---------- "6 BILLION+" recap: full-bleed green band ---------- */
.md-recap { background: #063827; }
/* The green band is its own block: same gap above it as below it (into Other Projects). */
.case-section:has(+ .md-recap) { padding-bottom: var(--gap-section); }
.md-recap img { display: block; width: 100%; max-width: 1280px; height: auto; margin: 0 auto; }

/* ============================================================
   Tablet
   ============================================================ */
@media (max-width: 900px) {
  .md-map__lbl  { margin-bottom: 16px; }
  .md-map__step::before { height: 1px; top: 4.5px; }   /* iPad + phones: 1px timeline, still through the dots' centre (Ivy) */
  .md-map__phone { width: 86%; }

  /* stacked layout, centred like the rest of the page: title + text, then the phone mock,
     then the 6 DSP icons and the stats (phone above the icons, Ivy) */
  .md-basic__inner { display: flex; flex-direction: column; align-items: center; gap: 0; text-align: center; }
  .md-basic__text { display: contents; }
  .md-basic__title { margin-left: auto; margin-right: auto; }
  .md-basic__sub { align-self: stretch; }
  .md-phone { order: 1; margin-top: calc(var(--gap-block) + 10px); }   /* +10 (Ivy) */
  .md-dsps, .md-stats { order: 2; }
  .md-dsps { margin-top: 58px; }   /* phone mock → icons: 48 + 10 (Ivy) */
  .md-dsps { justify-content: center; }
  .md-stats { justify-content: center; text-align: center; }
  .md-phone { width: min(320px, 100%); }

  .md-card { padding: 24px; }
  .md-zoom-hint { display: block; }

  .mv-frame { aspect-ratio: 4 / 3; }
  .mv-scrim { height: 62%; background: linear-gradient(to top, rgba(6, 6, 9, .95) 0%, rgba(6, 6, 9, .6) 55%, transparent 100%); }

  .md-shot figcaption {margin-bottom: 14px; }
  .md-strats__row--4 .md-shot figcaption { margin: 14px 0 0; }
  .md-shot__emoji { font-size: 22px; }
  .md-strats__row { column-gap: 16px; }
}

/* ============================================================
   Phone — multi-phone rows become a horizontal swipe track
   (bleeds to the screen edges; the next phone peeks in as the cue).
   ============================================================ */
@media (max-width: 600px) {
  .md-banners { grid-template-columns: 1fr; gap: 12px; }

  .md-pills li {padding: 5px 12px; }

  .md-map,
  .md-strats__row,
  .md-strats__row--4 {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 62%;
    column-gap: 0;
    max-width: none;
    width: auto;
    margin: 0 calc(-1 * var(--space-page));
    padding: 0 var(--space-page);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--space-page);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .md-map::-webkit-scrollbar,
  .md-strats__row::-webkit-scrollbar { display: none; }
  .md-map__step,
  .md-shot { scroll-snap-align: start; }
  .md-shot { padding: 0 8px; }
  .md-map__lbl  {min-height: 0; }
  .md-map__phone { width: 82%; }

  .md-basic { background-position: 20% center; }
  .md-dsps { grid-template-columns: repeat(3, 64px); column-gap: 32px; row-gap: 24px; margin-top: 42px; }   /* 32 + 10 (Ivy) */
  .md-stats { gap: 48px; }
  .md-phone { width: min(260px, 82%); border-width: 3px; padding: 4px; }
  .md-phone__play { width: 52px; height: 52px; }

  .md-card { padding: 12px; }

  .mv-frame { aspect-ratio: 4 / 5; }
  .mv-cap { right: 36px; }

  .md-strats { margin-top: calc(var(--gap-block) + 26px); gap: calc(var(--gap-block) + 26px); }   /* +10, then +6, then +10 (Ivy) */
}
