/* Gaffo AI: the editing-suite kit. Our own interface language (not a copy of any real app): rounded panels with
   title bars and tiny window buttons, track lanes, a monitor with safe areas, effect rows with keyframes, a layer stack,
   a graph editor and the docked Gaffo panel. Every fragment root carries data-ui. */

.ui { font: 500 var(--t-ui)/1.3 var(--f-text); color: var(--ink-2); letter-spacing: 0; -webkit-user-select: none; user-select: none; }
.ui :is(h1, h2, h3) { letter-spacing: -0.03em; }

/* ---------- window / panel ---------- */
.win { --fw: 3px; --fc: #3a3f49; background: var(--panel); border: 0; overflow: hidden; display: flex; flex-direction: column; min-width: 0;
  box-shadow: 0 calc(var(--fw) * -1) 0 0 var(--fc), 0 var(--fw) 0 0 var(--fc), calc(var(--fw) * -1) 0 0 0 var(--fc), var(--fw) 0 0 0 var(--fc), 8px 8px 0 0 rgb(0 0 0 / .5); }
.win-bar { display: flex; align-items: center; gap: 10px; height: 28px; padding: 0 6px 0 10px; flex: none;
  background: var(--wc, var(--panel-3)); border-bottom: 2px solid #0b0c0f; }
.win-bar .t { font: 400 var(--t-label)/1 var(--f-pixel); text-transform: uppercase; letter-spacing: .04em; color: var(--wt, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-font-smoothing: none; padding-top: 1px; }
.win-bar .px-label { margin-left: auto; }
.win-btns { display: flex; gap: 3px; margin-left: auto; }
.win-bar .px-label + .win-btns { margin-left: 8px; }
.win-btns i { width: 12px; height: 12px; background: var(--yellow); box-shadow: inset -2px -2px 0 0 rgb(0 0 0 / .3), inset 2px 2px 0 0 rgb(255 255 255 / .4); }
.win-btns i:nth-child(1) { background: var(--green); } .win-btns i:nth-child(3) { background: var(--pink); }
.win-tabs { display: flex; height: 26px; background: var(--panel-2); border-bottom: 1px solid var(--edge); }
.win-tabs span { padding: 0 12px; display: grid; place-items: center; font-size: .75rem; color: var(--ink-3); border-right: 1px solid var(--edge); white-space: nowrap; }
.win-tabs span.on { color: var(--ink); background: var(--panel); box-shadow: inset 0 3px 0 var(--green); }
.win-body { position: relative; flex: 1; min-height: 0; }

/* ---------- program monitor ---------- */
.mon { display: flex; flex-direction: column; background: var(--panel); }
.mon-screen { position: relative; aspect-ratio: 16 / 9; background: #050607; overflow: hidden; }
.mon-screen .safe { position: absolute; border: 1px dashed rgb(238 241 244 / .14); pointer-events: none; }
.mon-screen .safe.action { inset: 5%; } .mon-screen .safe.title { inset: 10%; }
.mon-screen .cross { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); pointer-events: none; opacity: .25;
  background: linear-gradient(var(--ink), var(--ink)) 50% 0 / 1px 100% no-repeat, linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 1px no-repeat; }
.mon-bar { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 10px; border-top: 1px solid var(--edge); background: var(--panel-2); }
.mon-bar .tc { color: var(--green); font-size: .8125rem; }
.mon-bar .tc.dim { color: var(--ink-3); margin-left: auto; }
.transport { display: flex; gap: 4px; margin-inline: auto; }
.transport i { width: 24px; height: 20px; display: grid; place-items: center; background: var(--panel-3); border-radius: 0; }
.transport i::before { content: ""; border-style: solid; }
.transport i.play::before { border-width: 4px 0 4px 7px; border-color: transparent transparent transparent var(--ink); }
.transport i.back::before { border-width: 4px 6px 4px 0; border-color: transparent var(--ink-2) transparent transparent; }
.transport i.fwd::before { border-width: 4px 0 4px 6px; border-color: transparent transparent transparent var(--ink-2); }
.transport i.stop::before { width: 7px; height: 7px; border: 0; background: var(--ink-2); }

/* the picture inside the monitor: an interview, raw (the feed), with the finished edit (a take) wiping in over it,
   behind a neon line (demo-data.js MONITOR, suite.js monitor()) */
.scene { position: absolute; inset: 0; background: #050607; overflow: hidden; }
.scene video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* never the browser's own controls (shown without JavaScript, or a play button when iOS Low Power Mode blocks autoplay):
   the poster stays instead */
.scene video::-webkit-media-controls, .scene video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.scene .feed { transform-origin: 44% 30%; }
.scene[data-punch="1"] .feed { transform: scale(1.22); }
.scene .take { position: absolute; inset: 0; }
.scene .wipe-edge { position: absolute; inset: 0; opacity: 0; pointer-events: none;
  border-right: 2px solid var(--green); box-shadow: 10px 0 18px -8px rgb(0 255 133 / .8); }

/* ---------- timeline ---------- */
.tl { --head: 76px; --row: 30px; display: grid; grid-template-columns: var(--head) 1fr; background: var(--well); position: relative; }
.tl-ruler { grid-column: 2; position: relative; height: 26px; background: var(--panel-2); border-bottom: 1px solid var(--edge);
  background-image: repeating-linear-gradient(90deg, var(--edge-hi) 0 1px, transparent 1px 10%), repeating-linear-gradient(90deg, var(--edge) 0 1px, transparent 1px 2.5%);
  background-size: 100% 9px, 100% 5px; background-position: 0 100%, 0 100%; background-repeat: no-repeat; }
.tl-ruler .tick { position: absolute; top: 4px; font: 500 .625rem/1 var(--f-mono); color: var(--ink-3); transform: translateX(3px); }
.tl-ruler .beat { position: absolute; bottom: 1px; width: 8px; height: 8px; transform: translateX(-4px); background: var(--yellow-lo); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.tl-ruler .beat.on { background: var(--yellow); }
.tl-corner { grid-column: 1; grid-row: 1; height: 26px; display: flex; align-items: center; padding: 0 8px; background: var(--panel-2); border-bottom: 1px solid var(--edge); border-right: 1px solid var(--edge); }
.tl-corner .tc { color: var(--green); font-size: .625rem; letter-spacing: -.02em; }
.tl-heads { grid-column: 1; display: grid; grid-auto-rows: var(--row); background: var(--panel); border-right: 1px solid var(--edge); }
.tl-head { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; border-bottom: 1px solid var(--edge); }
.tl-head b { font: 700 .6875rem/1 var(--f-mono); color: var(--ink); width: 20px; }
.tl-head .sw { width: 12px; height: 12px; border: 1px solid var(--edge-hi); border-radius: 0; background: var(--panel-2); }
.tl-head .sw.on { background: var(--green-lo); border-color: var(--green); }
.tl-head.sep { border-bottom: 2px solid var(--edge-hi); }
.tl-lanes { grid-column: 2; position: relative; display: grid; grid-auto-rows: var(--row); overflow: hidden; }
.tl-lane { position: relative; border-bottom: 1px solid var(--edge); }
.tl-lane.sep { border-bottom: 2px solid var(--edge-hi); }
.clip { position: absolute; top: 3px; bottom: 3px; left: calc(var(--s) * 1%); width: calc(var(--w) * 1%); border-radius: 0;
  background: var(--clip-v); border: 0; box-shadow: inset -2px -2px 0 0 rgb(0 0 0 / .28), inset 2px 2px 0 0 rgb(255 255 255 / .28); overflow: hidden;
  font: 700 .625rem/1 var(--f-text); color: var(--ink-dark); padding: 5px 6px; white-space: nowrap; transform-origin: left center; }
.clip.a { background: var(--clip-a); padding: 0; }
.clip.t { background: var(--clip-t); }
.clip.y { background: var(--clip-y); }
.clip.g { background: var(--clip-g); }
.clip.cut { background: repeating-linear-gradient(135deg, rgb(255 92 138 / .55) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 2px var(--pink); }
.clip .wave { position: absolute; inset: 2px 2px; display: flex; align-items: center; gap: 1px; }
.clip .wave i { flex: 1; min-width: 1px; height: calc(var(--h) * 1%); background: rgb(4 20 11 / .55); }
.playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; z-index: 4; pointer-events: none; will-change: transform; }
.playhead::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--yellow); }
.playhead::after { content: ""; position: absolute; top: 0; left: -6px; width: 12px; height: 14px; background: var(--yellow); clip-path: polygon(0 0, 100% 0, 100% 66%, 75% 66%, 75% 83%, 58% 83%, 58% 100%, 42% 100%, 42% 83%, 25% 83%, 25% 66%, 0 66%); }

/* ---------- effect controls ---------- */
.fx { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); background: var(--panel); }
.fx-row { display: contents; }
.fx-row > * { height: 26px; display: flex; align-items: center; border-bottom: 1px solid var(--edge); min-width: 0; }
.fx-name { gap: 7px; padding: 0 8px; color: var(--ink-2); white-space: nowrap; }
.fx-name.grp { color: var(--ink); font-weight: 600; }
.fx-name .tw { width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 5px; border-color: transparent transparent transparent var(--ink-3); }
.fx-name .tw.open { transform: rotate(90deg); }
.fx-name .val { margin-left: auto; color: var(--green-hi); font: 500 .75rem/1 var(--f-mono); text-decoration: underline dotted rgb(157 255 207 / .5); text-underline-offset: 3px; }
.stopwatch { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink-3); position: relative; flex: none; }
.stopwatch::before { content: ""; position: absolute; left: 50%; top: 1px; width: 1.5px; height: 4px; background: var(--ink-3); transform: translateX(-50%); }
.stopwatch::after { content: ""; position: absolute; left: 50%; top: -4px; width: 4px; height: 2px; background: var(--ink-3); transform: translateX(-50%); }
.stopwatch.on { border-color: var(--green); } .stopwatch.on::before, .stopwatch.on::after { background: var(--green); }
.fx-keys { position: relative; background: var(--well); border-left: 1px solid var(--edge); }
.kf { position: absolute; top: 50%; left: calc(var(--x) * 1%); width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--ink-2); rotate: 45deg; }
.kf.on { background: var(--yellow); }
.kf.ease { border-radius: 50% 0 50% 0; }

