/* ============================================================
   Melor case study — page-specific styles.
   The page used to be one tall baked image (me-full.jpg) with absolutely
   positioned overlays. It is now real flowing HTML built on the shared
   case-page system (case-hero / case-meta / case-section / other-projects),
   so everything below only styles Melor's own modules. Spacing comes from the
   shared tokens in styles.css (--gap-section/--gap-head/--gap-block/--gap-card…).
   ============================================================ */

/* ---------- Hero ---------- */
.mel-wordmark {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.1em;
  margin: 0 0 22px;                  /* = SoundOn's wordmark → tagline gap */
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(36px, 6vw, 84px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}
.mel-wordmark img { height: 0.74em; width: auto; display: block; }

.mel-hero-video {
  display: block;
  margin: 60px auto 0;
  width: min(100% - 2 * var(--space-page), 1152px);
  aspect-ratio: 3890 / 2304;          /* source video, no crop */
  object-fit: cover;
  background: #0a0a0a;
  border: var(--cover-stroke-w) solid var(--cover-stroke);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

/* ---------- Shared module pieces ---------- */
/* Framed media (videos / UI screens): 1px white @30% outline, 20px corners. */
.mel-frame {
  display: block;
  width: 100%;
  max-width: min(100%, 1152px);
  margin: 0 auto;
  background: #0a0a0a;
  border: var(--cover-stroke-w) solid var(--cover-stroke);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  overflow: hidden;
  object-fit: cover;
}
.mel-frame--keypage { aspect-ratio: 2876 / 1600; }
.mel-player { position: relative; aspect-ratio: 16 / 9; }
.mel-player > .video-player__video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Stage / step pills — 12%→0 white gradient, hairline border, small radius. */
.mel-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 70px;
  margin: 0;
  padding: 12px 18px;
  box-sizing: border-box;
  text-align: center;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-lead);
  line-height: 1.4;
  color: #fff;
}
.mel-pill--wide { font-weight: 600; }

/* Down arrow between a step and the next one. */
.mel-arrow {
  display: block;
  position: relative;
  width: 10px;
  height: 40px;
  margin: 14px auto;
}
.mel-arrow::before {               /* stem */
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 1px;
  width: 1px;
  background: rgba(255, 255, 255, 0.7);
}
.mel-arrow::after {                /* head */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 7px;
  height: 7px;
  border-right: 1px solid rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  transform: translateX(-50%) rotate(45deg);
}

.mel-wrap { max-width: min(100%, 1120px); margin: 0 auto; }

/* ---------- What kinds of videos do artists & labels need ---------- */
.mel-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 38px;
}
.mel-stage { display: flex; flex-direction: column; min-width: 0; }
.mel-stage > .mel-pill,
.mel-stage > .mel-arrow,
.mel-stage__goal { flex: none; }
.mel-stage__card {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 19px 18px 28px;
  background: #212121;
  border: var(--cover-stroke-w) solid var(--cover-stroke);
  border-radius: var(--radius-md);
}
.mel-stage__card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1238 / 744;   /* Ivy's high-res exports */
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 6px);
}
.mel-stage__formats {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 1.5;
  text-align: center;
  color: #fff;
}
.mel-stage__goal {
  margin: 24px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: 1.5;
  text-align: center;
  color: var(--sub-color);
}

/* ---------- How to build an AIGC tool (diagram rebuilt as HTML) ---------- */
.mel-aigc-fit {
  border: var(--cover-stroke-w) solid var(--cover-stroke);
  border-radius: var(--radius-lg);
  overflow: hidden;            /* no-JS fallback: clip rather than overflow the page */
}
/* Fixed desktop layout (1120 frame − 2px border); never reflows — the script
   zooms it down proportionally when the frame is narrower. */
.mel-aigc {
  width: 1118px;
  padding: 48px 82px 80px;
  color: #fff;
}
.mel-aigc__head { text-align: center; margin-bottom: 64px; }
.mel-aigc__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.3;
}
.mel-aigc__sub {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.5;
  color: var(--sub-color);
}
.mel-aigc__grid {
  position: relative;
  display: grid;
  grid-template-columns: 162px minmax(0, 1fr) 162px;
  gap: 26px;
  align-items: stretch;
}
.mel-aigc__side {
  border: var(--cover-stroke-w) solid var(--cover-stroke);   /* same stroke as the homepage cards (Ivy) */
  border-radius: var(--radius-sm);
  padding: 20px 18px 18px;
}
.mel-aigc__side-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.4;
}
.mel-aigc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.mel-aigc__side--user .mel-aigc__list { height: 100%; justify-content: center; gap: 30px; }
.mel-aigc__list li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.4;
  color: #d4d4d4;
}
.mel-aigc__list svg { width: 42px; height: 42px; flex: none; }

