/* Video Studio. Palette taken from the street: asphalt, kerb, lane paint, signals. */
@font-face {
  font-family: "Studio Display";
  src: url("/static/fonts/Montserrat-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

:root {
  --asphalt: #262a31;
  --tar: #1d2026;
  --kerb: #323741;
  --line: #4b525e;
  --paint: #f2efe6;
  --dust: #aab0ba;
  --lane: #ffe600;
  --go: #52d6a0;
  --brake: #ff6258;
  --display: "Studio Display", "Arial Black", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --r: 10px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--asphalt);
  color: var(--paint);
  font: 15px/1.5 var(--body);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h2, .brand { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0 0 10px; }
a { color: var(--lane); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-size: 22px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-right form { flex: none; }
.who { color: var(--dust); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--tar); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  appearance: none; background: none; border: 0; color: var(--dust);
  font: 600 13px var(--body); padding: 16px 4px 14px; cursor: pointer; position: relative;
}
.tabs button[aria-current="page"] { color: var(--paint); }
.tabs button[aria-current="page"]::before {
  content: ""; position: absolute; left: 22%; right: 22%; top: 0; height: 4px; background: var(--lane);
}
.count {
  display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--lane); color: #1a1a1a; font-size: 12px; font-weight: 700; line-height: 20px;
}

main { padding: 16px; max-width: 1180px; margin: 0 auto; }
.banner { background: var(--kerb); border-left: 4px solid var(--lane); padding: 10px 12px; border-radius: 4px; margin-bottom: 14px; }
.banner.bad { border-left-color: var(--brake); }
.hint { color: var(--dust); font-size: 13px; }
.error { color: var(--brake); }

.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--kerb); color: var(--paint); font: 600 14px var(--body); text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--dust); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--lane); border-color: var(--lane); color: #1a1a1a; }
.btn.go { background: var(--go); border-color: var(--go); color: #0d2a1f; }
.btn.danger { color: var(--brake); border-color: var(--brake); background: none; }
.btn.quiet { background: none; min-height: 36px; padding: 0 10px; color: var(--dust); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }

input, textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--tar); color: var(--paint); font: 15px var(--body);
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--lane); }
input[type="color"] { padding: 4px; width: 64px; }
label { display: block; font-size: 13px; color: var(--dust); margin-bottom: 12px; }
label > input, label > textarea, label > select { margin-top: 5px; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--paint); font-size: 15px; }