/* ---------- layer stack with switches ---------- */
.layers { background: var(--panel); }
.layer { display: grid; grid-template-columns: 18px 18px 18px 22px minmax(0, 1fr) 18px 18px 18px; align-items: center; gap: 2px; height: 28px; padding: 0 6px; border-bottom: 1px solid var(--edge); }
.layer.sel { background: #1f2a26; box-shadow: inset 2px 0 0 var(--green); }
.layer .n { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.layer .idx { font: 500 .6875rem/1 var(--f-mono); color: var(--ink-3); text-align: right; padding-right: 4px; }
.sw-i { width: 14px; height: 14px; display: block; justify-self: center; color: var(--ink-3); }
.sw-i.on { color: var(--green); }
.sw-i svg { width: 14px; height: 14px; display: block; }

/* ---------- graph editor ---------- */
.graph { position: relative; background: var(--well); }
.graph svg { width: 100%; height: 100%; display: block; }
.graph .grid line { stroke: var(--edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph .curve { fill: none; stroke: var(--green); stroke-width: 2; vector-effect: non-scaling-stroke; }
.graph .handle { stroke: var(--chrome-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph .knob { fill: var(--chrome-2); }

/* ---------- the Gaffo panel ---------- */
.gp { background: var(--panel); display: flex; flex-direction: column; min-width: 0; }
.gp-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--edge); }
.gp-head .bolt-slot, .gp-head > svg { width: 20px; height: 20px; flex: none; }
.gp-head b { color: var(--ink); font: 700 .875rem/1 var(--f-display); letter-spacing: -0.01em; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 0; font: 600 .6875rem/1 var(--f-text); color: var(--ink-2); background: var(--panel-3); border: 1px solid var(--edge-hi); white-space: nowrap; }
.pill.model::before { content: ""; width: 6px; height: 6px; background: var(--yellow); }
.credits { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font: 500 .6875rem/1 var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.credits::before { content: ""; width: 12px; height: 12px; flex: none; image-rendering: pixelated; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23c99a12' d='M2 0h4v1h1v1h1v4H7v1H6v1H2V7H1V6H0V2h1V1h1z'/%3E%3Cpath fill='%23ffd447' d='M2 1h4v1h1v4H6v1H2V6H1V2h1z'/%3E%3Cpath fill='%23fff3c4' d='M2 2h1v3H2z'/%3E%3C/svg%3E") center / 100% no-repeat; }
.credits b { color: var(--yellow); font: inherit; }
.gp-chat { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 10px; overflow: hidden; min-height: 0; }
.msg { max-width: 92%; padding: 8px 10px; border-radius: 0; font-size: .78rem; line-height: 1.4; color: var(--ink); }
.msg.you { align-self: flex-end; background: var(--field-2); color: var(--ink); box-shadow: inset -2px -2px 0 0 rgb(0 0 0 / .3), 0 0 0 2px var(--green-deep); }
.msg.gaffo { align-self: flex-start; background: transparent; padding-left: 0; color: var(--ink-2); }
.steps { list-style: none; display: grid; gap: 5px; }
.step { display: flex; gap: 8px; align-items: flex-start; font-size: .75rem; color: var(--ink-3); }
.step i { flex: none; width: 12px; height: 12px; margin-top: 1px; border: 1.5px solid var(--edge-hi); border-radius: 0; position: relative; }
.step.run { color: var(--ink); } .step.run i { border-color: var(--green); }
.step.run i::after { content: ""; position: absolute; inset: 2px; background: var(--green); animation: rec .8s steps(1) infinite; }
.step.ok { color: var(--ink-2); } .step.ok i { border-color: var(--green); background: var(--green); }
.step.ok i::after { content: ""; position: absolute; left: 3px; top: 0; width: 3px; height: 6px; border: solid var(--green-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step .cost { margin-left: auto; white-space: nowrap; padding-left: 6px; font: 500 .6875rem/1 var(--f-mono); color: var(--ink-3); }
.gp-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--edge); }
.gp-input .field-ui { flex: 1; min-height: 32px; display: flex; align-items: center; padding: 0 10px; background: var(--well); border: 1px solid var(--edge-hi); border-radius: 0; color: var(--ink); font-size: .78rem; box-shadow: inset 0 2px 0 rgb(0 0 0 / .35); overflow: hidden; white-space: nowrap; }
.gp-input .field-ui .caret { display: inline-block; width: 6px; height: 13px; margin-left: 1px; background: var(--green); animation: rec 1s steps(1) infinite; }
.gp-input .send { width: 32px; height: 32px; flex: none; border-radius: 0; background: var(--green); border: 0; box-shadow: inset 0 1px 0 rgb(255 255 255 / .4); position: relative; }
.gp-input .send::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -3px 0 0 -5px; border: solid var(--green-ink); border-width: 2px 2px 0 0; transform: rotate(45deg); }

@media (prefers-reduced-motion: reduce) {
  .step.run i::after, .gp-input .field-ui .caret { animation: none; }
}

/* ---------- round 3: workstation parts ---------- */
/* workspace bar along the top of the suite */
.ws-bar { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; background: #0d0f12; border-bottom: 2px solid #000; }
.ws-bar .ws-tab { padding: 0 12px; height: 100%; display: grid; place-items: center; font: 600 .75rem/1 var(--f-text); color: var(--ink-3); }
.ws-bar .ws-tab.on { color: var(--green); box-shadow: inset 0 -3px 0 var(--green); }
.ws-bar .ws-title { margin-left: auto; color: var(--ink-3); font: 500 .6875rem/1 var(--f-mono); white-space: nowrap; }
/* project panel: a bin with label-coloured items */
.proj { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.proj-search { margin: 8px; height: 26px; display: flex; align-items: center; padding: 0 8px; gap: 6px; background: var(--well); box-shadow: inset 2px 2px 0 0 rgb(0 0 0 / .5); color: var(--ink-3); font-size: .6875rem; }
.proj-search::before { content: ""; width: 8px; height: 8px; border: 2px solid var(--ink-3); }
.proj-row { display: grid; grid-template-columns: 12px 30px minmax(0, 1fr) auto; gap: 8px; align-items: center; height: 30px; padding: 0 8px; border-bottom: 1px solid var(--edge); font-size: .6875rem; color: var(--ink-2); white-space: nowrap; }
.proj-row .lab { width: 10px; height: 10px; background: var(--lab, var(--sky)); }
.proj-row .th { height: 18px; background: var(--lab, var(--sky)); opacity: .9; box-shadow: inset -2px -2px 0 0 rgb(0 0 0 / .3); }
.proj-row .th.bin { background: none; box-shadow: none; position: relative; }
.proj-row .th.bin::before { content: ""; position: absolute; left: 4px; right: 4px; top: 4px; bottom: 2px; background: var(--yellow); clip-path: polygon(0 0, 40% 0, 50% 20%, 100% 20%, 100% 100%, 0 100%); }
.proj-row .n { overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.proj-row .d { font: 500 .625rem/1 var(--f-mono); color: var(--ink-2); }
.proj-row.sel { background: var(--field-2); }
.proj-row.in-bin { padding-left: 22px; }
/* audio meters: two segmented columns that bounce in pixel steps */
.vu { display: flex; gap: 3px; padding: 6px 6px 6px 4px; background: #0d0f12; border-left: 2px solid #000; }
.vu i { position: relative; width: 8px; background: repeating-linear-gradient(0deg, #183326 0 3px, transparent 3px 4px); }
.vu i::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 100%;
  background: repeating-linear-gradient(0deg, transparent 0 0, transparent 0 0), repeating-linear-gradient(0deg, var(--green) 0 3px, transparent 3px 4px);
  -webkit-mask-image: linear-gradient(0deg, #000 0 100%); mask-image: linear-gradient(0deg, #000 0 100%);
  transform-origin: bottom; transform: scaleY(.55); animation: vu 1.1s steps(6) infinite alternate; }
.vu i:nth-child(2)::after { animation-duration: .9s; animation-delay: -.4s; }
.vu i::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22%; z-index: 1; background: repeating-linear-gradient(0deg, transparent 0 0, transparent 0 0), repeating-linear-gradient(0deg, var(--yellow) 0 3px, transparent 3px 4px); opacity: 0; animation: vu-peak 1.1s steps(1) infinite; }
@keyframes vu { 0% { transform: scaleY(.35); } 40% { transform: scaleY(.72); } 70% { transform: scaleY(.5); } 100% { transform: scaleY(.88); } }
@keyframes vu-peak { 0%, 80% { opacity: 0; } 85%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .vu i::after, .vu i::before { animation: none; } }