.mel-aigc__mid { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.mel-aigc__bridge { display: block; width: 100%; height: auto; }
.mel-aigc__focus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 86%;
  margin: 30px 0 22px;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.3;
}
.mel-aigc__focus svg { width: 22px; height: 22px; flex: none; }
.mel-aigc__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mel-aigc__steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.3;
  color: #d4d4d4;
  white-space: nowrap;
}
/* thin arrow between consecutive steps */
.mel-aigc__steps li + li::before {
  content: "";
  position: absolute;
  top: 42px;
  left: calc(-50% + 52px);
  width: calc(100% - 104px);
  height: 1px;
  background: rgba(255, 255, 255, 0.75);
}
.mel-aigc__steps li + li::after {
  content: "";
  position: absolute;
  top: 39px;
  left: calc(50% - 58px);
  width: 6px;
  height: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.75);
  border-right: 1px solid rgba(255, 255, 255, 0.75);
  transform: rotate(45deg);
}
.mel-aigc__ring {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
}
.mel-aigc__ring svg { width: 40px; height: 40px; }

/* Continuous feedback loop: dashed U from under the user box back up into the model box. */
.mel-aigc__loop {
  position: relative;
  margin: 0 81px;                      /* = half of a side box → starts/ends under the box centres */
  height: 66px;
  border: 1px dashed rgba(255, 255, 255, 0.7);
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-align: center;
}
.mel-aigc__loop::before {               /* arrowhead pointing up into the model box */
  content: "";
  position: absolute;
  left: -4px;
  top: 2px;
  width: 6px;
  height: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  transform: rotate(45deg);
}
.mel-aigc__loop span {
  position: relative;
  top: 26px;
  font-family: var(--font-display);
  font-size: 15px;
  color: #d4d4d4;
}
.mel-aigc__statement {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 38px;
  padding: 22px 26px;
  border: var(--cover-stroke-w) solid var(--cover-stroke);   /* same stroke as the homepage cards (Ivy) */
  border-radius: var(--radius-sm);
  text-align: center;
}
.mel-aigc__statement svg { width: 34px; height: 34px; flex: none; fill: #fff; }
.mel-aigc__statement div { flex: 1; min-width: 0; }
.mel-aigc__statement p { margin: 0; font-family: var(--font-display); }
.mel-aigc__statement p:first-child { font-size: 17px; line-height: 1.4; }
.mel-aigc__statement p + p { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--sub-color); }

/* ---------- MV is the most difficult one ---------- */
.mel-collage {
  display: block;
  width: 100%;
  height: auto;
  margin-top: var(--gap-card);
  border-radius: var(--radius-lg);
}
.mel-steps {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 38px;
}
.mel-steps .mel-pill { min-height: 125px; height: 100%; }

/* ---------- Our solutions ---------- */
.mel-solutions { display: flex; flex-direction: column; gap: var(--gap-block); }
.mel-sol .mel-frame { margin-top: var(--gap-card); }
.mel-sol .mel-frame img { display: block; width: 100%; height: auto; }

/* ---------- Showcase gallery ---------- */
.mel-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.mel-gallery .mel-frame { aspect-ratio: 16 / 9; border-radius: var(--radius-md); }

