/* Video editor — a dark studio inside the light site. Colours come from the tokens in app.css. */

@font-face {
  font-family: "Inter Editor";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/editor/inter-regular.ttf") format("truetype");
}
@font-face {
  font-family: "Inter Editor";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/editor/inter-bold.ttf") format("truetype");
}
@font-face {
  font-family: "Inter Editor";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/editor/inter-italic.ttf") format("truetype");
}
@font-face {
  font-family: "Source Serif Editor";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/editor/serif-regular.ttf") format("truetype");
}
@font-face {
  font-family: "Source Serif Editor";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/editor/serif-bold.ttf") format("truetype");
}
@font-face {
  font-family: "Bebas Editor";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/editor/display-regular.ttf") format("truetype");
}

.ed-pool { position: fixed; left: -20px; top: -20px; width: 2px; height: 2px; overflow: hidden; opacity: .01; pointer-events: none; }

/* ---------- page ---------- */
/* The editor is the page: it sits right under the sticky header, edge to edge, and takes the whole
   screen height so the workspace never has to scroll. The title and description follow it. */
.ed-hero { padding-top: var(--s-7); padding-bottom: var(--s-4); }  /* .wrap keeps the inline gutter */
.ed-hero__kicker { display: flex; align-items: center; gap: var(--s-2); font: 600 var(--fs-sm)/1 var(--font-body); color: var(--primary); text-transform: uppercase; letter-spacing: .08em; }
.ed-hero h1 { margin-bottom: var(--s-3); }
.ed-hero__badges { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: var(--s-5) 0 0; padding: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.ed-hero__badges span { display: inline-flex; align-items: center; gap: var(--s-2); }
.ed-hero__badges .icon { color: var(--primary); }
.ed-info { padding-block: var(--s-8); }
.ed-info h2 { margin-top: var(--s-7); }
.ed-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: step; }
.ed-steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-4) var(--s-5); }
.ed-steps strong { display: block; font-family: var(--font-head); font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.ed-steps p { color: var(--ink-2); font-size: var(--fs-sm); margin: 0; }
.ed-feat { margin: 0; padding-left: var(--s-5); color: var(--ink-2); display: grid; gap: var(--s-2); max-width: 80ch; }
.ed-links { margin: 0; padding-left: var(--s-5); display: grid; gap: var(--s-2); }
.ed-faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
.ed-faq summary { cursor: pointer; font-weight: 600; }
.ed-faq p { margin: var(--s-3) 0 0; color: var(--ink-2); }

/* ---------- workspace ---------- */
.ed {
  display: flex; flex-direction: column;
  height: clamp(560px, calc(100dvh - 70px), 1200px); min-height: 560px;
  width: 100%; margin: 0; border-radius: 0;
  background: var(--studio); color: var(--studio-ink);
  overflow: hidden; box-shadow: var(--shadow);
  border-block: 1px solid var(--studio-line);
}
.ed__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); background: var(--studio-2); border-bottom: 1px solid var(--studio-line);
}
.ed__brand { display: flex; align-items: center; gap: var(--s-3); min-width: 0; flex: 1; }
.ed__mark svg { width: 26px; height: 26px; display: block; }
/* Doubled class: app.css styles input[type="text"] and an attribute selector outranks a bare class. */
.ed .ed__name {
  min-width: 0; max-width: 320px; width: 260px; background: transparent; border: 1px solid transparent;
  color: var(--studio-ink); font: 600 var(--fs-sm)/1.4 var(--font-body); padding: 6px 8px; border-radius: var(--r-sm);
  box-shadow: none;
}
.ed .ed__name:hover { border-color: var(--studio-line); }
.ed .ed__name:focus { border-color: var(--studio-accent); outline: none; background: var(--studio-3); }
.ed__status { color: var(--studio-ink-2); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed__tools { display: flex; align-items: center; gap: var(--s-2); }

.ed-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  background: var(--studio-3); color: var(--studio-ink); border: 1px solid var(--studio-line);
  border-radius: var(--r-sm); padding: 7px 12px; font: 600 var(--fs-xs)/1.2 var(--font-body);
  cursor: pointer; min-height: 34px;
}
.ed-btn:hover { background: var(--studio-line); }
.ed-btn:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }
.ed-btn:disabled { opacity: .45; cursor: not-allowed; }
.ed-btn--icon { padding: 7px; min-width: 34px; }
.ed-btn--accent { background: var(--studio-accent); color: var(--studio-accent-ink); border-color: var(--studio-accent); }
.ed-btn--accent:hover { background: var(--studio-accent); filter: brightness(1.08); }
.ed-btn--wide { width: 100%; margin-bottom: var(--s-2); justify-content: flex-start; }
.ed-btn--file { position: relative; }
.ed-btn.is-on { border-color: var(--studio-accent); color: var(--studio-accent); }

