/* scenes/build.css (G7): #build, "What we build". Four rows, one large labelled picture beside each sentence. Pinned on desktop as an
   accordion: the active row opens to ~330px with its panel beside its caption, the other three fold to a ~72px strip (numeral, heading,
   a static end-state thumbnail). On phone nothing is pinned: every row is open and builds on its own scroll. Default (no JS, static,
   fx-fail): the head, the four captions as a list with the panel tags as real words, and the composed frame beside them.
   The cinematic layout needs the scene's own `.build-live` class, so a scene that never loads still reads. Ultramarine is line 1
   (rows 1 to 3), --line2 is line 2 (row 4). Every label on a panel is DOM (the .brow__tags list), placed over the drawing by build.mjs. */

.build__head { display: grid; gap: 1.1rem; align-content: start; max-width: 74rem; }
.build__head .label { margin: 0; }
.build__rows { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; gap: 1.6rem; }
#build .composed { width: 100%; height: auto; margin-top: 2rem; }

/* The slab: bone on ink, cut on a slant (the 2 degree seam language). The two numerals are the two business lines. */
.slab {
  --wipe: 1; --w: 640;
  padding: clamp(.9rem, 1.8vw, 1.6rem) clamp(1.2rem, 2.6vw, 2.4rem);
  background: var(--bone); color: var(--ink);
  clip-path: polygon(0 0, calc(var(--wipe) * 100%) 0, calc(var(--wipe) * (100% - 3vw)) 100%, 0 100%);
  padding-right: calc(clamp(1.2rem, 2.6vw, 2.4rem) + 3vw);
  justify-self: start;
}
.slab h2 { font-size: clamp(1.3rem, 2.2vw, 2.3rem); font-weight: var(--w); letter-spacing: -.04em; line-height: 1.08; }
.slab__l::before {
  content: attr(data-t); display: inline-block; margin-right: .8em; padding: .3em .6em .26em; vertical-align: .22em; font-family: var(--font-mono); font-size: max(11px, .3em); font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; line-height: 1; background: var(--signal); color: #fff;
}
.slab__l[data-n="02"]::before { background: var(--line2); color: var(--ink); }

/* ---- a row ----------------------------------------------------------------------------------------------------------------- */
.brow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; padding-left: 1.1rem; }
.brow::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--signal); }
.brow[data-line="2"]::before { background: var(--line2); }
.brow__n { display: none; font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600; color: var(--mut); }
.brow__copy { display: grid; gap: .35rem; align-content: center; }
.brow__copy h3 { font-size: clamp(1.15rem, 1.7vw, 1.6rem); }
.brow__copy p { color: var(--mut); max-width: 46ch; }
.brow__tag { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--mut); }
.brow__copy .brow__tag { color: var(--mut); }
.brow__line { color: var(--signal); }
.brow[data-line="2"] .brow__line { color: var(--line2); }
.brow__art { position: relative; }
.brow__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.brow__tags li { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; letter-spacing: .12em; padding: .25rem .5rem; border: 1px solid var(--line); color: var(--fg); }
.brow__art svg { display: block; width: 100%; height: auto; }
/* The folded-row strip (desktop only): the labels of the picture, as words, so a folded row still says what its picture shows. */
.brow__chain { display: none; margin: 0; }

/* ---- static and no-JS: the list, with the composed frame after it (beside it on a wide screen) ------------------------------ */
@media (min-width: 901px) {
  #build:not(.build-live) .stage { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(1.5rem, 3vw, 3rem); align-content: start; }
  #build:not(.build-live) .build__head { grid-column: 1 / -1; }
  #build:not(.build-live) .build__rows { grid-column: 1; margin-top: 2rem; }
  #build:not(.build-live) .composed { grid-column: 2; grid-row: 2; margin-top: 2rem; align-self: start; }
}

