/* css/clips-recorder.css — Clips: the filming screen, phone (C1, C2) and laptop (I).
 * See js/clips/clips-recorder.js and docs/projects/content-engine/BUILD.md §5a.
 * The approved artefact is the spec: docs/projects/content-engine/virals-research/index.html.
 * Every class here is .clr-*. Colours come from design-tokens.css where the app has them; the
 * camera's own ink, the red of the record button and the yellow of LOOK HERE are the artefact's. */

html.clr-lock,
html.clr-lock body { overflow: hidden !important; overscroll-behavior: none; }

.clr {
  --clr-ink: #0f1020;
  --clr-rec: #ef3b3b;
  --clr-look: #ffd84d;
  --clr-accent: var(--accent, #6a4cf1);
  --clr-accent-deep: var(--accent-deep, #4a32b8);
  --clr-good: #7fe0ae;
  --clr-display: "Bricolage Grotesque", Georgia, serif;
  --clr-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --clr-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --clr-cur: 28px;
  --clr-dim: 21px;
  --clr-slot: 42px;
  position: fixed;
  inset: 0;
  z-index: 100200;            /* above the corner tray, Help and Maya; it asks its own questions */
  background: #000;
  color: #fff;
  font: 16px/1.5 var(--clr-body);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.clr *, .clr *::before, .clr *::after { box-sizing: border-box; }
:where(.clr) button { font: inherit; color: inherit; margin: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
:where(.clr) button:disabled { cursor: default; opacity: .55; }
.clr button:focus-visible, .clr label:focus-within { outline: 3px solid var(--clr-look); outline-offset: 2px; }
.clr-i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.clr--laptop, .clr[data-screen="review"], .clr[data-screen="message"], .clr[data-screen="saving"] { background: var(--clr-ink); }

/* ── The camera ─────────────────────────────────────────────────────────────────────────────── */
.clr-cam {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1); background: #000;
  transition: filter .25s ease;
}
.clr.clr-is-hidden-me .clr-cam { filter: blur(26px) brightness(.4); transform: scaleX(-1) scale(1.12); }

/* ── The band: LOOK HERE, the part, the timer, three lines ──────────────────────────────────── */
.clr-band {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  background: rgba(10, 10, 22, .86);
  border-radius: 0 0 28px 28px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 24px 18px;
}
.clr-look {
  display: flex; justify-content: center; gap: 6px; margin-bottom: 8px;
  font: 600 13px/1.2 var(--clr-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--clr-look);
}
.clr-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px;
  font: 600 13px/1.3 var(--clr-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .6);
}
.clr-part { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clr-timer, .clr-frame-timer { display: inline-flex; align-items: center; gap: 6px; color: #ff7b7b; white-space: nowrap; visibility: hidden; }
.clr-timer-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clr-rec); flex: none; }
.clr[data-state="recording"] .clr-timer, .clr[data-state="paused"] .clr-timer,
.clr[data-state="recording"] .clr-frame-timer, .clr[data-state="paused"] .clr-frame-timer { visibility: visible; }
.clr[data-state="recording"] .clr-timer-dot { animation: clr-blink 1.2s ease-in-out infinite; }
.clr[data-state="paused"] .clr-timer-dot { background: rgba(255, 255, 255, .6); }

.clr-lines { position: relative; height: calc(var(--clr-slot) * 3); overflow: hidden; }
.clr-track { position: absolute; left: 0; right: 0; top: 0; transition: transform .45s cubic-bezier(.3, .7, .3, 1); will-change: transform; }
.clr-track.clr-is-instant, .clr-track.clr-is-instant .clr-line { transition: none; }
.clr-line {
  height: var(--clr-slot); display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font: 600 var(--clr-dim)/1.25 var(--clr-body); color: rgba(255, 255, 255, .22);
  transition: color .35s ease, font-size .35s ease;
}
.clr-line.clr-is-prev { color: rgba(255, 255, 255, .4); }
.clr-line.clr-is-next { color: rgba(255, 255, 255, .62); }
.clr-line.clr-is-cur { font-size: var(--clr-cur); font-weight: 700; color: #fff; }
/* The last line is a hint, at one size whatever the text size, so it always fits. */
.clr-line--hint { font-style: italic; font-weight: 500; font-size: 18px; }
.clr-line--hint.clr-is-cur { font-size: 20px; font-weight: 600; color: var(--clr-look); }

/* ── Overlays over the camera: the light check, the countdown ───────────────────────────────── */
.clr-over { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.clr-over > * { pointer-events: auto; }
.clr--phone .clr-over { top: 200px; bottom: 230px; }
.clr-card {
  max-width: 340px; display: grid; justify-items: center; gap: 12px; text-align: center;
  background: rgba(10, 10, 22, .9); border: 1px solid rgba(255, 255, 255, .12); border-radius: 18px; padding: 20px 20px 18px;
}
.clr-card > .clr-i { width: 30px; height: 30px; color: var(--clr-look); }
.clr-card--ok > .clr-i { color: var(--clr-good); }
.clr-card-t { margin: 0; font: 600 18px/1.35 var(--clr-body); }
.clr-count span {
  width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .45); border: 5px solid #fff;
  font: 800 72px/1 var(--clr-display); animation: clr-pop .9s ease-out both;
}

/* ── The controls ───────────────────────────────────────────────────────────────────────────── */
.clr-ctl {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: grid; gap: 16px;
  padding: 64px 8px calc(env(safe-area-inset-bottom, 0px) + 26px);
  background: linear-gradient(to top, rgba(0, 0, 0, .78) 60%, rgba(0, 0, 0, 0));
}
.clr-hint { text-align: center; font: 600 17px/1.3 var(--clr-body); color: rgba(255, 255, 255, .9); min-height: 0; }
.clr-hint:empty { display: none; }
.clr[data-state]:not([data-state="ready"]) .clr-hint { display: none; }
/* One row, as in the artefact: three labelled chips fit a 360px phone at this size. */
.clr-chips { display: flex; justify-content: center; gap: 6px; flex-wrap: nowrap; }
.clr-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 48px; flex: none;
  padding: 0 11px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff;
  font: 600 14px/1.2 var(--clr-body); white-space: nowrap;
}
.clr-chip .clr-i { width: 1.1em; height: 1.1em; }
.clr-chip.clr-is-on { background: #fff; color: var(--clr-ink); }
.clr-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.clr-side { display: flex; justify-content: center; }
.clr-cbtn {
  display: grid; justify-items: center; gap: 6px; min-width: 76px; padding: 0; border: 0; background: none;
  color: #fff; font: 600 15px/1.2 var(--clr-body);
}
.clr-cbtn-c { width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 22px; }

/* One slot, two buttons: Back before filming, Pause while filming. Redo part only while filming. */
.clr-slot-pause, .clr-slot-redo { display: none; }
.clr--phone[data-state="recording"] .clr-slot-pause, .clr--phone[data-state="paused"] .clr-slot-pause,
.clr--phone[data-state="recording"] .clr-slot-redo, .clr--phone[data-state="paused"] .clr-slot-redo { display: grid; }
.clr--phone[data-state="recording"] .clr-slot-back, .clr--phone[data-state="paused"] .clr-slot-back,
.clr--phone[data-state="saving"] .clr-slot-back { display: none; }

.clr-rec {
  width: 92px; height: 92px; border-radius: 50%; border: 5px solid #fff !important; background: rgba(0, 0, 0, .15);
  display: grid; place-items: center; padding: 0;
}
.clr-rec-dot { display: block; width: 66px; height: 66px; border-radius: 50%; background: var(--clr-rec); transition: all .18s ease; }
.clr[data-state="recording"] .clr-rec-dot, .clr[data-state="paused"] .clr-rec-dot,
.clr[data-state="saving"] .clr-rec-dot { width: 36px; height: 36px; border-radius: 9px; }
.clr[data-state="countdown"] .clr-rec-dot { width: 36px; height: 36px; border-radius: 9px; background: rgba(239, 59, 59, .6); }

/* ── Laptop (I): the script under the webcam, a tall 9:16 frame ─────────────────────────────── */
.clr-stage { position: absolute; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; }
.clr--laptop .clr-band {
  position: relative; width: min(700px, 92vw); text-align: center;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-top: 0;
  border-radius: 0 0 26px 26px; padding: 16px 34px 18px;
}
.clr--laptop .clr-look { margin-bottom: 6px; }
.clr--laptop .clr-line { justify-content: center; }
.clr-stage > .clr-back { position: absolute; left: 40px; top: 24px; }
.clr-part--top {
  position: absolute; right: 40px; top: 32px; max-width: 30vw;
  font: 600 13px/1.3 var(--clr-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .6);
}
.clr-frame {
  position: relative; height: calc(100% - 44px); max-height: 600px; aspect-ratio: 9 / 16; margin: 26px 0 18px;
  border-radius: 16px; overflow: hidden; background: #222; border: 2px solid rgba(255, 255, 255, .15);
}
.clr-frame .clr-over { padding: 14px; }
.clr-frame-timer {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  padding: 4px 10px; border-radius: 999px; background: rgba(15, 16, 32, .72); color: #fff;
  font: 600 14px/1.3 var(--clr-body);
}
.clr--laptop .clr-ctl { position: relative; padding: 0 20px 28px; background: none; gap: 12px; }
.clr--laptop[data-state]:not([data-state="ready"]) .clr-hint { display: block; visibility: hidden; }   /* no jump when filming starts */
.clr--laptop .clr-vid { height: min(520px, 56vh); }
/* The red button stays in the middle; the chips gather either side of it. */
.clr-row--laptop { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; width: 100%; }
.clr-group { display: flex; align-items: center; gap: 14px; }
.clr-group--l { justify-content: flex-end; }
.clr-group--r { justify-content: flex-start; }
.clr-row--laptop .clr-chip { font-size: 16px; padding: 0 18px; min-height: 52px; }
.clr-row--laptop .clr-rec { width: 86px; height: 86px; margin: 0 14px; }
.clr-row--laptop .clr-rec-dot { width: 60px; height: 60px; }
.clr--laptop[data-state="recording"] .clr-slot-pause, .clr--laptop[data-state="paused"] .clr-slot-pause,
.clr--laptop[data-state="recording"] .clr-slot-redo, .clr--laptop[data-state="paused"] .clr-slot-redo { display: inline-flex; }
.clr--laptop .clr-slot-phone { display: none; }
.clr--laptop[data-state="ready"] .clr-slot-phone { display: inline-flex; }
.clr--laptop[data-state="saving"] .clr-back { visibility: hidden; }

/* ── Back, buttons, pages ───────────────────────────────────────────────────────────────────── */
.clr-back {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 10px 0 4px;
  border: 0; background: none; color: rgba(255, 255, 255, .78); font: 600 16px/1 var(--clr-body);
}
.clr-btn {
  position: relative; width: 100%; min-height: 56px; padding: 12px 18px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 9px; text-align: center;
  font: 600 17px/1.25 var(--clr-body); border: 1px solid transparent; cursor: pointer;
}
.clr-btn--p { background: var(--clr-accent); color: #fff; box-shadow: 0 4px 14px -4px rgba(106, 76, 241, .6); }
.clr-btn--s, .clr-btn--o { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.clr-btn--s { background: rgba(255, 255, 255, .08); }
.clr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.clr-link { border: 0; background: none; color: #fff; text-decoration: underline; font: 600 16px/1.3 var(--clr-body); padding: 6px 0; min-height: 48px; }
.clr-stack { display: grid; gap: 10px; width: 100%; }

.clr-page { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--clr-ink); }
.clr-page > .clr-back { position: absolute; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 8px); }
.clr-page-in {
  max-width: 460px; margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 72px) 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
}
.clr-page-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: rgba(139, 109, 255, .2); color: #c9bbff; font-size: 26px; }
.clr-page-ic.clr-is-busy .clr-i { animation: clr-breathe 1.6s ease-in-out infinite; }
.clr-h { margin: 4px 0 0; font: 700 27px/1.15 var(--clr-display); letter-spacing: -.015em; color: #fff; }
.clr-p { margin: 0; font-size: 17px; line-height: 1.5; color: rgba(255, 255, 255, .78); }
.clr-p b { color: #fff; }
.clr-page .clr-stack { margin-top: 10px; }
.clr-url {
  font: 500 15px/1.45 var(--clr-mono); color: #fff; background: rgba(255, 255, 255, .08); border-radius: 10px;
  padding: 12px 14px; word-break: break-all; -webkit-user-select: all; user-select: all;
}

/* ── C2: after each part ────────────────────────────────────────────────────────────────────── */
.clr-review { position: absolute; inset: 0; overflow-y: auto; background: var(--clr-ink); display: flex; flex-direction: column; }
.clr-wbar {
  display: flex; align-items: center; justify-content: space-between; min-height: 54px;
  padding: calc(env(safe-area-inset-top, 0px) + 4px) 14px 0 10px;
}
.clr-wcount { font: 600 13px/1 var(--clr-mono); letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .58); padding-right: 6px; }
.clr-review-in {
  width: 100%; max-width: 440px; margin: 0 auto; flex: 1 0 auto;
  display: grid; justify-items: center; align-content: start; gap: 16px;
  padding: 6px 20px calc(env(safe-area-inset-bottom, 0px) + 26px);
}
.clr-vid {
  position: relative; width: auto; height: min(384px, 46vh); aspect-ratio: 9 / 16;
  border-radius: 16px; overflow: hidden; background: #222;
}
.clr-play { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #222; }
.clr-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .45)); }
.clr-dur {
  position: absolute; right: 10px; top: 10px; padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .5); font: 600 13px/1.4 var(--clr-mono); color: #fff;
}
.clr-playb {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); color: var(--clr-ink);
  display: grid; place-items: center; font-size: 24px; padding: 0 0 0 4px;
}
.clr.clr-is-playing .clr-playb { opacity: 0; pointer-events: none; }
.clr-saved {
  position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; background: rgba(15, 16, 32, .78); color: #fff;
  font: 600 14px/1.3 var(--clr-body); white-space: nowrap;
}
.clr-saved.clr-is-saved .clr-i { color: var(--clr-good); }
.clr-saved.clr-is-bad { background: rgba(192, 66, 58, .92); }
.clr-note, .clr-err {
  margin: 0; width: 100%; display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px; font-size: 16px; line-height: 1.4;
  background: rgba(255, 216, 77, .12); color: #ffe9a3;
}
.clr-err { background: rgba(192, 66, 58, .18); color: #ffc9c4; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.clr-err[hidden] { display: none; }
.clr-err .clr-link { color: #fff; min-height: 0; }
.clr-q { margin: 2px 0 0; font: 700 25px/1.2 var(--clr-display); color: #fff; text-align: center; }
.clr-private { margin: 0; text-align: center; font-size: 15px; line-height: 1.5; color: rgba(255, 255, 255, .62); }
.clr-private .clr-i { vertical-align: -.2em; margin-right: 4px; }

/* ── Saving the last part ───────────────────────────────────────────────────────────────────── */
.clr-bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.clr-bar span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--clr-accent); transition: width .3s ease; }
.clr-parts { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.clr-pt {
  display: grid; grid-template-columns: 24px 1fr auto; gap: 4px 10px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 16px;
}
.clr-pt b { font-weight: 600; color: rgba(255, 255, 255, .78); }
.clr-pt em { grid-column: 2 / -1; font-style: normal; font-size: 15px; color: #ffc9c4; }
.clr-pt.clr-is-ok .clr-i { color: var(--clr-good); }
.clr-pt.clr-is-busy .clr-i { color: #c9bbff; }
.clr-pt.clr-is-bad .clr-i, .clr-pt.clr-is-wait .clr-i, .clr-pt.clr-is-missing .clr-i { color: #ffb4ad; }

/* ── Small phones: everything still fits on one screen ──────────────────────────────────────── */
@media (max-width: 370px) {
  .clr-band { padding-left: 18px; padding-right: 18px; }
  .clr-chip { padding: 0 9px; font-size: 13px; gap: 4px; }
  .clr-chips { gap: 4px; }
  .clr-cbtn { min-width: 64px; }
}
@media (max-height: 700px) {
  .clr--phone .clr-ctl { gap: 12px; padding-top: 44px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); }
  .clr-rec { width: 82px; height: 82px; }
  .clr-rec-dot { width: 58px; height: 58px; }
}

@keyframes clr-blink { 50% { opacity: .35; } }
@keyframes clr-pop { from { transform: scale(1.25); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
@keyframes clr-breathe { 50% { transform: translateY(-3px); opacity: .7; } }
@media (prefers-reduced-motion: reduce) {
  .clr-track, .clr-line, .clr-rec-dot, .clr-cam { transition: none; }
  .clr-count span, .clr-timer-dot, .clr-page-ic.clr-is-busy .clr-i { animation: none; }
}
