/* The Studio's storyboard player (incident.studio@web-summit.dinis). Tokens only (design/README.md): no hex colour here;
   IPMA's warning colours are never used; a state is always said in words or by a pattern as well as by colour. */
.sb { --U: 21px; --cap: 20px; --hatch: repeating-linear-gradient(135deg, var(--line-2) 0 2px, transparent 2px 7px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 12px; margin: 0 0 22px; }
.sb:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sb-title h2 { margin: 0; font-size: 22px; line-height: 1.2; }
.sb-title .meta { margin: 3px 0 9px; max-width: 150ch; font-size: 13.5px; line-height: 1.4; }
.sb-title label { font-size: 13px; color: var(--ink-2); } .sb-pick { font: 700 18px/1.2 var(--sans); padding: 1px 4px; max-width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 4px; }

.sb-chapters { list-style: none; margin: 0 0 9px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sb button { font: 600 13px/1.2 var(--sans); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 5px; padding: 7px 10px; cursor: pointer; }
.sb button:hover { border-color: var(--ink-2); }
.sb button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sb button:disabled { opacity: .45; cursor: default; }
.sb button[aria-current=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sb-chapters button { padding: 6px 8px; font-size: 12.5px; }
.sb-chapters button span { font: 700 12px/1 var(--mono); margin-right: 4px; opacity: .75; }
.sb button.primary { background: var(--focus); color: var(--surface); border-color: var(--focus); min-width: 68px; }

.sb-stage { position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); padding: 8px 12px; min-height: 300px; overflow: hidden; }
.sb .sb-big { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; font: 700 22px/1 var(--sans); padding: 18px 30px; border-radius: 40px; background: var(--focus); color: var(--surface); border: 3px solid var(--surface); box-shadow: 0 2px 14px var(--line-2); cursor: pointer; }
.sb-lane + .sb-lane { border-top: 2px dashed var(--line-2); margin-top: 10px; padding-top: 10px; }
.sb-lane h4 { margin: 0 0 6px; font: 700 12px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.sb-cols { display: grid; grid-template-columns: minmax(120px, .55fr) minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "left centre right" "left held got"; gap: 8px 22px; align-items: end; }
.sb-cols.has-door { grid-template-columns: minmax(120px, .55fr) minmax(0, 1fr) 48px minmax(0, 1fr); grid-template-areas: "left centre . right" "left held door got"; column-gap: 6px; }
.sb-cols.no-left .sb-side { display: none; }
.sb-cols.no-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "centre right" "held got"; }
.sb-cols.no-left.has-door { grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); grid-template-areas: "centre . right" "held door got"; }
.sb-left { align-self: start; } .sb-centre { grid-area: centre; } .sb-right { grid-area: right; }
.sb-held { grid-area: held; } .sb-got { grid-area: got; } .sb-door { grid-area: door; }

.sb-head { display: flex; gap: 8px; align-items: flex-start; min-height: 92px; align-self: start; }
.sb-left.sb-head { min-height: 0; }
.sb-left.sb-head { flex-direction: column; }
.sb-who { flex: none; width: 84px; text-align: center; font: 600 11px/1.2 var(--sans); color: var(--ink-2); }
.sb-char { display: block; width: 66px; height: 74px; margin: 0 auto 2px; color: var(--ink); }
.sb-char .c-ink { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sb-char .c-thick { stroke-width: 3; } .sb-char .c-thin { stroke-width: 1; }
.sb-char .c-fill { fill: currentColor; }
.sb-char .c-skin { fill: var(--surface); stroke: currentColor; stroke-width: 2; }
.sb-char .c-surface { fill: var(--surface); stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.sb-char .c-strong { stroke-width: 2.5; }
.sb-char .c-screen { fill: var(--surface-2); stroke: currentColor; stroke-width: 1.5; }
.sb-char .c-body { fill: var(--ink-2); } .sb-char .c-body2 { fill: var(--focus); } .sb-char .c-accent { fill: var(--focus); stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.sb-say { position: relative; margin: 4px 0 0; padding: 7px 10px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 10px; font-size: 14px; line-height: 1.35; max-width: 34ch; }
.sb-left .sb-say { margin-top: 2px; }
.sb-stage:not(.still) .sb-say { animation: sb-pop .28s ease-out both; }

.sb-pile { position: relative; height: calc(var(--units) * var(--U) + var(--cap)); display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 2px solid var(--ink); padding-top: var(--cap); min-width: 0; }
.sb-cap { position: absolute; top: 0; left: 0; right: 0; font: 600 11px/1.25 var(--sans); color: var(--ink-2); }
.sb-b { position: relative; flex: none; height: calc(var(--u) * var(--U)); box-sizing: border-box; display: flex; align-items: center; gap: 6px; padding: 0 6px; overflow: hidden; background: var(--surface); border: 1px solid var(--line-2); border-top-width: 0; font-size: 12px; line-height: 1.15; white-space: nowrap; }
.sb-b:first-of-type { border-top-width: 1px; }
.sb-b b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-b i { font-style: normal; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; }
.sb-b em { margin-left: auto; flex: none; font: 700 9.5px/1 var(--sans); font-style: normal; text-transform: uppercase; letter-spacing: .05em; padding: 2px 4px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); }
.sb-b.k-system, .sb-b.k-tools { background: var(--surface-2); }
.sb-b.k-file { background: var(--surface); border-left: 4px double var(--ink-2); }
.sb-b.s-new { box-shadow: inset 0 0 0 2px var(--focus); }
.sb-b.s-new em, .sb-b.s-read em { background: var(--sent-soft); color: var(--sent); }
.sb-b.s-key { box-shadow: inset 0 0 0 2px var(--ink); font-weight: 600; } .sb-b.s-key em { background: var(--ink); color: var(--paper); }
.sb-b.s-changed { box-shadow: inset 0 0 0 2px var(--ink); } .sb-b.s-changed em { background: var(--ink); color: var(--paper); }
.sb-b.s-summary { border: 2px dashed var(--ink); background: var(--surface-2); }
.sb-b.s-lost { border-style: dashed; color: var(--ink-2); background: transparent; } .sb-b.s-lost b { text-decoration: line-through; }
.sb-b.s-saved { box-shadow: inset 4px 0 0 var(--ok); } .sb-b.s-saved em, .sb-b.s-doc em { background: var(--ok-soft); color: var(--ok); }
.sb-b.s-doc { box-shadow: inset 0 0 0 2px var(--ok); }
.sb-b.over { color: var(--ink-2); }
/* what the model receives: read at full cost (solid, blue) or reused from the cache (hatched, grey), each with the word */
.sb-b.r-read { background: var(--sent-soft); border-color: var(--sent); box-shadow: none; }
.sb-b.r-cached { background-color: var(--surface); background-image: var(--hatch); color: var(--ink-2); box-shadow: none; }
.sb-lintel { position: absolute; left: 0; right: 0; bottom: calc(var(--u) * var(--U)); border-top: 2px dotted var(--ink); z-index: 2; pointer-events: none; }
.sb-lintel.lab { border-top-style: none; } .sb-lintel.lab i { left: 0; right: auto; bottom: 3px; background: none; }
.sb-lintel.lab::before { display: none; }
.sb-lintel::before { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: calc((var(--units) - var(--u)) * var(--U)); background: var(--hatch); opacity: .55; }
.sb-lintel i { position: absolute; right: 0; bottom: 2px; font: 700 10px/1 var(--sans); font-style: normal; background: var(--paper); color: var(--ink); padding: 1px 3px; }
.sb-door { position: relative; height: calc(var(--units) * var(--U) + var(--cap)); border-bottom: 2px solid var(--ink); }
.sb-door span { position: absolute; left: 4px; right: 4px; bottom: 0; height: calc(var(--u) * var(--U)); box-sizing: border-box; border: 5px solid var(--ink); border-bottom: 0; border-radius: 5px 5px 0 0; background: var(--paper); }
.sb-door span::after { content: "the door"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); white-space: nowrap; font: 700 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.sb-door::before { content: ""; position: absolute; left: 0; right: 0; top: var(--cap); bottom: 0; background: var(--hatch); opacity: .9; }
.sb-door.blocked span::after { content: "does not fit"; color: var(--ink); }
.sb-got.blocked::after { content: "Too long for the window: this request cannot be sent as it is."; margin: auto 0; padding: 8px; border: 2px dashed var(--ink); font-size: 13px; background: var(--surface); }

.sb-side { grid-area: left; align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; }
.sb-count { min-width: 0; }
.sb-side .sb-shelf { margin-top: 0; }
.sb-meters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; margin: 0; }
.sb-meters div { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.sb-meters dt { font-size: 11px; line-height: 1.2; color: var(--ink-2); }
.sb-meters dd { margin: 1px 0 0; font: 700 18px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.sb-meters dd small { font: 400 11.5px/1.2 var(--sans); color: var(--ink-2); }
.sb-meters .reuse { background: var(--hatch); padding: 0 3px; color: var(--ink); }

.sb-bars { margin-top: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 11.5px; color: var(--ink-2); }
.sb-bars b { display: block; font-weight: 400; margin-bottom: 3px; }
.sb-bars div { display: flex; align-items: center; height: 15px; margin-top: 2px; }
.sb-bars span { width: 16px; font: 700 11px/1 var(--mono); }
.sb-bars i { display: block; height: 11px; box-sizing: border-box; }
.sb-bars i.r { background: var(--sent); } .sb-bars i.c { background: var(--hatch); border: 1px solid var(--line-2); border-right: 0; } .sb-bars i[data-w="0"] { display: none; }
.sb-bars small { margin-left: 6px; font: 600 11px/1 var(--mono); white-space: nowrap; } .sb-bars .now small { color: var(--ink); }
.sb-shelf { margin-top: 8px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); padding: 6px 9px 8px; }
.sb-shelf h5 { margin: 0 0 5px; font: 700 11px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.sb-shelf ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sb-shelf li { border: 1px solid var(--line-2); border-left: 4px solid var(--ok); border-radius: 4px; padding: 4px 8px; font-size: 13px; line-height: 1.3; background: var(--paper); max-width: 100%; }
.sb-shelf li small { display: block; color: var(--ink-2); font-size: 11.5px; }
@media (min-width: 700px) { .sb-side .sb-shelf ul { gap: 3px; } .sb-side .sb-shelf li { width: 100%; } .sb-side .sb-shelf li small { display: none; } .sb-shelf li { padding: 2px 7px; font-size: 12.5px; } .sb-shelf li small { display: inline; margin-left: 6px; } .sb-stage.two .sb-shelf li small { display: none; } .sb-shelf { padding: 5px 8px 6px; } }
.sb-shelf li.s-read { box-shadow: 0 0 0 2px var(--focus); }
.sb-size { font: 600 11.5px/1 var(--mono); color: var(--ink-2); white-space: nowrap; }

.sb-list { margin: 6px 0; padding-left: 24px; font-size: 14px; } .sb-list li { margin: 0 0 8px; line-height: 1.4; break-inside: avoid; }
@media (min-width: 900px) { .sb-list { columns: 2; column-gap: 40px; } }
.sb-caption { margin: 9px 0 7px; font-size: 16.5px; line-height: 1.4; min-height: 4.3em; max-width: 118ch; }
.sb-caption strong { font-weight: 700; }
.sb-link { font-size: 13px; margin-left: 6px; white-space: nowrap; }
.sb-caption b { display: block; font: 700 11.5px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); margin-bottom: 2px; }
.sb-caption b span { font-weight: 400; text-transform: none; letter-spacing: 0; }
.sb-fold { border-top: 1px solid var(--line); padding: 6px 0; } .sb-fold summary { font-weight: 700; font-size: 17px; cursor: pointer; padding: 4px 0; }
.sb-caption small { display: block; font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.sb-progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 7px; }
.sb-progress i { display: block; height: 100%; width: 0; background: var(--focus); }
.sb-controls, .sb-more { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sb-controls { float: left; margin-right: 6px; } .sb-keys { clear: both; padding-top: 7px; }
.sb-scenes { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.sb-scenes button { font: 700 12px/1 var(--mono); padding: 6px 0; width: 28px; }
.sb-keys { margin: 0; font-size: 12px; }

@media (min-width: 900px) { .sb-stage.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; } .sb-stage.two .sb-lane + .sb-lane { border-top: 0; margin-top: 0; padding-top: 0; border-left: 2px dashed var(--line-2); padding-left: 14px; } }
.sb-stage.two { --U: 19px; } .sb-stage.two .sb-b i { display: none; } .sb-stage.two .sb-lane { display: flex; flex-direction: column; } .sb-stage.two .sb-head { min-height: 54px; gap: 6px; } .sb-stage.two .sb-who { width: 76px; } .sb-stage.two .sb-char { width: 42px; height: 47px; } .sb-stage.two .sb-lane h4 { margin-bottom: 2px; } .sb-stage.two .sb-shelf { margin-top: 5px; } .sb-stage.two .sb-say { font-size: 13px; padding: 5px 8px; margin: 0; }
/* a track: stations in a row, one at work, and the card being filled in */
.sb-track { position: relative; }
.sb-clock { position: absolute; right: 0; top: 0; margin: 0; font: 700 15px/1 var(--mono); font-variant-numeric: tabular-nums; background: var(--ink); color: var(--paper); padding: 5px 8px; border-radius: 4px; z-index: 2; }
.sb-clock span { font: 600 10px/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; opacity: .8; margin-right: 4px; }
@media (min-width: 701px) { .sb-clock + .sb-stations { margin-right: 215px; } }
.sb-stations { list-style: none; margin: 0; padding: 0 0 4px; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; position: relative; }
.sb-stations::before { content: ""; position: absolute; left: 6%; right: 6%; top: 38px; border-top: 2px dotted var(--line-2); }
.sb-stations li { position: relative; text-align: center; font-size: 12px; line-height: 1.25; color: var(--ink-2); padding: 2px 2px 4px; border-bottom: 3px solid transparent; }
.sb-stations li .sb-char { background: var(--paper); opacity: .5; }
.sb-stations li.done .sb-char { opacity: .8; }
.sb-stations li.on { color: var(--ink); border-bottom-color: var(--focus); } .sb-stations li.on .sb-char { opacity: 1; }
.sb-stations b { display: block; font-size: 12.5px; color: inherit; } .sb-stations small { display: block; font-size: 11px; }
.sb-says { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; } .sb-says .sb-say { margin: 0; max-width: 70ch; }
.sb-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; margin-top: 8px; }
.sb-card { background: var(--surface); border: 1.5px solid var(--ink); border-radius: 6px; padding: 7px 10px 8px; min-width: 0; }
.sb-card.l-hypothesis { border-style: dashed; }
.sb-card.s-superseded { border-color: var(--line-2); color: var(--ink-2); } .sb-card.s-superseded p { text-decoration: line-through; }
.sb-card h5 { margin: 0 0 4px; font: 700 12px/1.4 var(--sans); color: var(--ink-2); } .sb-card h5 em { font-style: normal; text-transform: uppercase; letter-spacing: .05em; font-size: 10px; background: var(--surface-2); padding: 2px 4px; border-radius: 3px; }
.sb-card p { margin: 0 0 4px; font-size: 13.5px; line-height: 1.3; }
.sb-card dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2px 14px; }
.sb-card dl div { display: flex; gap: 6px; font-size: 12.5px; line-height: 1.3; border-top: 1px solid var(--line); padding: 1px 0; min-width: 0; }
.sb-card dt { flex: none; width: 76px; color: var(--ink-2); } .sb-card dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sb-card dl div.new dd { font-weight: 700; } .sb-card dl div.new dt::after { content: " (new)"; color: var(--focus); }
.sb-id { font: 700 12px/1 var(--mono); margin-right: 6px; }
.sb-lbl { display: inline-block; font: 700 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 3px 5px; border-radius: 3px; margin-right: 6px; background: var(--surface-2); color: var(--ink-2); }
.sb-lbl.l-fact { background: var(--ok-soft); color: var(--ok); } .sb-lbl.l-evidence { background: var(--sent-soft); color: var(--sent); }
.sb-lbl.l-hypothesis { background: transparent; color: var(--ink); border: 1px dashed var(--ink); }
.sb-stage:not(.still) .sb-card dl div.enter { animation: sb-pop .45s ease-out both; }
@media (max-width: 700px) { .sb-stations li .sb-char { width: 46px; height: 52px; margin: 0 auto; } .sb-stations b { font-size: 10px; } .sb-stations small { display: none; } .sb-stations::before { top: 26px; } .sb-clock { position: static; display: inline-block; margin-bottom: 6px; font-size: 13px; } .sb-card dt { width: 78px; } }
/* movement: only when the stage is not .still (reduced motion, or a step backwards) */
@keyframes sb-progress { to { width: 100%; } }
@keyframes sb-pop { from { opacity: 0; transform: translateY(5px) scale(.96); } }
@keyframes sb-enter { from { opacity: 0; transform: translateY(-16px); } }
@keyframes sb-squash { from { transform: scaleY(4.5); opacity: .3; } }
@keyframes sb-arrive { from { transform: translateX(-70%); opacity: 0; } }
@keyframes sb-read { from { background-color: var(--surface); border-color: var(--line-2); } 45% { background-color: var(--focus); } }
@keyframes sb-reuse { from { opacity: .25; } }
.sb-stage:not(.still) .sb-b.enter { animation: sb-enter .45s ease-out both; }
.sb-stage:not(.still) .sb-b.enter.s-summary { animation: sb-squash .9s cubic-bezier(.2, .8, .2, 1) both; transform-origin: 50% 50%; }
.sb-stage:not(.still) .sb-got.arrive { animation: sb-arrive .6s cubic-bezier(.2, .7, .2, 1) both; }
.sb-stage:not(.still) .sb-got.arrive .r-read { animation: sb-read .5s ease-out both; animation-delay: calc(.6s + var(--i) * .16s); }
.sb-stage:not(.still) .sb-got.arrive .r-cached { animation: sb-reuse .3s ease-out both; animation-delay: .6s; }
.sb-stage:not(.still) .sb-shelf li.enter { animation: sb-pop .45s ease-out both; }
@media (prefers-reduced-motion: reduce) { .sb *, .sb *::before { animation: none !important; transition: none !important; } }

@media (max-width: 700px) {
  .sb { --U: 20px; --cap: 30px; padding: 10px 10px 10px; }
  .sb-title h2 { font-size: 19px; }
  .sb-stage { padding: 8px; }
  .sb-controls { float: none; margin: 6px 0 0; position: sticky; bottom: 0; z-index: 6; background: var(--surface); padding: 7px 0; border-top: 1px solid var(--line); } .sb-controls button { flex: 1 1 auto; }
  .sb-title .meta { font-size: 13px; } .sb-progress { margin: 8px 0 0; }
  .sb-side { display: contents; } .sb-left { grid-area: left; } .sb-count { grid-area: count; }
  .sb-side .sb-shelf { grid-area: count; }
  .sb-count { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 5px; } .sb-bars { margin-top: 0; }
  .sb-stage.two .sb-head { min-height: 124px; flex-direction: column; } .sb-stage.two .sb-who { width: auto; }
  .sb-cols, .sb-cols.has-door { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "left left" "centre right" "held got" "count count"; gap: 6px 10px; }
  .sb-cols.has-door { grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); grid-template-areas: "left left left" "centre . right" "held door got" "count count count"; column-gap: 4px; }
  .sb-cols.no-left.has-door { grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); }
  .sb-left.sb-head { flex-direction: row; min-height: 80px; }
  .sb-head { flex-direction: column; gap: 2px; min-height: 136px; }
  .sb-who { width: auto; display: flex; align-items: center; gap: 5px; text-align: left; }
  .sb-left .sb-who { flex-direction: column; gap: 0; width: 64px; text-align: center; }
  .sb-char { width: 60px; height: 68px; margin: 0; }
  .sb-say { font-size: 12.5px; padding: 5px 7px; margin-top: 0; }
  .sb-b { font-size: 10.5px; padding: 0 4px; gap: 3px; } .sb-b i { display: none; } .sb-b em { font-size: 8.5px; padding: 2px 3px; } .sb-b.tall b { white-space: normal; }
  .sb-cap { font-size: 10px; }
  .sb-meters dt { font-size: 10.5px; } .sb-meters dd { font-size: 16px; }
  .sb-caption { font-size: 15.5px; min-height: 8.6em; }
  .sb-scenes { margin-left: 0; width: 100%; }
  .sb-controls button, .sb-more button { padding: 10px 10px; } .sb-scenes button { width: 34px; padding: 9px 0; }
}
