/* d3 Studio: the Decision 2.0 Studio system (studio.css) plus multimodal input, the example gallery,
   media previews (lightbox, styled player) and the cached / live result source. */
:root { --media-r: 14px; --thumb-w: 188px; }

/* Hero: the model line under "Decision 3.0", as on the release banner. */
.hero-model { margin: 0 0 14px; color: #fffaf3; font: 650 clamp(30px,3.6vw,56px)/1.05 var(--font); letter-spacing: -.035em; filter: drop-shadow(0 6px 24px rgba(10,8,15,.35)); }
.hero-sub { font-size: clamp(16px,1.6vw,24px); color: #ece5de; }
.hero-copy > * { animation: rise .9s var(--ease) both; }
.hero-copy > :nth-child(2) { animation-delay: .06s; } .hero-copy > :nth-child(3) { animation-delay: .14s; }
.hero-copy > :nth-child(4) { animation-delay: .22s; } .hero-copy > :nth-child(5) { animation-delay: .3s; }
.hero-copy > :nth-child(6) { animation-delay: .38s; } .hero-copy > :nth-child(7) { animation-delay: .46s; }
.hero-art { animation: drift 28s ease-in-out infinite alternate; transform-origin: 60% 70%; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.07) translate(-1%, -.6%); } }

/* Inputs strip (replaces the size lineup). */
.modalities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 34px 0 0; padding: 0; list-style: none; }
.modality { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr); grid-template-rows: auto auto; gap: 4px 14px; align-items: center; padding: 18px 18px 18px 16px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: linear-gradient(180deg,rgba(255,255,255,.035),rgba(255,255,255,.012)); box-shadow: var(--shadow-card); animation: settle .7s var(--ease) both; animation-delay: calc(var(--i) * 80ms + 120ms); }
.modality::after { content: ""; position: absolute; inset: auto -30% -70% -30%; height: 120px; border-radius: 50%; border-top: 1px solid rgba(242,180,122,.35); background: radial-gradient(40% 60px at 50% 0, rgba(255,196,145,.08), transparent 75%); pointer-events: none; }
.modality-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: radial-gradient(circle at 34% 24%, rgba(255,246,233,.22), rgba(154,115,133,.18) 55%, rgba(48,37,63,.4)); box-shadow: inset 0 0 0 1px rgba(255,232,204,.28), 0 10px 24px -12px rgba(236,138,90,.6); }
.modality-icon svg { width: 22px; height: 22px; fill: none; stroke: #f6d1a4; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.modality-name { color: var(--ink); font-weight: 650; font-size: 16px; letter-spacing: -.015em; }
.modality-spec { color: var(--ink-3); font-size: 12.6px; line-height: 1.45; }

/* Studio card: the example gallery takes the scenario row. */
.studio-card { grid-template-areas: "bar" "actions" "scenarios" "note" "work"; }
.gallery { grid-area: scenarios; min-width: 0; padding: 4px 0 16px; border-bottom: 1px solid var(--line); }
.gallery-head { display: flex; align-items: baseline; gap: 14px; padding: 0 22px 10px; }
.example-gallery { display: flex; gap: 12px; min-width: 0; overflow-x: auto; scroll-behavior: smooth; scroll-snap-type: x proximity; scroll-padding-inline: 22px; padding: 4px 22px 6px; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); }
.example-gallery::-webkit-scrollbar { display: none; }
.example-card { position: relative; display: grid; gap: 8px; flex: none; width: var(--thumb-w); padding: 0; border: 0; background: none; color: var(--ink-2); text-align: left; cursor: pointer; scroll-snap-align: start; animation: settle .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.example-thumb { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--media-r); background: #120f18; box-shadow: inset 0 0 0 1px var(--line), 0 10px 26px -14px rgba(0,0,0,.7); transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.example-thumb img, .example-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), opacity .3s; }
.example-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(11,9,16,.55)); pointer-events: none; }
.example-card:hover .example-thumb { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-strong), 0 16px 34px -16px rgba(0,0,0,.8); }
.example-card:hover .example-thumb img { transform: scale(1.045); }
.example-card[aria-pressed="true"] .example-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent), 0 14px 34px -14px rgba(236,138,90,.55); }
.example-card:focus-visible { outline: none; }
.example-card:focus-visible .example-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.example-badge { position: absolute; left: 8px; bottom: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: rgba(11,9,16,.72); color: #f3eee8; font: 500 10.5px/1 var(--mono); letter-spacing: .04em; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.example-badge svg { width: 9px; height: 9px; fill: currentColor; }
.example-thumb.is-split { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--bg); }
.example-thumb.is-split img { position: static; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.example-title { padding: 0 2px; overflow: hidden; color: var(--ink); font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.example-meta { margin-top: -6px; padding: 0 2px; color: var(--ink-3); font: 500 10.5px/1.3 var(--mono); letter-spacing: .03em; }
.example-card[aria-pressed="true"] .example-title { color: var(--accent); }

/* Model chip (one model: no menu). */
.model-trigger[data-single="true"] { cursor: default; min-width: 196px; }
.model-gpu { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); color: var(--ink-2); font: 500 10.5px var(--mono); letter-spacing: .04em; white-space: nowrap; }
.model-gpu::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--grad); }