/* ---------- Data & next step ---------- */
.mel-data {
  display: grid;
  grid-template-columns: 274fr 395fr 424fr;
  grid-template-areas:
    "a b e"
    "c d e";
  gap: 13px;
  color: #222;
}
.mel-stat {
  display: flex;
  flex-direction: column;
  min-height: 256px;
  padding: 26px 24px 24px;
  box-sizing: border-box;
  background: #f3f3f3;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
}
.mel-stat--a { grid-area: a; background: #13b1d4; color: #fff; }
.mel-stat--b { grid-area: b; }
.mel-stat--c { grid-area: c; }
.mel-stat--d { grid-area: d; }
.mel-stat__label { margin: 0; font-size: var(--fs-body); font-weight: 600; line-height: 1.3; }
.mel-stat__num {
  margin: auto 0;
  padding: 18px 0;
  font-size: var(--fs-stat);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.mel-stat__num small { font-size: 0.42em; font-weight: 600; letter-spacing: 0; margin-left: 2px; }
.mel-stat__cap { margin: 0; font-size: var(--fs-small); line-height: 1.5; opacity: 0.85; font-weight: 400; }

/* Donut (cyan 45.19 · purple · teal), drawn with a conic gradient + ring mask. */
.mel-donut { display: flex; align-items: center; gap: 22px; margin-top: 18px; flex: 1; }
.mel-donut__ring {
  flex: none;
  width: 166px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(
    #03b2cd 0 45.19%, #f3f3f3 0 45.7%,
    #996adc 0 79.1%,  #f3f3f3 0 79.6%,
    #05af94 0 99.5%,  #f3f3f3 0);
  -webkit-mask: radial-gradient(farthest-side, transparent 72%, #000 73%);
          mask: radial-gradient(farthest-side, transparent 72%, #000 73%);
}
.mel-donut__info { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.mel-donut__hl { margin: 0; }
.mel-donut__hl b { display: block; font-size: var(--fs-h3); font-weight: 700; line-height: 1.1; }
.mel-donut__hl span { display: block; margin-top: 4px; font-size: var(--fs-small); line-height: 1.4; color: #666; font-weight: 400; }
.mel-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mel-legend li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-small); color: #666; font-weight: 400; line-height: 1.5; }
.mel-legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* User feedback card: a loose cloud of chat bubbles. */
.mel-fb {
  grid-area: e;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
  background: #f3f3f3;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
}
.mel-fb__list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px 12px;
}
.mel-fb__list li {
  max-width: calc(50% - 6px);      /* two bubbles per row where they fit → a loose cloud */
  padding: 8px 12px;
  background: #e5e5e5;
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  line-height: 1.4;
  color: #333;
  font-weight: 400;
}
.mel-fb__list b { font-weight: 600; color: #11a3c0; }
.mel-fb__foot { margin: 16px 0 0; font-size: var(--fs-small); text-align: right; color: #999; font-weight: 400; line-height: 1.5; }

.mel-next__title {
  margin: var(--gap-block) 0 var(--gap-head);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: 1.25;
  color: #fff;
}
.mel-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.mel-next img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 550 / 343;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: #0a0a0a;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .mel-steps { gap: 20px; }
}

@media (max-width: 900px) {
  .mel-hero-video { margin-top: 48px; }
  .mel-pill {min-height: 60px; }

  .mel-stages { gap: 18px; }
  .mel-stage__card { padding: 12px 12px 18px; gap: 14px; }
  .mel-stage__goal {margin-top: 16px; }


  /* 3 per row, last row centred */
  .mel-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 20px; }
  .mel-steps li { flex: 0 0 calc((100% - 28px) / 3); }
  .mel-steps .mel-pill { min-height: 90px;}

  .mel-data {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "a b"
      "c d"
      "e e";
  }
  .mel-stat { min-height: 220px; }
  /* ring + headline side by side, legend underneath */
  .mel-donut { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px 20px; align-items: center; }
  .mel-donut__ring { width: 120px; }
  .mel-donut__info { display: contents; }
  .mel-legend { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
  .mel-fb__list { padding: 6px 0; }
}

/* Side by side, the three stages share rows (pill · arrow · card · goal), so a pill
   that wraps to two lines doesn't push its card below the others. */
@media (min-width: 761px) {
  .mel-stages { row-gap: 0; }
  .mel-stage { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; }
}

@media (max-width: 760px) {
  /* Stages read as three stacked steps on phones / small tablets. */
  .mel-stages { grid-template-columns: minmax(0, 1fr); gap: var(--gap-block); max-width: 480px; margin: 0 auto; }
}

@media (max-width: 600px) {
  .mel-hero-video { margin-top: 40px; }
  .mel-pill {min-height: 52px; padding: 10px 14px; }
  .mel-arrow { height: 28px; margin: 10px auto; }


  .mel-steps { gap: 10px; }
  .mel-steps li { flex-basis: calc(50% - 5px); }
  .mel-steps li:last-child { flex-basis: 100%; }
  .mel-steps .mel-pill { min-height: 64px;}

  .mel-gallery { grid-template-columns: minmax(0, 1fr); gap: 12px; }

  .mel-data {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "a" "b" "c" "d" "e";
    gap: 12px;
  }
  .mel-stat { min-height: 0; padding: 20px; }
  .mel-stat__num {padding: 22px 0; }
  .mel-donut { grid-template-columns: 104px minmax(0, 1fr); }
  .mel-donut__ring { width: 104px; }
  .mel-fb { padding: 20px 16px 16px; }
  .mel-fb__list li { max-width: 100%;}
  .mel-next { grid-template-columns: minmax(0, 1fr); }
}
