/* Styles of /meld/ only (moved out of its <style> block on 2026-11-10).
   Loaded after the shared sheets, at the same place the block was, so the
   cascade is unchanged. Rules shared by several pages go in /css. */

/* MELD, page-specific only. Everything structural comes from
   css/case-page.css (the case template) and css/grid.css. Three pieces are
   unique to this case and live here, all sized from the grid tokens so that
   every edge lands on a column line:
   1. the flows: a strip of screens with tabs and two arrows;
   2. the two image grids (extension captures, system pieces);
   3. the result figures and the link to the related case. */

/* ---------- FLOWS ---------- */
/* One step is a whole number of columns of the block the strip sits in
   (the content columns: 9 on desktop, 12 above 1200px, 8 on tablet and 4
   on phone). Percentages here are of the strip, so the step always follows the
   real column width and the next step always starts on a column line. */
.meld-flow { --mf-step: calc((2 * 100% - 7 * var(--g-gutter)) / 9); }          /* phone screens: 2 of 9 */
.meld-flow--wide { --mf-step: calc((100% - 2 * var(--g-gutter)) / 3); }        /* landscape: 3 of 9 */
/* Exchange has three screens per rail: they fill the nine columns, 3 each.
   Desktop only; on tablet 3 screens do not divide 8 columns evenly. */
@media (min-width: 64em) {
  .meld-flow[data-flow="exchange"] { --mf-step: calc((100% - 2 * var(--g-gutter)) / 3); }
}
/* Twelve columns above 1200px: phone screens take 3 of them, landscape and
   exchange keep their thirds (4 of 12). */
@media (min-width: 75.0625em) {
  .meld-flow { --mf-step: calc((100% - 3 * var(--g-gutter)) / 4); }
  .meld-flow--wide,
  .meld-flow[data-flow="exchange"] { --mf-step: calc((100% - 2 * var(--g-gutter)) / 3); }
}

.meld-flow__head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--g-gutter);
  row-gap: var(--v-gutter);
  align-items: start;
  margin: 0 0 calc(var(--v-gutter) * 1.5);
}

.meld-flow__cap {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
}

.meld-flow__tabs { display: flex; flex-wrap: wrap; gap: var(--v-gutter) var(--g-gutter); }

