/* The editor: a dark room. Sans throughout — this is interface, not article. */

@font-face { font-family: 'Instrument Sans'; src: url('/fonts/instrument-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/fonts/instrument-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('/fonts/instrument-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bg: #17181c;
  --bg2: #1e2026;
  --panel: #22242b;
  --edge: rgba(255,255,255,.09);
  --txt: #e7e5e1;
  --dim: rgba(231,229,225,.6);
  --faint: rgba(231,229,225,.36);
  --amber: #e09a4c;
  --amber-deep: #c67f33;
  --danger: #e5645a;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--txt);
  font-family: 'Instrument Sans', -apple-system, sans-serif;
  font-size: 14px; display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-bottom: 1px solid var(--edge); background: var(--bg2);
  flex: none;
}
.back { color: var(--dim); text-decoration: none; font-size: 18px; padding: 4px 8px; border-radius: 6px; }
.back:hover { background: rgba(255,255,255,.06); color: var(--txt); }
.title { flex: 1; min-width: 0; }
.title .t { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title .sub { display: block; font-size: 12px; color: var(--dim); }
.title .sub.busy { color: var(--amber); }
.title .sub.err { color: var(--danger); }
.actions { display: flex; gap: 8px; }
button.primary {
  background: var(--amber); color: #1c1408; font-weight: 600;
  padding: 8px 16px; border-radius: 8px; transition: background .12s, opacity .12s;
}
button.primary:hover { background: #ecab63; }
button.primary:disabled { opacity: .4; cursor: default; }
button.ghost {
  border: 1px solid var(--edge); padding: 8px 14px; border-radius: 8px; color: var(--dim);
}
button.ghost:hover { color: var(--txt); border-color: rgba(255,255,255,.22); }

/* room */
.room { flex: 1; display: flex; min-height: 0; }
.stagewrap { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 18px 18px 12px; gap: 10px; }

.stage {
  flex: 1; min-height: 0; position: relative; display: grid; place-items: center;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(255,255,255,.03), transparent),
    var(--bg);
  border: 1px solid var(--edge); border-radius: 12px; overflow: hidden;
}
/* The preview is built the way the compositor builds the render: a canvas the
   size of the cropped footage, the screen inset by the padding, the footage
   scaled and panned inside it. Sizes come from JS so the geometry matches. */
.frame { position: relative; background: transparent; }
.screen {
  position: relative; width: 100%; height: 100%; overflow: hidden; background: #000;
  border-radius: var(--vid-radius, 0px);
  box-shadow: var(--vid-shadow, none);
  transition: border-radius .15s, box-shadow .2s;
}
.zoomer { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.zoomer video#video { position: absolute; display: block; }
.cambubble {
  position: absolute; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,.45);
  pointer-events: none;
}
.cambubble video { width: 100%; height: 100%; object-fit: cover; display: block; }
.zoomtarget {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; pointer-events: none;
  border: 2px solid var(--amber); border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(224,154,76,.25);
}

.rendering {
  position: absolute; inset: 0; display: grid; place-items: center; gap: 0;
  background: rgba(18,19,23,.82); backdrop-filter: blur(3px);
}
.rendering p { color: var(--dim); margin-top: 12px; }
.spin {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: var(--amber);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* transport */
.transport { display: flex; align-items: center; gap: 12px; flex: none; }
.tbtn { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--panel); }
.tbtn:hover { background: #2a2d35; }
.tbtn svg { width: 16px; height: 16px; fill: var(--txt); }
.clock { font-family: var(--mono); font-size: 12.5px; color: var(--dim); min-width: 96px; }
.scrub { flex: 1; height: 22px; position: relative; cursor: pointer; display: flex; align-items: center; }
.scrub::before { content: ''; position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); }
.scrub .fill { position: absolute; left: 0; height: 5px; border-radius: 3px; background: var(--amber); width: 0; }
.scrub .head { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--amber); margin-left: -6px; left: 0; box-shadow: 0 0 0 3px rgba(0,0,0,.4); }

/* timeline */
.timeline { flex: none; border: 1px solid var(--edge); border-radius: 10px; background: var(--bg2); padding: 8px 10px 10px; }
.ruler { height: 16px; position: relative; margin: 0 0 6px 52px; font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.ruler i { position: absolute; top: 0; border-left: 1px solid rgba(255,255,255,.12); padding-left: 3px; height: 100%; font-style: normal; }
.track { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.track > span { width: 44px; font-size: 11px; color: var(--faint); text-align: right; flex: none; }
.track.clip .cutmarks {
  flex: 1; height: 26px; border-radius: 6px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #caa05c, #b8873f);
}
.cutmarks .cut { position: absolute; top: 0; bottom: 0; background: rgba(20,20,24,.55); border-left: 1px solid rgba(0,0,0,.4); border-right: 1px solid rgba(0,0,0,.4); }
.cutmarks .pending { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.cutmarks .pending { position: absolute; top: 0; bottom: 0; background: rgba(229,100,90,.65); }
.zoomlane { flex: 1; height: 26px; position: relative; border-radius: 6px; background: rgba(255,255,255,.05); }
.zoomlane .z {
  position: absolute; top: 2px; bottom: 2px; border-radius: 5px;
  background: linear-gradient(180deg, #6f78c7, #575f9e);
  border: 1px solid rgba(255,255,255,.2);
  cursor: grab; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9.5px; color: rgba(255,255,255,.85);
  overflow: hidden; white-space: nowrap;
}
.zoomlane .z:hover { filter: brightness(1.12); }
.zoomlane .z .h { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.zoomlane .z .h.l { left: 0; } .zoomlane .z .h.r { right: 0; }
.zoomlane .z .del { position: absolute; right: 2px; top: 0; bottom: 0; display: none; align-items: center; color: #fff; padding: 0 3px; }
.zoomlane .z:hover .del { display: flex; }
/* Automatic zooms sit quieter until you touch one, but they stay grabbable. */
.zoomlane.auto .z { opacity: .62; }
.zoomlane.auto .z:hover { opacity: 1; }
.zoomlane .hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 11px; }

.tools { display: flex; gap: 8px; flex: none; }
.tool { border: 1px solid var(--edge); border-radius: 8px; padding: 7px 12px; font-size: 12.5px; color: var(--dim); }
.tool:hover { color: var(--txt); border-color: rgba(255,255,255,.2); }
.tool.on { background: var(--amber); border-color: var(--amber); color: #1c1408; font-weight: 600; }

/* right panel */
.panel {
  width: 300px; flex: none; border-left: 1px solid var(--edge); background: var(--bg2);
  overflow-y: auto; padding: 16px;
}
.sect { margin-bottom: 26px; }
.sect h3 { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 8px; row-gap: 22px; margin-bottom: 22px; }
.sw {
  aspect-ratio: 1.35; border-radius: 8px; border: 2px solid transparent; position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  transition: transform .12s, border-color .12s;
}
.sw:hover { transform: translateY(-1px); }
.sw.on { border-color: var(--amber); }
.sw.none::after { content: '∅'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 15px; }
.sw b { position: absolute; left: 0; right: 0; bottom: -15px; font-size: 9.5px; font-weight: 500; color: var(--dim); text-align: center; white-space: nowrap; }

.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.row span { width: 64px; flex: none; }
.row b { width: 38px; text-align: right; font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--faint); }
.row input[type=range] { flex: 1; accent-color: var(--amber); }
.row.toggle { justify-content: space-between; }
.row.toggle span { width: auto; }
.row.toggle input { accent-color: var(--amber); width: 34px; height: 18px; }
/* Each button is a little screen with the camera bubble in one corner. */
.posrow { align-items: flex-start; }
.posrow > span { padding-top: 8px; }
.posgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 1; }
.posgrid button {
  aspect-ratio: 1.6; border: 1px solid var(--edge); border-radius: 5px; position: relative;
  background: rgba(255,255,255,.05); transition: border-color .12s, background .12s;
}
.posgrid button:hover { background: rgba(255,255,255,.1); }
.posgrid button::after {
  content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--dim); transition: background .12s;
}
.posgrid button[data-pos=top-left]::after { top: 5px; left: 5px; }
.posgrid button[data-pos=top-right]::after { top: 5px; right: 5px; }
.posgrid button[data-pos=bottom-left]::after { bottom: 5px; left: 5px; }
.posgrid button[data-pos=bottom-right]::after { bottom: 5px; right: 5px; }
.posgrid button.on { border-color: var(--amber); background: rgba(224,154,76,.14); }
.posgrid button.on::after { background: var(--amber); }
.fine { font-size: 12px; line-height: 1.55; color: var(--faint); }

/* transcript drawer */
.drawer {
  position: fixed; left: 0; right: 300px; bottom: 0; max-height: 42vh; z-index: 30;
  background: var(--panel); border-top: 1px solid var(--edge);
  display: flex; flex-direction: column;
  box-shadow: 0 -18px 40px rgba(0,0,0,.35);
}
.dhead { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--edge); }
.dhead b { font-size: 13px; }
.dhead .fine { flex: 1; }
.dhead .x { color: var(--dim); padding: 4px 8px; }
.dwords { overflow-y: auto; padding: 14px 18px 18px; line-height: 2.1; }
.dwords .w {
  padding: 2px 3px; border-radius: 4px; cursor: pointer; font-size: 14.5px;
}
.dwords .w:hover { background: rgba(255,255,255,.09); }
.dwords .w.sel { background: rgba(224,154,76,.35); }
.dwords .w.cutp { background: rgba(229,100,90,.4); text-decoration: line-through; opacity: .7; }

/* export modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10,10,12,.6); }
.mbox {
  width: min(440px, 92vw); background: var(--panel); border: 1px solid var(--edge);
  border-radius: 14px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.mbox h3 { font-size: 16px; margin-bottom: 18px; }
.mrow { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.mlabel { width: 84px; font-size: 13px; color: var(--dim); flex: none; }
.segset { display: flex; gap: 6px; flex-wrap: wrap; }
.segset button {
  border: 1px solid var(--edge); border-radius: 8px; padding: 7px 14px; font-size: 13px; color: var(--dim);
}
.segset button.on { background: rgba(224,154,76,.16); border-color: var(--amber); color: var(--txt); }
.mact { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

@media (max-width: 900px) {
  .room { flex-direction: column; overflow-y: auto; }
  .panel { width: auto; border-left: 0; border-top: 1px solid var(--edge); }
  .drawer { right: 0; }
}

/* The hidden attribute must always win over layout display rules. */
[hidden] { display: none !important; }