.ed__body { display: flex; flex: 1; min-height: 0; }
.ed__rail {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s-2) 0;
  background: var(--studio-2); border-right: 1px solid var(--studio-line); width: 74px; flex: none;
}
.ed-tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px;
  background: none; border: 0; border-left: 2px solid transparent; color: var(--studio-ink-2);
  font: 600 10.5px/1.2 var(--font-body); cursor: pointer;
}
.ed-tab .icon { width: 19px; height: 19px; }
.ed-tab:hover { color: var(--studio-ink); }
.ed-tab.is-on { color: var(--studio-accent); border-left-color: var(--studio-accent); background: var(--studio-3); }

.ed__panel { width: 280px; flex: none; background: var(--studio-2); border-right: 1px solid var(--studio-line); overflow-y: auto; padding: var(--s-3); }
.ed-pane { display: grid; gap: var(--s-2); align-content: start; }
.ed-drop {
  border: 1px dashed var(--studio-line); border-radius: var(--r-md); padding: var(--s-4) var(--s-3);
  text-align: center; color: var(--studio-ink-2); cursor: pointer; background: var(--studio);
}
.ed-drop:hover, .ed-drop.is-over { border-color: var(--studio-accent); color: var(--studio-ink); }
.ed-drop .icon { width: 26px; height: 26px; color: var(--studio-accent); }
.ed-drop__title { margin: var(--s-2) 0 2px; font-weight: 600; color: var(--studio-ink); font-size: var(--fs-sm); }
.ed-drop__hint, .ed-drop__formats { margin: 0; font-size: 11.5px; line-height: 1.45; }
.ed-drop__formats { margin-top: var(--s-2); opacity: .8; }
.ed-empty { color: var(--studio-ink-2); font-size: var(--fs-xs); text-align: center; margin: var(--s-3) 0 0; }
.ed-lib { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.ed-lib li { display: grid; grid-template-columns: 52px 1fr; gap: var(--s-2); background: var(--studio-3); border: 1px solid var(--studio-line); border-radius: var(--r-sm); padding: 6px; }
.ed-lib__thumb { width: 52px; height: 32px; border-radius: 4px; background: var(--studio) center/cover no-repeat; display: grid; place-items: center; color: var(--studio-ink-2); overflow: hidden; }
.ed-lib__thumb .icon { width: 16px; height: 16px; }
.ed-lib__meta { min-width: 0; }
.ed-lib__name { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-lib__facts { display: block; color: var(--studio-ink-2); font-size: 11px; }
.ed-lib__actions { display: flex; gap: 4px; margin-top: 4px; }
.ed-lib__actions .ed-btn { min-height: 22px; padding: 2px 6px; font-size: 10.5px; }
.ed-lib li.is-active { border-color: var(--studio-accent); }

.ed-list { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: grid; gap: 4px; }
.ed-list button { width: 100%; text-align: left; background: var(--studio-3); border: 1px solid var(--studio-line); color: var(--studio-ink); border-radius: var(--r-sm); padding: 6px 8px; font-size: 12px; cursor: pointer; display: flex; justify-content: space-between; gap: var(--s-2); }
.ed-list button:hover { border-color: var(--studio-accent); }
.ed-list .ed-list__time { color: var(--studio-ink-2); font-variant-numeric: tabular-nums; flex: none; }
.ed-list .ed-list__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-note { color: var(--studio-ink-2); font-size: 11.5px; line-height: 1.5; margin: 0 0 var(--s-2); }
.ed-field { display: grid; gap: 4px; margin-bottom: var(--s-2); font-size: 11.5px; color: var(--studio-ink-2); }
.ed-field > span { font-weight: 600; letter-spacing: .02em; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.ed-field--split { grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.ed-field input[type=text], .ed-field input[type=number], .ed-field select,
.ed-field input[type=color], .ed-field input[type=range] {
  width: 100%; background: var(--studio); border: 1px solid var(--studio-line); color: var(--studio-ink);
  border-radius: var(--r-sm); padding: 6px 8px; font: 400 12px/1.3 var(--font-body); min-height: 30px;
}
.ed-field input[type=color] { padding: 2px; height: 30px; }
.ed-field input:focus, .ed-field select:focus { outline: none; border-color: var(--studio-accent); }
.ed-actions { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
.ed-field--row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.ed-field--row > span { flex: none; }
.ed-field__val { color: var(--studio-ink); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.ed-check { display: flex; align-items: center; gap: var(--s-2); font-size: 12px; color: var(--studio-ink); margin-bottom: var(--s-2); }
.ed-check input { accent-color: var(--studio-accent); }

/* ---------- stage ---------- */
.ed__stage { display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--studio); }
.ed-stage { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: var(--s-3) var(--s-3) 0; }
.ed-stage__frame {
  position: relative; flex: 1; min-height: 120px; display: grid; place-items: center;
  background: var(--studio-2); border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--studio-line);
}
.ed-stage__frame canvas { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 8px 30px rgba(0, 0, 0, .45); touch-action: none; }
.ed-stage__empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: var(--s-4); color: var(--studio-ink-2); font-size: var(--fs-sm); pointer-events: none; }
.ed-stage__bar { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; }
.ed-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--studio-ink-2); }
.ed-stage:fullscreen { background: var(--studio); padding: var(--s-4); }
.ed-stage:fullscreen .ed-stage__frame { border: 0; }

/* ---------- timeline ---------- */
.ed-tl { height: 46%; min-height: 200px; display: flex; flex-direction: column; border-top: 1px solid var(--studio-line); background: var(--studio-2); margin-top: var(--s-2); }
.ed-tl__bar { display: flex; align-items: center; gap: 4px; padding: 6px var(--s-2); border-bottom: 1px solid var(--studio-line); }
.ed-tl__hint { margin-left: auto; color: var(--studio-ink-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-tl__scroll { flex: 1; overflow: auto; position: relative; }
.ed-tl__inner { position: relative; min-height: 100%; min-width: 100%; --tl-head: 116px; }
.ed-ruler { position: sticky; top: 0; z-index: 4; height: 26px; background: var(--studio-2); border-bottom: 1px solid var(--studio-line); cursor: ew-resize; margin-left: var(--tl-head); }
.ed-playhead { margin-left: var(--tl-head); }
.ed-ruler span { position: absolute; top: 5px; font-size: 10px; color: var(--studio-ink-2); transform: translateX(3px); font-variant-numeric: tabular-nums; }
.ed-ruler i { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--studio-line); }
.ed-tracks { padding-bottom: var(--s-4); }
.ed-track { display: flex; border-bottom: 1px solid var(--studio-line); }
.ed-track__head { position: sticky; left: 0; z-index: 3; width: 116px; flex: none; background: var(--studio-2); border-right: 1px solid var(--studio-line); padding: 6px 6px 6px 8px; display: grid; gap: 3px; align-content: center; }
.ed-track__name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-track__btns { display: flex; gap: 2px; }
.ed-track__btns button { background: none; border: 0; color: var(--studio-ink-2); padding: 2px; cursor: pointer; border-radius: 3px; }
.ed-track__btns button:hover { color: var(--studio-ink); background: var(--studio-3); }
.ed-track__btns button .icon { width: 13px; height: 13px; }
.ed-track__lane { position: relative; flex: 1; background: var(--studio); min-height: 52px; }
.ed-track--audio .ed-track__lane { min-height: 42px; background: var(--studio); }

.ed-clip {
  position: absolute; top: 4px; bottom: 4px; border-radius: 5px; overflow: hidden; cursor: grab;
  background: var(--studio-3); border: 1px solid var(--studio-line); color: var(--studio-ink);
  display: flex; flex-direction: column; justify-content: flex-end; min-width: 14px; touch-action: none;
}
.ed-clip__thumb { position: absolute; inset: 0; background: center/cover no-repeat; opacity: .55; pointer-events: none; }
.ed-clip__label { position: relative; font-size: 10.5px; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.ed-clip__grip { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.ed-clip__grip--l { left: 0; }
.ed-clip__grip--r { right: 0; }
.ed-clip__grip:hover { background: var(--studio-accent); opacity: .5; }
.ed-clip.is-selected { border-color: var(--studio-accent); box-shadow: 0 0 0 1px var(--studio-accent) inset; }
.ed-clip.is-text { background: var(--studio-3); border-left: 3px solid var(--studio-accent); }
.ed-clip.is-audio { background: var(--studio-3); border-left: 3px solid var(--studio-warm); }
.ed-clip.is-drag { opacity: .7; cursor: grabbing; }
.ed-clip__fade { position: absolute; top: 0; bottom: 0; pointer-events: none; background: linear-gradient(to right, rgba(0, 0, 0, .55), transparent); }
.ed-clip__fade--out { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .55), transparent); }
.ed-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--studio-accent); pointer-events: none; z-index: 5; }
.ed-playhead::before { content: ''; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: var(--studio-accent); }

