/* The Video tool (js/video.js): New video, the video, the Gallery, the steps that add a person, and the camera. It
   uses the Image tool's screen parts (image.css: the bar, the pop-up, Generate at the bottom) and the theme's tokens. */

/* ---------- New video ---------- */

.vd-compose { display: flex; flex-direction: column; gap: 10px; animation: im-in 0.3s ease both; }
.vd-me {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 18px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; transition: border-color 0.15s, background 0.15s;
}
.vd-me b { font-weight: 600; font-size: 1rem; }
.vd-tick {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--ink-3); display: grid; place-items: center; flex: none;
  color: transparent; transition: background 0.15s, border-color 0.15s;
}
.vd-tick svg { width: 17px; height: 17px; }
.vd-me[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); }
.vd-me[aria-checked='true'] .vd-tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vd-av { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
/* my face: a tap opens my steps; a gold ring says it can be tapped, faded while the tick is off */
.vd-me .vd-av { margin-left: auto; width: 38px; height: 38px; box-shadow: 0 0 0 2px var(--accent); cursor: pointer; transition: opacity 0.15s; }
.vd-me .vd-av.off { opacity: 0.45; }
.vd-av[hidden] { display: none; }
.vd-label { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); margin: 4px 2px -2px; }
.vd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vd-chips[hidden], .vd-label[hidden] { display: none; }
.vd-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; font: inherit; font-weight: 600;
  font-size: 0.92rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%;
}
.vd-chip .vd-av { width: 28px; height: 28px; }
.vd-chip[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); }
.vd-chip.plus { padding: 8px 14px; color: var(--ink-2); border-style: dashed; }
.vd-chip.plus svg { width: 16px; height: 16px; }
#vd-prompt {
  width: 100%; min-height: 8rem; resize: none; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  color: var(--ink); padding: 1rem 1.05rem; font: inherit; font-size: 1.05rem; line-height: 1.5; outline: none; margin-top: 6px;
  transition: border-color 0.14s, box-shadow 0.14s;
}
#vd-prompt:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#vd-prompt::placeholder { color: var(--ink-3); }

/* Generate, with the member's limits on it: "2 left today · Next in 25 min" */
.vd-go { flex-direction: column; gap: 2px; line-height: 1.15; }
.vd-quota { font-size: 0.78rem; font-weight: 500; opacity: 0.85; }
.vd-quota[hidden] { display: none; }
.vd-go.blocked { background: var(--surface-2); color: var(--ink-2); opacity: 1; }
.vd-go.blocked .vd-quota { opacity: 1; color: var(--ink); font-weight: 600; }

/* ---------- the video ---------- */

.vd-result { display: flex; flex-direction: column; align-items: center; animation: im-in 0.3s ease both; }
.vd-frame {
  position: relative; width: 100%; max-width: 380px; aspect-ratio: 9 / 16; max-height: 64vh; border-radius: 22px; overflow: hidden;
  background: var(--surface-2); box-shadow: var(--shadow);
}
.vd-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.vd-frame video[hidden] { display: none; }
.vd-wait { position: absolute; inset: 0; }
.vd-wait[hidden] { display: none; }
.vd-keeps { margin: 0.35rem 0 0; color: var(--ink-3); font-size: 0.85rem; text-align: center; }
.vd-keeps[hidden] { display: none; }

/* ---------- the Gallery: newest first, two across ---------- */

.vd-gallery { animation: im-in 0.3s ease both; padding-bottom: calc(1rem + var(--inset-bottom)); }
.vd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.vd-tile {
  position: relative; display: block; padding: 0; border: 0; border-radius: 18px; overflow: hidden; aspect-ratio: 9 / 16;
  background: var(--surface-2); box-shadow: var(--shadow); cursor: pointer;
}
.vd-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; opacity: 0; transition: opacity 0.25s; }
.vd-tile video.ready { opacity: 1; }
.vd-tile .im-shine { position: absolute; inset: 0; }
.vd-tile .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 10px 9px; text-align: left; color: #fff; font-size: 0.82rem;
  line-height: 1.3; background: linear-gradient(to top, rgb(0 0 0 / 66%), transparent);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.vd-none { color: var(--ink-3); text-align: center; margin: 3rem 0; }

.vd-toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--inset-bottom)); transform: translateX(-50%); z-index: 70; display: flex;
  align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600;
  font-size: 0.9rem; box-shadow: 0 8px 24px rgb(0 0 0 / 30%); max-width: calc(100% - 32px);
}
.vd-toast[hidden] { display: none; }
.vd-toast button { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; padding: 0; }

/* ---------- adding a person: one photo a step ---------- */