/* Media: stage, filmstrip, drop target. */
.media { position: relative; display: grid; gap: 10px; margin: 0 0 16px; }
.stage { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--media-r); background: radial-gradient(120% 90% at 50% 0%, #1b1624, #0d0b12 70%); box-shadow: inset 0 0 0 1px var(--line); isolation: isolate; }
.stage-item { position: absolute; inset: 0; animation: fade-in .35s var(--ease) both; }
.stage-backdrop { position: absolute; inset: -40px; z-index: -1; background-position: center; background-size: cover; filter: blur(34px) saturate(1.15) brightness(.55); transform: scale(1.1); }
.stage-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 14px; object-fit: contain; cursor: zoom-in; border: 0; background: none; }
.stage-image img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); }
.stage-tag { position: absolute; left: 12px; top: 12px; z-index: 2; transition: opacity .35s var(--ease); display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; background: rgba(11,9,16,.68); color: var(--ink-2); font: 500 10.5px/1 var(--mono); letter-spacing: .04em; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); pointer-events: none; }
.player[data-idle="true"]:not([data-paused="true"]) ~ .stage-tag { opacity: 0; }
.stage-zoom { position: absolute; right: 12px; top: 12px; z-index: 2; width: 32px; height: 32px; border-radius: 10px; background: rgba(11,9,16,.6); color: var(--ink); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stage-empty { position: absolute; inset: 10px; display: grid; place-content: center; justify-items: center; gap: 10px; border: 1.5px dashed rgba(242,180,122,.35); border-radius: 11px; color: var(--ink-3); font-size: 13px; text-align: center; cursor: pointer; transition: border-color .2s, background-color .2s; }
.stage-empty:hover, .stage-empty:focus-visible { border-color: var(--accent); background: var(--accent-wash); outline: none; }
.stage-empty b { color: var(--ink); font-weight: 600; font-size: 14px; }
.stage-empty small { font: 500 10.5px var(--mono); letter-spacing: .04em; }
.stage-empty svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.filmstrip { display: flex; gap: 8px; min-height: 0; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.filmstrip::-webkit-scrollbar { display: none; }
.media[data-count="0"] .filmstrip { display: none; }
.film { position: relative; flex: none; width: 92px; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: #120f18; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.film-show { position: absolute; inset: 0; padding: 0; overflow: hidden; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.film img, .film video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.film:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.film[aria-current="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
.film-kind { position: absolute; left: 5px; bottom: 5px; display: inline-flex; align-items: center; gap: 3px; height: 16px; padding: 0 5px; border-radius: 5px; background: rgba(11,9,16,.75); color: #f3eee8; font: 500 9px/1 var(--mono); }
.film-kind svg { width: 7px; height: 7px; fill: currentColor; }
.film-remove { position: absolute; right: 4px; top: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(11,9,16,.8); color: var(--ink); font-size: 13px; line-height: 1; opacity: 0; transition: opacity .15s; }
.film:hover .film-remove, .film:focus-within .film-remove, .film-remove:focus-visible { opacity: 1; }
.film-progress { position: absolute; inset: auto 6px 6px 6px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.film-progress i { display: block; width: calc(var(--p, 0) * 100%); height: 100%; background: var(--grad); transition: width .2s; }
.film.is-uploading img, .film.is-uploading video { opacity: .55; }
.film.is-failed { box-shadow: inset 0 0 0 1.5px var(--bad); }
.film-add { display: grid; place-content: center; justify-items: center; gap: 2px; border: 1.5px dashed var(--line-strong); background: transparent; box-shadow: none; color: var(--ink-3); font-size: 11px; }
.film-add:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.film-add b { font-size: 18px; font-weight: 400; line-height: 1; }
.film-hint { flex: none; align-self: center; max-width: 180px; padding-left: 4px; color: var(--ink-3); font: 500 10.5px/1.45 var(--mono); letter-spacing: .02em; }
.drop-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--media-r); background: rgba(24,17,26,.82); color: var(--accent); font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .15s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.input-pane.is-dragging .drop-overlay { opacity: 1; }
.context-label { margin-top: 2px; }
.state-input { height: 124px; min-height: 124px; max-height: 124px; font-size: 14px; }
.workbench { --panel-height: 860px; }
@keyframes fade-in { from { opacity: 0; } }

/* Styled video player (no native controls). */
.player { position: absolute; inset: 0; display: grid; place-items: center; background: #07060a; overflow: hidden; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #07060a; }
.player-big { position: absolute; left: 50%; top: 50%; z-index: 2; display: grid; place-items: center; width: 62px; height: 62px; margin: -31px 0 0 -31px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: rgba(20,14,26,.55); color: #fff; cursor: pointer; opacity: 0; transform: scale(.9); transition: opacity .2s, transform .25s var(--ease); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: none; }
.player-big svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.player[data-paused="true"] .player-big { opacity: 1; transform: none; pointer-events: auto; }
.player-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 3; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(14,11,19,.72); backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%); opacity: 0; transform: translateY(6px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.player:hover .player-bar, .player:focus-within .player-bar, .player[data-paused="true"] .player-bar, .player[data-idle="false"] .player-bar { opacity: 1; transform: none; }
.player-btn { display: grid; place-items: center; flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; transition: background-color .15s; }
.player-btn:hover { background: rgba(255,255,255,.1); }
.player-btn svg { width: 15px; height: 15px; fill: currentColor; }
.player-track { position: relative; flex: 1; height: 22px; cursor: pointer; touch-action: none; }
.player-track::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.16); }
.player-fill { position: absolute; left: 0; top: 9px; height: 4px; width: calc(var(--t, 0) * 100%); border-radius: 4px; background: var(--grad); }
.player-knob { position: absolute; top: 5px; left: calc(var(--t, 0) * 100%); width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff6ea; box-shadow: 0 1px 4px rgba(0,0,0,.4); transform: scale(0); transition: transform .15s; }
.player-track:hover .player-knob, .player-track:focus-visible .player-knob, .player-track.is-seeking .player-knob { transform: none; }
.player-track:focus-visible { outline: none; }
.player-time { flex: none; min-width: 74px; color: var(--ink-2); font: 500 10.5px var(--mono); text-align: center; font-variant-numeric: tabular-nums; }

/* Lightbox. */
.lightbox { width: min(1180px, calc(100vw - 40px)); max-width: none; max-height: calc(100vh - 40px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(14,11,19,.96); }
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; animation: pop-in .22s var(--ease); }
.lightbox::backdrop { background: rgba(6,5,9,.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lightbox-frame { --h: min(76vh, 820px); position: relative; display: grid; place-items: center; height: var(--h); background: radial-gradient(120% 90% at 50% 0%, #1b1624, #08070b 70%); }
.lightbox-frame img { max-width: calc(100% - 48px); max-height: calc(var(--h) - 48px); object-fit: contain; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.55); animation: fade-in .25s var(--ease); }
.lightbox-frame .player { position: absolute; inset: 0; }
.lightbox-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 20px; border-top: 1px solid var(--line); }
.lightbox-caption { min-width: 0; overflow: hidden; color: var(--ink-2); font: 500 11.5px var(--mono); letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-nav { display: flex; gap: 4px; }
.lightbox-nav .icon-button { width: 34px; height: 34px; font-size: 22px; }

/* Result source: precomputed (cache) or live (the GPU worker). */
.source-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; margin-left: auto; padding: 0 9px; border-radius: 999px; font: 600 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; animation: fade-in .3s var(--ease); }
.source-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.source-chip[data-source="cache"] { border: 1px solid rgba(242,180,122,.35); background: var(--accent-wash); color: var(--accent); }
.source-chip[data-source="cache"]::before { background: var(--accent); }
.source-chip[data-source="live"] { border: 1px solid rgba(127,216,179,.35); background: rgba(127,216,179,.08); color: var(--ok); }
.source-chip[data-source="live"]::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(127,216,179,.16); }
.timing { gap: 26px; }
.metric b { font-size: 14px; }
.decision.has-error { border-color: rgba(226,101,124,.35); }
.decision-error { margin: 0; color: var(--ink-2); font-size: 12.6px; }
.decision-error b { color: var(--bad); font-weight: 600; }

/* Model section. */
.model-sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; gap: 22px; margin-top: 34px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,.012)); }
.facts > div { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.facts > div:nth-child(odd):not(.facts-link) { border-right: 1px solid var(--line-soft); }
.facts dt { color: var(--accent); font: 500 10px/1.5 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.facts dd { margin: 5px 0 0; color: var(--ink); font-size: 14px; line-height: 1.45; }
.facts-link { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; border-bottom: 0 !important; }
.quickstart { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: rgba(8,7,11,.55); }
.quickstart-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--line-soft); }
.quickstart pre { margin: 0; padding: 16px 18px 18px; overflow: auto; color: var(--ink-2); font-size: 12.6px; line-height: 1.65; }
.quickstart .k { color: #f0a46c; } .quickstart .s { color: #b9d6a8; } .quickstart .c { color: var(--idle); }

/* Responsive. */
@media (max-width: 900px) {
  .modalities { grid-template-columns: minmax(0, 1fr); }
  .model-sheet { grid-template-columns: minmax(0, 1fr); }
  .workbench { --panel-height: 760px; }
  .gallery-head, .example-gallery { padding-left: 16px; padding-right: 16px; }
  .example-gallery { scroll-padding-inline: 16px; }
  .model-gpu { display: none; }
}
@media (max-width: 560px) {
  :root { --thumb-w: 150px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts > div:nth-child(odd):not(.facts-link) { border-right: 0; }
  .hero-model { font-size: clamp(26px, 8vw, 40px); }
  .lightbox-frame { --h: 62vh; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art { animation: none; }
}