/* ---------- inspector ---------- */
.ed__side { width: 268px; flex: none; background: var(--studio-2); border-left: 1px solid var(--studio-line); overflow-y: auto; padding: var(--s-3); }
.ed-side__empty { color: var(--studio-ink-2); font-size: var(--fs-xs); text-align: center; margin-top: var(--s-5); }
.ed-insp__title { font-family: var(--font-head); font-size: var(--fs-sm); margin: 0 0 var(--s-3); display: flex; align-items: center; gap: var(--s-2); }
.ed-insp__title .icon { width: 15px; height: 15px; color: var(--studio-accent); }
.ed-insp__group { border-top: 1px solid var(--studio-line); padding-top: var(--s-2); margin-top: var(--s-3); }
.ed-insp__group > p { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--studio-ink-2); margin: 0 0 var(--s-2); }
.ed-insp textarea { width: 100%; min-height: 60px; resize: vertical; background: var(--studio); border: 1px solid var(--studio-line); color: var(--studio-ink); border-radius: var(--r-sm); padding: 6px 8px; font: 400 12px/1.45 var(--font-body); }
.ed-insp textarea:focus { outline: none; border-color: var(--studio-accent); }
.ed-insp .ed-btn { width: 100%; margin-bottom: 4px; }
.ed-insp__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }

/* ---------- export dialog ---------- */
.ed-dialog {
  border: 1px solid var(--studio-line); border-radius: var(--r-md); background: var(--studio-2);
  color: var(--studio-ink); padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 90px rgba(0, 0, 0, .5);
}
.ed-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.ed-dialog__head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--studio-line); }
.ed-dialog__head h2 { font-size: var(--fs-lg); margin: 0; color: var(--studio-ink); }
.ed-dialog__body { padding: var(--s-4); display: grid; gap: var(--s-2); }
.ed-dialog__foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--studio-line); }
.ed-progress { height: 6px; background: var(--studio-3); border-radius: 99px; overflow: hidden; }
.ed-progress span { display: block; height: 100%; width: 0; background: var(--studio-accent); transition: width .3s var(--ease); }
.ed-dialog__note { color: var(--studio-ink-2); font-size: 11.5px; margin: 0; }
.ed-dialog a.ed-btn { text-decoration: none; }
.ed-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  background: var(--studio-3); color: var(--studio-ink); border: 1px solid var(--studio-line);
  border-radius: var(--r-sm); padding: var(--s-2) var(--s-4); font-size: var(--fs-sm); box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}
.ed-toast--err { border-color: var(--studio-danger); color: var(--studio-danger); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .ed__panel { width: 236px; }
  .ed__side { width: 236px; }
  .ed__name { width: 180px; }
}
@media (max-width: 900px) {
  .ed { height: auto; min-height: 0; }
  .ed__body { flex-wrap: wrap; }
  .ed__rail { flex-direction: row; width: 100%; border-right: 0; border-bottom: 1px solid var(--studio-line); padding: 0; overflow-x: auto; }
  .ed-tab { flex-direction: row; gap: 6px; padding: 10px 12px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 11.5px; }
  .ed-tab.is-on { border-left-color: transparent; border-bottom-color: var(--studio-accent); }
  .ed__panel { width: 100%; max-height: 220px; border-right: 0; border-bottom: 1px solid var(--studio-line); }
  .ed__stage { width: 100%; flex: 1 1 100%; }
  .ed-stage__frame { min-height: 210px; }
  .ed-tl { height: auto; min-height: 230px; }
  .ed-tl__scroll { max-height: 260px; }
  .ed__side { width: 100%; border-left: 0; border-top: 1px solid var(--studio-line); max-height: 340px; }
  .ed__status { display: none; }
}
@media (max-width: 560px) {
  .ed { width: 100%; border-radius: 0; }
  .ed__tools .ed-btn span { display: none; }
  .ed__name { width: 120px; }
  .ed-track__head { width: 84px; }
  .ed-tl__inner { --tl-head: 84px; }
  .ed-tl__hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ed * { transition: none !important; animation: none !important; }
}