.vd-wiz { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); animation: im-in 0.25s ease both; }
.vd-wiz[hidden] { display: none; }
.vd-wiz .im-bar .icon-btn[hidden] { visibility: hidden; display: inline-flex; }
.wz-cancel { border: 0; background: none; color: var(--ink-2); font: inherit; font-weight: 600; font-size: 0.95rem; padding: 0.4rem 0.2rem; min-width: 40px; }
.wz-dots { display: flex; justify-content: center; gap: 6px; padding: 2px 16px 10px; }
.wz-dots:empty { display: none; }
.wz-dots i { width: 26px; height: 4px; border-radius: 9px; background: var(--line); }
.wz-dots i.d { background: var(--ok, #6cc58c); }
.wz-dots i.c { background: var(--accent); }
.wz-body { flex: 1; min-height: 0; width: 100%; max-width: 520px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; }
.wz-step { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.wz-step:empty { display: none; }
.wz-title { font: 600 1.9rem/1.1 var(--serif); text-align: center; margin: 0.2rem 0 0.15rem; }
.wz-hint { margin: 0 0 0.9rem; color: var(--ink-3); text-align: center; font-size: 0.92rem; }
.wz-hint:empty { display: none; }
.wz-name {
  width: 100%; padding: 0.95rem 1rem; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 1.1rem; outline: none; margin-top: 0.8rem;
}
.wz-name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wz-name[hidden] { display: none; }
.wz-pic {
  position: relative; flex: 1; min-height: 220px; max-height: 58vh; border-radius: 24px; border: 1.5px dashed var(--line);
  background: var(--surface); display: grid; place-items: center; overflow: hidden;
}
.wz-pic[hidden] { display: none; }
.wz-pic.has-photo { border-color: transparent; background: var(--surface-2); }
.wz-draw { max-width: 78%; max-height: 92%; object-fit: contain; opacity: 0.92; }
.wz-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.wz-draw[hidden], .wz-photo[hidden] { display: none; }
.wz-score {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 14px; font-weight: 600; font-size: 0.92rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.wz-score[hidden] { display: none; }
.wz-score.good { background: rgb(18 58 34 / 84%); color: #8fe0aa; }
.wz-score.bad { background: rgb(74 18 18 / 86%); color: #ffa79e; }
.wz-score.wait { background: rgb(0 0 0 / 55%); color: #eee; }
.wz-meter { flex: 1; height: 6px; border-radius: 9px; background: rgb(255 255 255 / 16%); overflow: hidden; }
.wz-meter i { display: block; height: 100%; width: 0; border-radius: 9px; background: currentColor; transition: width 0.4s ease; }
.wz-strip { display: flex; justify-content: center; gap: 8px; margin: 1.2rem 0; flex-wrap: wrap; }
.wz-strip[hidden] { display: none; }
.wz-strip span { width: 58px; height: 74px; border-radius: 12px; background: var(--surface-2) center / cover no-repeat; }
.wz-strip span.skipped { border: 1.5px dashed var(--line); background: transparent; }
.wz-foot { width: 100%; max-width: 520px; margin: 0 auto; display: grid; gap: 10px; padding: 14px 16px calc(16px + var(--inset-bottom)); }
.wz-foot .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wz-foot .btn { padding: 0.9rem 1rem; }
.wz-foot .btn svg { width: 18px; height: 18px; }
.wz-skip { border: 0; background: none; color: var(--ink-3); font: inherit; font-weight: 600; padding: 0.3rem; }

/* ---------- the camera ---------- */

.vd-cam { position: fixed; inset: 0; z-index: 65; background: #000; color: #fff; }
.vd-cam[hidden] { display: none; }
.vd-cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; }
/* shown only once the camera's picture comes (Android draws a grey video placeholder until then) */
.vd-cam video.live { opacity: 1; }
.vd-cam video.mirror { transform: scaleX(-1); }
/* the face's oval: a face that fills it is the size the check wants (about 0.37 of the camera's height) */
.cam-oval {
  position: absolute; left: 50%; top: 42%; width: min(84vw, 440px); aspect-ratio: 3 / 4; transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 70%); box-shadow: 0 0 0 200vmax rgb(0 0 0 / 38%); transition: border-color 0.2s;
}
/* a whole standing person, head to feet */
.vd-cam.body .cam-oval { top: 46%; width: min(40vw, 240px); aspect-ratio: 1 / 4; border-radius: 120px; }
.cam-oval.good { border-color: #7fd49a; }
.cam-oval.bad { border-color: #ff9a90; }
.cam-tip {
  position: absolute; left: 16px; right: 16px; bottom: calc(118px + var(--inset-bottom)); text-align: center; font-weight: 600;
  padding: 10px; border-radius: 14px; background: rgb(0 0 0 / 55%);
}
.cam-tip.good { color: #8fe0aa; }
/* body photos: an open palm starts the countdown */
.cam-palm {
  position: absolute; left: 16px; right: 16px; top: calc(16px + var(--inset-top)); display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 14px; border-radius: 14px; background: rgb(0 0 0 / 55%); font-weight: 600; text-align: center;
}
.cam-palm[hidden] { display: none; }
.cam-palm span:first-child { font-size: 1.4rem; }
.cam-count {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font: 700 9rem/1 var(--serif); color: #fff;
  text-shadow: 0 6px 30px rgb(0 0 0 / 60%); pointer-events: none;
}
.cam-count[hidden] { display: none; }
.cam-count.pop { animation: cam-pop 0.9s ease both; }
@keyframes cam-pop { from { transform: translate(-50%, -50%) scale(1.4); } to { transform: translate(-50%, -50%) scale(1); } }
.cam-tip.bad { color: #ffa79e; }
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-around;
  padding: 16px 16px calc(22px + var(--inset-bottom));
}
.cam-bar .icon-btn { color: #fff; background: rgb(255 255 255 / 14%); border-color: transparent; }
.cam-shoot { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: none; display: grid; place-items: center; padding: 0; }
.cam-shoot i { width: 56px; height: 56px; border-radius: 50%; background: #fff; transition: background 0.2s; }
/* a good shot: the button lights up; the member always takes the photo themself */
.cam-shoot.ready { border-color: #7fd49a; box-shadow: 0 0 0 6px rgb(127 212 154 / 28%); }
.cam-shoot.ready i { background: #7fd49a; }

/* the call's AI wrote the words (its work is green, like its ring) */
#vd-prompt { transition: box-shadow 0.5s, border-color 0.5s; }
#vd-prompt.ai-wrote { border-color: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 35%, transparent); transition: none; }
