/* "Our Work", option 4 (?obra=4): cards that stack as you scroll, not full screen.
   Each card says plainly what kind of team we are inside the client, and shows the client's product.
   Go.AI is the first real one: their appliance floats apart and builds itself as the card scrolls
   in (a 48-frame render on a canvas, see js/obra4.js). WGSN and FlowEQ work the same way with their own scenes. */

.o4 { max-width: var(--max); margin: 0 auto; padding-inline: var(--side); display: grid; gap: 28px; }

.o4-card {
  --dim: 0;
  --bg: #0b0b0c;                          /* the render's own background, so the art has no edge */
  position: sticky; top: calc(var(--nav-h) + 8px);
  height: min(660px, calc(100vh - var(--nav-h) - 40px)); min-height: 520px;
  border-radius: 26px; overflow: hidden; background: var(--bg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08);
  transform-origin: 50% 0;
}
.o4-card::after { content: ""; position: absolute; inset: 0; z-index: 6; background: #000; opacity: var(--dim); pointer-events: none; }

/* ---------- the art: the product on the right ---------- */
.o4-art { position: absolute; inset: 0; }
/* the render sits on the right, as large as the card allows without its loose parts reaching the text.
   --keep is the share of the render (from its right edge) that holds anything: Go.AI's front panel floats
   out to 30% of the render's width, so its left 30% may pass under the text's fade but no further.
   Its top and bottom edges melt into the card. */
.o4-card { container-type: size; --keep: .7; }
.o4-wgsn { --keep: .8; }     /* the sneaker and the colour fan reach 20% in from the left */
.o4-floweq { --keep: .8; }   /* the laptop starts 20% in from the left */
.o4-art canvas, .o4-art .o4-poster {
  position: absolute; top: 50%; right: 0; height: auto; aspect-ratio: 1280 / 716;
  width: min(170cqh, calc((100cqw - 72px - min(430px, 34cqw)) / var(--keep)));
  transform: translateY(-50%); display: block;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 9%, #000 91%, transparent 100%);
}
.o4-art canvas { opacity: 0; transition: opacity .4s; }
.o4-card.is-ready .o4-art canvas { opacity: 1; }
.o4-card.is-ready .o4-poster { opacity: 0; transition: opacity 0s .4s; }  /* or it shows through the faded edges */
/* the text side fades into the render's background */
.o4-art::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, var(--bg) 0%, var(--bg) 30%, rgba(11,11,12,0) 46%);
}

/* the software our engineers built, as a live window (the product screens in css/obra.css): it floats in
   over the top of the art once the product is together, so each card shows the thing and the code that runs it */
.o4-screen {
  position: absolute; z-index: 5; top: 28px; left: calc(clamp(24px, 3vw, 48px) + min(430px, 34%) + 40px);
  width: min(360px, 29%);
  opacity: 0; transform: translateY(14px); transition: opacity .3s, transform .4s var(--ease-out);
}
.o4-screen .scr { --scr-fs: clamp(10.5px, .78vw, 12.5px); }
.o4-card.is-built .o4-screen { opacity: 1; transform: none; transition: opacity .45s .1s, transform .6s .1s var(--ease-out); }

/* ---------- the story on the left ---------- */
.o4-panel {
  position: absolute; z-index: 4; left: clamp(24px, 3vw, 48px); top: 50%; transform: translateY(-50%);
  width: min(430px, 34%); display: grid; gap: 16px;
}
/* what kind of team we are inside the client: the first thing under the name */
.o4-team { display: grid; gap: 8px; justify-items: start; font-size: 15px; line-height: 1.45; color: rgba(255,255,255,.82); }
.o4-team span {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 500; color: #fff; background: var(--orange-soft); box-shadow: inset 0 0 0 1px rgba(236,98,25,.45);
}
.o4-team span svg { width: 15px; height: 15px; fill: none; stroke: #ff9e68; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.o4-panel .cs-title { max-width: 20ch; }
.o4-panel .cs-text { font-size: 14.5px; }
.o4-panel .cs-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.o4-panel .cs-quote { display: none; }

@media (max-height: 720px) and (min-width: 901px) {
  .o4-panel { gap: 12px; }
  .o4-panel .cs-text { display: none; }
}

/* ---------- large screens: the cards are one pinned deck (js/obra4.js) ----------
   The stage fills the screen under the nav; every card sits in the same place, the next one slides up
   from below and the ones behind step back and up, so their top edges show like a stack of cards. */
.o4.is-deck {
  --deck-h: min(740px, calc(100% - 76px));
  position: relative; display: block; height: calc(100vh - var(--nav-h)); overflow: clip;
}
.o4.is-deck .o4-card {
  position: absolute; left: var(--side); right: var(--side);
  top: max(52px, calc((100% - var(--deck-h)) / 2 + 20px)); height: var(--deck-h); min-height: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,.09), 0 -24px 60px -20px rgba(0,0,0,.85);
  will-change: transform;
}

/* ---------- tablets and phones: the art on top, the story below, no stacking ---------- */
@media (max-width: 900px) {
  .o4 { gap: 20px; }
  .o4-card { position: relative; top: auto; height: auto; min-height: 0; display: grid; container-type: normal; }
  .o4-art { position: relative; inset: auto; aspect-ratio: 1280 / 716; }
  .o4-art canvas, .o4-art .o4-poster { top: 0; right: 0; width: 100%; height: 100%; transform: none; -webkit-mask-image: none; mask-image: none; }
  .o4-art::before { background: linear-gradient(0deg, var(--bg) 0%, rgba(11,11,12,0) 30%); }
  .o4-screen { position: relative; z-index: 3; top: auto; left: auto; width: auto; max-width: 520px; margin: -24px 16px 0; }
  .o4-screen .scr { --scr-fs: 11px; }
  .o4-art::before { display: none; }
  .o4-panel { position: static; transform: none; width: auto; padding: 8px 22px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .o4-screen, .o4-art canvas { transition: none; }
}