.meld-flow__tab {
  appearance: none;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--black, #1f1f29);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: normal;
  opacity: 0.5;
  cursor: pointer;
}
.meld-flow__tab:hover,
.meld-flow__tab:focus-visible { opacity: 1; }
.meld-flow__tab[aria-selected="true"] { font-weight: 700; border-bottom-color: var(--black, #1f1f29); opacity: 1; }
.meld-flow__tab:focus-visible,
.meld-flow__arrow:focus-visible { outline: 2px solid var(--black, #1f1f29); outline-offset: 2px; }

.meld-flow__arrows { display: flex; gap: var(--g-gutter); justify-self: end; }

.meld-flow__arrow {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--black, #1f1f29);
  background: transparent;
  color: var(--black, #1f1f29);
  cursor: pointer;
}
.meld-flow__arrow:hover:not([disabled]) { opacity: 0.6; }
/* An arrow that cannot move is not shown at all (visibility keeps the other one in place). */
.meld-flow__arrow[disabled] { visibility: hidden; }

/* The strip scrolls sideways and stops on a step: a swipe or an arrow always
   lands with the next step on the left column line. */
.meld-flow__rail {
  grid-column: 1 / -1;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.meld-flow__rail::-webkit-scrollbar { display: none; }

/* Every set is built once and kept in the DOM; switching tabs only toggles
   [hidden], so images never decode again. */
.meld-flow__set { display: flex; align-items: stretch; gap: var(--g-gutter); }
.meld-flow__set[hidden] { display: none; }

.meld-flow__step {
  flex: 0 0 var(--mf-step);
  margin: 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}
.meld-flow__step img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(31, 31, 41, 0.12);
}
/* The web panels are already finished compositions on white: no outline. */
.meld-flow--wide .meld-flow__step img { border: 0; }
/* Screens of different shape share one caption line at the foot of the step. */
.meld-flow__step figcaption {
  margin-top: auto;
  padding-top: var(--v-gutter);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
}
.meld-flow__step figcaption b { margin-right: 0.5em; font-weight: 700; }

/* ---------- LISTS (extras) ---------- */
.mp-list { margin: 0; padding: 0; list-style: none; }
.cp-block > .mp-list:not(:first-child) > li:first-child { margin-top: 0.65em; }
.mp-list li { font-size: 13px; font-weight: 400; line-height: 1.3; letter-spacing: normal; }
.mp-list li + li { margin-top: 0.65em; }

/* ---------- EXTENSION STRIP ---------- */
/* The eight extension captures run in one horizontal track. It is a native
   swipe/trackpad scroller by default. On desktop the script below pins the
   viewport and maps vertical progress to the track, as in Juno Hops. */
body.case-page .cp-figure.mp-gallery {
  grid-column: 1 / -1;
  display: block;
  min-width: 0;
}
.mp-gallery__stage,
.mp-gallery__window { min-width: 0; }
.mp-gallery__window {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.mp-gallery__window::-webkit-scrollbar { display: none; }
.mp-gallery__track {
  display: flex;
  align-items: stretch;
  gap: var(--g-gutter);
  width: max-content;
}
.mp-gallery__item {
  flex: none;
  height: min(70vw, 60dvh);
  aspect-ratio: var(--mp-ar, 1 / 1);
  margin: 0;
  overflow: hidden;
  scroll-snap-align: start;
}
.mp-gallery__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 64em) {
  html.mp-gallery-on body.case-page .cp-figure.mp-gallery {
    min-height: 100dvh;
    margin-bottom: calc(-2 * var(--v-pitch));
  }
  html.mp-gallery-on .mp-gallery__stage {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: grid;
    grid-template-columns: repeat(var(--cp-cols), minmax(0, 1fr));
    column-gap: var(--g-gutter);
    grid-template-rows: repeat(var(--g-rows), var(--v-row));
    row-gap: var(--v-gutter);
  }
  html.mp-gallery-on .mp-gallery__window {
    grid-column: 1 / -1;
    grid-row: 3 / span 7;
    --mp-inset: var(--cp-bleed-r);
    margin-right: calc(-1 * var(--mp-inset));
    overflow: clip;
  }
  html.mp-gallery-on .mp-gallery__track {
    height: 100%;
    padding-right: var(--mp-inset);
    box-sizing: border-box;
    will-change: transform;
  }
  html.mp-gallery-on .mp-gallery__item { height: 100%; }
}

/* System pieces (2026-11-10): the staking video on columns 1 to 9, then the
   kit and the wireframes side by side, one row high. The kit keeps its
   shape and sets the height; the wireframes take the rest of the row and
   crop to it (absolute, so they never make the row taller). Phone: stacked,
   every image at its own shape. */
.mp-split { row-gap: calc(var(--v-gutter) * 3); }
.mp-split figure { margin: 0; min-width: 0; }
.mp-split img { display: block; width: 100%; height: auto; }
.mp-split figcaption { margin-top: var(--v-gutter); }
.mp-split__wire { display: flex; flex-direction: column; }
.mp-split__crop { position: relative; flex: 1 1 auto; }
.mp-split__crop img { position: absolute; inset: 0; height: 100%; object-fit: cover; }
@media (min-width: 64em) {
  .mp-split__video { grid-column: 1 / span 9; }
  .mp-split__kit { grid-column: 1 / span 3; }
  .mp-split__wire { grid-column: 4 / -1; }
}
@media (min-width: 75.0625em) {
  .mp-split__kit { grid-column: 1 / span 4; }
  .mp-split__wire { grid-column: 5 / -1; }
}

/* ---------- RELATED CASE ---------- */
.mp-next { display: block; color: inherit; text-decoration: none; }
.mp-next__k {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.mp-next__t { display: block; margin: 4px 0 calc(var(--v-gutter) * 1.5); font-size: 22px; font-weight: 600; line-height: 1.2; }
.mp-next:hover .mp-next__t,
.mp-next:focus-visible .mp-next__t { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- TABLET: the strips and grids sit on 8 columns ---------- */
@media (max-width: 63.99em) {
  .meld-flow { --mf-step: calc((100% - 3 * var(--g-gutter)) / 4); }           /* phone screens: 2 of 8 */
  .meld-flow--wide { --mf-step: calc((100% - var(--g-gutter)) / 2); }         /* landscape: 4 of 8 */

  .mp-split {
    display: grid;
    grid-template-columns: repeat(var(--g-cols), minmax(0, 1fr));
    column-gap: var(--g-gutter);
  }
  .mp-split__video { grid-column: 1 / -1; }
  .mp-split__kit { grid-column: 1 / span 3; }
  .mp-split__wire { grid-column: 4 / -1; }
}

/* ---------- PHONE: 4 columns ---------- */
@media (max-width: 37.49em) {
  .meld-flow { --mf-step: calc((100% - var(--g-gutter)) / 2); }               /* phone screens: 2 of 4 */
  .meld-flow--wide { --mf-step: calc((3 * 100% - var(--g-gutter)) / 4); }     /* landscape: 3 of 4 */

  .mp-split__kit,
  .mp-split__wire { grid-column: 1 / -1; }
  .mp-split__crop { position: static; }
  .mp-split__crop img { position: static; height: auto; }
}

/* ---------- DESKTOP: head of a strip on the content columns ---------- */
@media (min-width: 64em) {
  .meld-flow__head { grid-template-columns: subgrid; }
  .meld-flow__cap { grid-column: 1 / span 6; }
  .meld-flow__tabs { grid-column: 1 / span 6; }
  .meld-flow__arrows { grid-column: 7 / -1; grid-row: 2; }
}

/* ---------- INDEX (first screen) ---------- */
/* Small and set on the last five content columns. Six entries from row 2
   down; the rest of the screen stays empty to the bottom edge. Number on the
   first of the five, title on the other four, the short label under it.
   Type never over 16px (css/a11y.css carries the 4/3 equivalents). Every box
   is a line on the column lines, no horizontal padding. */
.cp-index { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-content: start; }
.cp-index ol { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; margin: 0; padding: 0; list-style: none; }
.cp-index li { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; border-top: 1px solid var(--black, #1f1f29); }
.cp-index li:last-child { border-bottom: 1px solid var(--black, #1f1f29); }
.cp-index a {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  padding-block: var(--v-gutter);
  color: inherit;
  text-decoration: none;
}
.cp-index__n { grid-column: 1; font-size: 16px; font-weight: 600; line-height: 1.2; }
.cp-index__t { grid-column: 2 / -1; font-size: 16px; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.cp-index__k { grid-column: 2 / -1; grid-row: 2; padding-top: 4px; font-size: 10px; font-weight: 400; line-height: 1.3; letter-spacing: 0.8px; text-transform: uppercase; color: #767676; }
.cp-index a:hover .cp-index__t,
.cp-index a:focus-visible .cp-index__t { text-decoration: underline; text-underline-offset: 4px; }
.cp-index a:focus-visible { outline: 2px solid var(--black, #1f1f29); outline-offset: 2px; }
/* Desktop: one entry per row of the page grid (rows 2 to 7), so every line
   lands on a row line; rows 8 to 12 stay empty. */
@media (min-width: 64em) {
  .cp-index { grid-column: span 5 / -1; grid-row: 2 / span 6; grid-template-rows: subgrid; }
  .cp-index ol { grid-row: 1 / -1; grid-template-rows: subgrid; }
  .cp-index a { padding-bottom: 0; }
}
/* On a short screen one row is smaller than an entry, so each entry takes
   two rows and its line still lands on a row line. */
@media (min-width: 64em) and (max-height: 799px) {
  .cp-index { grid-row: 2 / span 12; }
  .cp-index li { grid-row: span 2; }
}
/* Tablet: the last five of the eight columns. Phone: the four. */
@media (min-width: 37.5em) and (max-width: 63.99em) {
  .cp-index { grid-column: 4 / -1; }
}
@media (max-width: 37.49em) {
  .cp-index { grid-column: 1 / -1; }
}

/* Text 1 and text 2 are stacked beside the image: a clear gap between them,
   one row less than the flow (2026-11-10). The image starts on the first
   line of paragraph 1 and ends on the last baseline of text 2: the gap
   between the two texts takes up the difference (.cp-ed--top,
   js/case-page.js). */
@media (min-width: 64em) {
  .mp-lead-row { row-gap: calc(var(--v-gutter) * 3); }
  body.case-page .cp .cp-ed.mp-lead-row > .cp-block ~ .cp-block { margin-top: 0; }
}

/* ---------- SECTION 2 ---------- */
/* More air between the alert of the results and section 2 (two gaps of the
   flow), and its second block on columns 6 to 9, under the first. */
body.case-page .cp-flow > .mp-after-results { margin-top: var(--cp-gap); }

/* ---------- GAMIFICATION ---------- */
/* The image sits beside text 4, from column 5 to the right edge of the page. */
@media (min-width: 64em) {
  body.case-page .cp .cp-ed > .cp-figure.mp-gam__fig { margin-right: calc(-1 * var(--cp-bleed-r)); }
}

/* ---------- EXTRAS AND WHERE IT ENDED: a dark panel ---------- */
/* A box on all the content columns (its edges are column lines) with the
   32 px inset of a box for the text, one flow gap above and below. */
body.case-page .cp-flow > .mp-dark {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-content: start;
  row-gap: var(--cp-gap);
  padding-block: var(--cp-gap);
  background: var(--black, #1f1f29);
  color: var(--paper, #fff);
}
html body.case-page .cp .mp-dark .cp-block { padding-inline: 32px; box-sizing: border-box; }
/* Desktop: Extras on columns 1 to 4 and Where it ended on 5 to 8, titles on
   one line. Both keep the 32 px inset of the box on the left only, so the
   two texts stay the same distance apart as their columns. */
@media (min-width: 64em) {
  html body.case-page .cp .mp-dark .cp-block { padding-right: 0; }
  body.case-page .cp .mp-dark .cp-ed > .cp-block.mp-dark__end { margin-top: 0; }
}
body.case-page .mp-dark :is(h2, h3, p, li) { color: var(--paper, #fff); }
html.a11y body.case-page .mp-dark,
html.a11y body.case-page .mp-dark :is(h2, h3, p, li) { color: #fff !important; }

/* The related case, well apart from the panel: two gaps of the flow. */
body.case-page .cp-flow > .mp-related { margin-top: var(--cp-gap); }

/* ---------- CORE WALLET + EARN: one horizontal strip ---------- */
/* The two sets run one after the other in a single track; the names above
   jump to their part and mark where you are. Steps are measured on the
   rail (cqi), so they still take whole columns while the track grows. */
.meld-flow__stage { display: contents; }
.meld-flow--strip .meld-flow__rail { container-type: inline-size; }
.meld-flow--strip .meld-flow__track { display: flex; gap: var(--g-gutter); width: max-content; }
.meld-flow--strip { --mf-step: calc((100cqi - 2 * var(--g-gutter)) / 3); }                 /* 3 of 9, 4 of 12 */
.meld-flow__tab[aria-current="true"] { font-weight: 700; border-bottom-color: var(--black, #1f1f29); opacity: 1; }
@media (max-width: 63.99em) {
  .meld-flow--strip { --mf-step: calc((100cqi - var(--g-gutter)) / 2); }                   /* 4 of 8 */
}
@media (max-width: 37.49em) {
  .meld-flow--strip { --mf-step: calc((3 * 100cqi - var(--g-gutter)) / 4); }               /* 3 of 4 */
}
/* Desktop: the strip is pinned for a screen and the vertical scroll moves
   it sideways, from column 1 to the right edge of the page. Bigger steps
   (5 of 9, 6 of 12), never taller than the screen allows. Reduced motion
   and the accessible mode keep the native sideways scroller. */
@media (min-width: 64em) {
  html.mf-strip-on .meld-flow--strip {
    --mf-step: min(calc(5 * (100cqi - 8 * var(--g-gutter)) / 9 + 4 * var(--g-gutter)), calc(100dvh - 18rem));
  }
  html.mf-strip-on .meld-flow--strip .meld-flow__stage {
    grid-column: 1 / -1;
    position: sticky;
    top: 0;
    height: 100dvh;
    display: grid;
    grid-template-columns: subgrid;
    align-content: start;
    padding-top: calc(2 * var(--v-pitch));
    box-sizing: border-box;
  }
  html.mf-strip-on .meld-flow--strip .meld-flow__rail {
    overflow: visible;
    scroll-snap-type: none;
    clip-path: inset(-1px calc(-1 * var(--cp-bleed-r)) -1px 0);
  }
  html.mf-strip-on .meld-flow--strip .meld-flow__track { will-change: transform; }
}
@media (min-width: 75.0625em) {
  html.mf-strip-on .meld-flow--strip { --mf-step: min(calc((100cqi - var(--g-gutter)) / 2), calc(100dvh - 18rem)); }
}

@media (prefers-reduced-motion: reduce) {
  .meld-flow__rail { scroll-behavior: auto; }
}