/* ---- live ------------------------------------------------------------------------------------------------------------------ */
.build-live .composed { display: none; }
.build-live .brow__copy p, .build-live .brow__copy h3, .build-live .brow__tag { color: var(--on-ink); }
.build-live .brow__copy p { opacity: .9; }
.build-live .brow__tags { position: absolute; inset: 0; display: block; margin: 0; pointer-events: none; }
.build-live .brow__tags li {
  position: absolute; display: flex; align-items: center; padding: 0; border: 0; box-sizing: border-box; font-size: max(11px, calc(var(--u) * 12)); letter-spacing: .1em; line-height: 1.1;
  text-align: start; justify-content: flex-start; color: var(--on-ink); white-space: nowrap;
}
.build-live .brow__tags li[data-align="center"] { justify-content: center; text-align: center; }
.build-live .brow__tags li[data-align="end"] { justify-content: flex-end; text-align: end; }
.build-live .brow__art { --bw: 828; --u: calc(100cqw / var(--bw)); container-type: inline-size; aspect-ratio: 828 / 300; width: 100%; }
.build-live .brow__art svg { position: absolute; left: 0; top: 0; height: 100%; overflow: visible; }
.build-live .brow__art svg * { stroke-linecap: butt; }

@media (min-width: 901px) {
  /* the pinned accordion */
  html.js:not(.fx-fail):not(.static) #build.build-live { --row-on: clamp(250px, 36svh, 330px); --row-off: clamp(54px, 8svh, 72px); }
  html.js:not(.fx-fail):not(.static) #build.build-live .stage { display: flex; flex-direction: column; justify-content: center; gap: clamp(.7rem, 1.6svh, 1.2rem); padding-block: clamp(20px, 4svh, 48px); }
  /* Rows are stacked absolutely at their folded positions; the rows below the open one slide down by a transform (--k is the open row, set by build.mjs), so a switch moves no box in layout (CLS) and the heights still ease. */
  .build-live .build__rows { margin-top: 0; --gap: clamp(5px, 1svh, 8px); --k: 0; position: relative; display: block; height: calc(var(--row-on) + 3 * var(--row-off) + 3 * var(--gap)); }
  .build-live .build__head { gap: clamp(.5rem, 1.2svh, 1rem); }
  .build-live .brow {
    grid-template-columns: 2.2rem minmax(0, 27rem) minmax(0, 1fr); column-gap: 2rem; align-items: center; height: var(--row-off); overflow: hidden; padding-left: 1.2rem;
    position: absolute; left: 0; right: 0; top: calc(var(--r) * (var(--row-off) + var(--gap)));
    transform: translateY(calc(clamp(0, calc(var(--r) - var(--k)), 1) * (var(--row-on) - var(--row-off))));
    transition: height .55s cubic-bezier(.7, 0, .2, 1), transform .55s cubic-bezier(.7, 0, .2, 1), background-color .35s linear;
  }
  .build-live .brow[data-row="1"] { --r: 0; } .build-live .brow[data-row="2"] { --r: 1; } .build-live .brow[data-row="3"] { --r: 2; } .build-live .brow[data-row="4"] { --r: 3; }
  .build-live .brow.is-on { height: var(--row-on); background: rgb(236 230 217 / .045); }
  /* the group brackets are 3px; the first three rows are one bracket (line 1), the last is its own (line 2); the open segment turns bone */
  .build-live .brow:nth-child(-n+2)::before { bottom: calc(var(--gap) * -1); }
  .build-live .brow.is-on::before { background: var(--bone); }
  /* Every child keeps its open-row box in both states (no layout move on a switch); a folded row lifts them to the strip's centre with a transform. */
  .build-live .brow { --fold: calc((var(--row-off) - var(--row-on)) / 2); }
  .build-live .brow__n, .build-live .brow__copy, .build-live .brow__art { transition: transform .55s cubic-bezier(.7, 0, .2, 1); }
  .build-live .brow:not(.is-on) :is(.brow__n, .brow__copy, .brow__art) { transform: translateY(var(--fold)); }
  .build-live .brow__n { display: flex; align-items: center; align-self: start; height: var(--row-on); }
  .build-live .brow:not(.is-on) .brow__n { color: var(--on-ink); }
  .build-live .brow:not(.is-on) .brow__copy h3 { color: rgb(241 236 224 / .82); }
  .build-live .brow__copy { position: relative; align-self: start; height: var(--row-on); }
  .build-live .brow:not(.is-on) .brow__copy { gap: 0; }
  .build-live .brow:not(.is-on) .brow__copy p, .build-live .brow:not(.is-on) .brow__tag { display: none; }
  .build-live .brow:not(.is-on) .brow__copy h3 { font-size: clamp(1.05rem, 1.45vw, 1.35rem); }
  .build-live .brow.is-on .brow__copy h3 { font-size: clamp(1.45rem, 2.1vw, 2rem); line-height: 1.1; }
  .build-live .brow.is-on .brow__copy p { animation: brow-in .45s .2s linear both; font-size: clamp(1rem, 1.15vw, 1.12rem); line-height: 1.5; }
  .build-live .brow.is-on .brow__copy::after { content: ''; position: absolute; right: -2rem; top: 50%; width: 2rem; border-top: 1px dashed var(--bone); opacity: .55; }
  /* The art is pinned to the row's top and centred by a margin computed from its own height, so the row's easing height never moves it. */
  .build-live .brow__art { justify-self: end; align-self: start; width: min(100%, calc((var(--row-on) - 36px) * 2.76)); margin-top: calc((var(--row-on) - min(100%, (var(--row-on) - 36px) * 2.76) / 2.76) / 2); }
  .build-live .brow:not(.is-on) .brow__art { opacity: 1; }
  .build-live .brow:not(.is-on) .brow__tags, .build-live .brow:not(.is-on) .brow__art svg { display: none; }
  .build-live .brow:not(.is-on) .brow__chain {
    position: absolute; inset: 0; justify-content: flex-end; display: flex; flex-wrap: nowrap; align-items: center; gap: .5rem; font-family: var(--font-mono); font-size: max(12px, .84rem); font-weight: 600; letter-spacing: .1em; color: rgb(241 236 224 / .88); white-space: nowrap;
  }
  .brow__chain span { padding: .32rem .6rem; border: 1px solid rgb(241 236 224 / .3); }
  .brow__chain .brow__to::before, .brow__chain .brow__plus::before { margin-right: .5em; font-weight: 700; color: var(--signal-l, #8290FF); }
  .brow__chain .brow__to::before { content: '\2192'; }
  .brow__chain .brow__plus::before { content: '+'; }
  .brow[data-line="2"] .brow__chain .brow__to::before, .brow[data-line="2"] .brow__chain .brow__plus::before { color: var(--line2); }
}
@keyframes brow-in { from { opacity: 0; } to { opacity: .9; } }

/* a short desktop (1366 x 768): a smaller head, so all four rows still fit the pin */
@media (min-width: 901px) and (max-height: 820px) {
  .build-live .slab h2 { font-size: clamp(1.15rem, 1.8vw, 1.7rem); }
  .build-live .brow__copy p { font-size: .95rem; line-height: 1.38; }
}

@media (max-width: 900px) {
  /* phone: nothing is pinned, every row is open and builds on its own scroll */
  html.js:not(.fx-fail):not(.static) #build .track { height: auto; }
  html.js:not(.fx-fail):not(.static) #build .track > .stage { position: static; height: auto; overflow: visible; padding-block: var(--pad-block); }
  .build-live .brow { padding-left: 1rem; }
  .build-live .brow[data-row="4"] .brow__tags li:nth-child(3) { white-space: normal; text-align: center; justify-content: center; line-height: 1.05; }
  .build-live .brow__art { --bw: 358; aspect-ratio: 358 / 150; }
  .build-live .brow__copy p { font-size: 1rem; line-height: 1.4; max-width: none; }
  .slab { padding-right: calc(1.2rem + 3vw); }
  .slab h2 { font-size: clamp(1.05rem, 4.6vw, 1.7rem); }
}

@media print { .build-live .composed { display: block !important; } }