/* Recordings */
.upload { display: grid; gap: 10px; margin-bottom: 18px; }
.upload-btn { min-height: 56px; font-size: 16px; }
.import, .inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.videos, .plain, .hooks { list-style: none; margin: 0; padding: 0; }
.video { padding: 16px 0; border-top: 1px solid var(--line); }
.video-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.video-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.video-meta { color: var(--dust); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.video-meta span + span { margin-left: 12px; }
.video-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.stage-text { color: var(--dust); font-size: 13px; margin: 8px 0 0; }
.stage-text.bad { color: var(--brake); }

/* The road: four stages as lane segments. Done is solid paint, to do is a dashed centre line. */
.road { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.lane { font-size: 12px; color: var(--dust); }
.lane-bar {
  height: 8px; margin-bottom: 5px; border-radius: 2px; position: relative; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 18px);
}
.lane-fill { position: absolute; inset: 0 auto 0 0; background: var(--lane); border-radius: 2px; }
.lane.done { color: var(--paint); }
.lane.now { color: var(--lane); }
.road.failed .lane.now, .road.failed .lane.now .lane-fill { color: var(--brake); }
.road.failed .lane.now .lane-fill { background: var(--brake); }

.pill {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 16px;
  border: 1px solid var(--line); background: none; color: var(--paint); font: 600 13px var(--body); cursor: pointer;
}
.pill.review { border-color: var(--lane); color: var(--lane); }
.pill.approved { border-color: var(--go); color: var(--go); }
.pill[aria-pressed="true"] { background: var(--paint); color: #1a1a1a; border-color: var(--paint); }

.empty { color: var(--dust); padding: 28px 0; max-width: 46ch; }
.empty strong { display: block; color: var(--paint); font-family: var(--display); font-size: 20px; margin-bottom: 6px; }

/* Review */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.clips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.clip {
  appearance: none; border: 0; padding: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.clip-thumb {
  position: relative; aspect-ratio: 9 / 16; background: var(--tar); border-radius: var(--r); overflow: hidden;
  border: 2px solid transparent;
}
.clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip.approved .clip-thumb { border-color: var(--go); }
.clip.rejected .clip-thumb { border-color: var(--brake); opacity: .55; }
.clip-len {
  position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .72); padding: 1px 7px; border-radius: 4px;
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.clip-flag { position: absolute; left: 6px; top: 6px; background: var(--tar); padding: 1px 7px; border-radius: 4px; font-size: 12px; }
.clip-busy { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dust); font-size: 13px; padding: 8px; text-align: center; }
.clip-title { font-weight: 600; font-size: 14px; margin: 7px 0 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clip-sub { color: var(--dust); font-size: 12px; }

dialog {
  border: 0; padding: 0; background: var(--asphalt); color: var(--paint);
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.clip-view { display: grid; grid-template-rows: 46dvh minmax(0, 1fr); height: 100%; }
.player { background: #000; display: flex; justify-content: center; overflow: hidden; }
.player video { height: 46dvh; width: auto; max-width: 100%; background: #000; }
.clip-side { padding: 14px 16px 24px; overflow-y: auto; min-height: 0; }
.clip-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.clip-head h2 { margin: 0; }
.status-line { font-size: 13px; color: var(--dust); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

/* Hooks and settings */
.cols { display: grid; gap: 28px; }
.hooks li { padding: 12px 0; border-top: 1px solid var(--line); }
.hook-text { font-weight: 700; font-size: 16px; }
.hook-why { color: var(--dust); font-size: 13px; margin-top: 2px; }
.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.plain li > span { min-width: 0; overflow-wrap: anywhere; }
.plain small { display: block; color: var(--dust); }
#run-research { margin: 14px 0 6px; width: 100%; }
#tab-hooks h2 + .inline { margin-bottom: 6px; }
#tab-hooks .table-wrap { overflow-x: auto; }
#tab-hooks h2 { margin-top: 22px; }
#tab-hooks .cols > div > h2:first-child { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--dust); font-weight: 600; border-top: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.settings fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 16px 0 6px; }
.settings legend { font-family: var(--display); font-size: 17px; padding: 0 10px 0 0; }
.settings .pair { margin: 0; }
.settings .save { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); padding: 10px 0; background: var(--asphalt); }
.settings .save .btn { width: 100%; }
.panel { background: var(--kerb); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.panel .big { font-family: var(--display); font-size: 30px; line-height: 1.1; }
.stack .btn { width: 100%; }
.invite { background: var(--tar); border-radius: var(--r); padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; margin-top: 10px; }
.role { color: var(--lane); font-size: 12px; font-weight: 600; }

.upload-row { padding: 12px 0; border-top: 1px solid var(--line); }
.upload-row .lane-bar { margin-top: 8px; }

/* Sign-in and invite pages */
.gate { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.gate-card { width: 100%; max-width: 380px; }
.gate-card .brand { color: var(--lane); margin-bottom: 26px; }
.gate-card h1 { font-size: 30px; margin-bottom: 14px; }
.gate-card .btn { width: 100%; margin-top: 4px; }

@media (min-width: 820px) {
  body { padding-bottom: 0; }
  .tabs {
    position: static; display: flex; gap: 4px; padding: 0 16px; background: none; border-top: 0;
    border-bottom: 1px solid var(--line); max-width: 1180px; margin: 0 auto;
  }
  .tabs button { padding: 14px 16px; font-size: 14px; }
  .tabs button[aria-current="page"]::before { top: auto; bottom: -1px; left: 16px; right: 16px; }
  .top { max-width: 1180px; margin: 0 auto; border-bottom: 0; padding-bottom: 6px; }
  .who { max-width: none; }
  .upload { grid-template-columns: auto 1fr; align-items: center; }
  .upload-btn { padding: 0 28px; }
  .clips { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
  .cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; }
  dialog { width: min(980px, 94vw); height: min(760px, 92dvh); margin: auto; border-radius: 14px; }
  .clip-view { grid-template-rows: minmax(0, 1fr); grid-template-columns: auto minmax(0, 1fr); }
  .player video { height: min(760px, 92dvh); }
  .settings .save { bottom: 0; }
  .actions { grid-template-columns: repeat(4, auto); justify-content: start; }
}

@media (prefers-reduced-motion: no-preference) {
  .lane-fill { transition: width .6s ease; }
}
