/* jarchi's people view (people-view.js, VIDEO.md): the people on the empty stage, a tile each (the camera, or the
   initial with a ring that lights green while they speak, DESIGN-SYS ruling 1), and the cameras' strip beside the
   lesson. The stage is always dark, in both schemes, so the tiles have one look: a step lighter than the ground,
   names in white on a dark pill, mic and hand drawn as shapes. And the camera rules' controls (cam-settings.js). */

/* ---------- the empty stage: the grid ---------- */
.stg-people {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 8px;
}
.stg-people[hidden], .pv-grid[hidden], .pv-spot[hidden], .pv-row[hidden] { display: none; }
.stg[data-people="1"] .stg-empty { display: none; }
.pv-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; align-content: center; /* the last row centred, like Meet */
  width: calc(var(--cols, 3) * var(--tw, 200px) + (var(--cols, 3) - 1) * 8px); max-width: 100%;
}
/* The people view shows who speaks on the tiles themselves: the corner label steps aside. */
.room-main:has(> .stg[data-people="1"]) > .spk { display: none; }
.pv-tile {
  --l: 0;
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  width: var(--tw, 200px); aspect-ratio: var(--ar, 16 / 9);
  border-radius: 12px;
  background: var(--stage-raised); color: var(--stage-ink);
  transition: box-shadow var(--t-fast, 120ms) ease-out;
}
.pv-av {
  display: grid; place-items: center;
  width: clamp(36px, 30%, 112px); aspect-ratio: 1; border-radius: 50%;
  background: var(--stage-av); color: var(--stage-ink);
  font-weight: 700; font-size: clamp(1rem, calc(var(--tw, 200px) * .11), 2.75rem); line-height: 1;
  transition: box-shadow var(--t-fast, 120ms) ease-out;
}
/* Speaking: a green line round the tile and a ring round the initial that follows the voice (app.js sets --l). */
.pv-tile[data-speaking="1"] { box-shadow: inset 0 0 0 2px var(--stage-live); }
.pv-tile[data-speaking="1"] .pv-av { box-shadow: 0 0 0 calc(3px + var(--l) * 8px) var(--stage-live-ring); }
/* The camera over the initial, once it plays (my own mirrored). */
.pv-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: transparent; border-radius: 0;
  opacity: 0; transition: opacity var(--t-med, 200ms) ease-out;
}
.pv-tile[data-video="1"] .pv-video { opacity: 1; }
.pv-tile[data-video="1"] .pv-av { visibility: hidden; }
.pv-tile[data-self="1"] .pv-video { transform: scaleX(-1); }
/* Pinning (this viewer only): a pin in the tile's top corner, seen on hover or focus, always while pinned; a tap on
   the tile does the same. */
.pv-tile { cursor: pointer; }
.pv-pin {
  appearance: none; position: absolute; z-index: 2; top: 6px; inset-inline-end: 6px;
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: 999px; background: var(--stage-chip); color: var(--stage-ink);
  opacity: 0; cursor: pointer; transition: opacity var(--t-fast, 120ms) ease-out;
}
.pv-pin .ic { width: 18px; height: 18px; }
.pv-tile:hover .pv-pin, .pv-pin:focus-visible, .pv-tile[data-pinned="1"] .pv-pin { opacity: 1; }
.pv-pin:focus-visible { outline: 2px solid var(--stage-focus); outline-offset: 2px; }
.pv-row .pv-pin, .pv-strip-list .pv-pin:not([aria-pressed="true"]) { display: none; }
.pv-tile[data-pinned="1"] { box-shadow: inset 0 0 0 2px var(--stage-focus); }
.pv-more { cursor: pointer; }
/* The name, the mic, the hand: a dark pill in the tile's corner. */
.pv-name {
  position: absolute; z-index: 1; bottom: 6px; inset-inline-start: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  max-width: calc(100% - 12px);
  padding: 2px 8px; border-radius: 999px;
  background: var(--stage-chip); color: var(--stage-ink);
  font-size: var(--fs-micro); font-weight: 600; line-height: 1.6;
}
.pv-name-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-mic:empty { display: none; }
.pv-mic, .pv-hand { flex: none; display: inline-grid; place-items: center; }
.pv-mic .ic, .pv-hand .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.pv-mic[data-state="on"] { color: var(--stage-live); }
.pv-mic[data-state="off"] { color: var(--stage-muted); }
.pv-mic[data-state="muted"] { color: var(--stage-hand); }
.pv-hand { color: var(--stage-hand); }
.pv-hand[hidden] { display: none; }
.pv-tile[data-hand="1"] { box-shadow: inset 0 0 0 2px var(--stage-hand); }

/* «+۲۷ نفر»: the rest of the class, a tap opens the participants. */
.pv-more {
  appearance: none; border: 0; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--stage-ink); touch-action: manipulation;
}
.pv-more-n { font-size: var(--fs-title); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pv-more-w { font-size: var(--fs-meta); color: var(--stage-muted); }
@media (hover: hover) { .pv-more:hover { background: var(--stage-av); } }
.pv-more:focus-visible { outline: 2px solid var(--stage-focus); outline-offset: 2px; }

/* camera.max = 1: one big spotlight tile, the others as a row of initials under it. */
.pv-spot { width: var(--tw, 100%); max-width: 100%; }
.pv-spot > .pv-tile { width: 100%; }
.pv-spot .pv-video { object-fit: contain; background: var(--video-ground); }
.pv-row { display: flex; justify-content: center; gap: 8px; max-width: 100%; }
.pv-row > .pv-tile { --tw: 64px; width: 56px; aspect-ratio: 1; border-radius: 50%; }
.pv-row > .pv-tile .pv-av { width: 100%; font-size: var(--fs-heading); }
.pv-row > .pv-tile .pv-name { display: none; }
.pv-row > .pv-tile[data-speaking="1"] { box-shadow: 0 0 0 2px var(--stage-live); }
.pv-row > .pv-more .pv-more-n { font-size: var(--fs-body); }
.pv-row > .pv-more .pv-more-w { display: none; }

/* ---------- the strip beside the lesson (cameras on only) ---------- */
.stg-strip { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.pv-strip-list[hidden] { display: none; }
/* Each viewer may put the strip away (a small «تصویرها» button stays); nothing is downloaded for it then. */
.pv-strip-x, .pv-strip-show {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 10px;
  border: 0; border-radius: 999px; background: var(--stage-chip); color: var(--stage-ink);
  font: inherit; font-size: var(--fs-meta); font-weight: 700; cursor: pointer; touch-action: manipulation;
}
.pv-strip-x[hidden], .pv-strip-show[hidden] { display: none; }
.pv-strip-x .ic, .pv-strip-show .ic { width: 20px; height: 20px; }
.pv-strip-x .ic { transform: rotate(90deg); } /* towards the side it folds to */
@media (hover: hover) { .pv-strip-x:hover, .pv-strip-show:hover { background: var(--stage-hover); } }
.pv-strip-x:focus-visible, .pv-strip-show:focus-visible { outline: 2px solid var(--stage-focus); outline-offset: 2px; }
.stg-strip[hidden] { display: none; }
.pv-strip-list { display: flex; flex-direction: column; justify-content: center; gap: 8px; width: 176px; }
.pv-strip-list > .pv-tile { --tw: 176px; width: 100%; }
.pv-strip-list .pv-av { font-size: var(--fs-lead); }
.pv-strip-list .pv-more-n { font-size: var(--fs-body-phone); }
/* An upright phone or tablet: a row under the lesson. */
@media (max-width: 959px) and (orientation: portrait) {
  .stg-body { flex-direction: column; gap: 0; }
  .stg-strip { flex-direction: row; }
  .pv-strip-x .ic { transform: none; }
  .stg-strip { padding: 6px 8px; }
  .pv-strip-list { flex-direction: row; width: auto; gap: 6px; }
  .pv-strip-list > .pv-tile { --tw: 112px; width: 112px; border-radius: 10px; }
  .pv-strip-list .pv-name { bottom: 3px; inset-inline-start: 3px; padding: 0 6px; font-size: var(--fs-micro); }
  .pv-strip-list .pv-mic .ic { width: 12px; height: 12px; }
}
/* A phone on its side: a narrow column. */
@media (max-width: 959px) and (max-height: 540px) and (orientation: landscape) {
  .pv-strip-list { width: 120px; gap: 6px; }
  .pv-strip-list > .pv-tile { --tw: 120px; }
  .pv-strip-list .pv-name { font-size: var(--fs-micro); padding: 0 6px; }
  .room[data-chrome="off"] .stg-strip { display: none; }
}

/* ---------- the camera rules (cam-settings.js) ---------- */
.cs { display: flex; flex-direction: column; gap: 10px; }
.cs-rest { display: flex; flex-direction: column; gap: 8px; }
.cs-rest[hidden] { display: none; }
.cs .cs-allowed { padding: 0; }
.cs-allowed .switch[aria-pressed="true"]::before { background: var(--accent); } /* allowed is the calm normal, not a warning */
.cs-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cs-pick {
  appearance: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 56px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl, 12px);
  background: var(--surface); color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.cs-pick small { color: var(--muted); font-size: var(--fs-xs); }
.cs-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.cs-label { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-s); font-weight: 600; }
.cs-segs, .cs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-seg, .cs-chip {
  appearance: none; min-height: 44px; min-width: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.cs-seg[aria-pressed="true"], .cs-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
@media (hover: hover) {
  .cs-pick:not([aria-pressed="true"]):hover, .cs-seg:not([aria-pressed="true"]):hover, .cs-chip:not([aria-pressed="true"]):hover { background: var(--hover); }
}
.cs-note { margin: 0; color: var(--muted); font-size: var(--fs-s); }
.cs-note:empty { display: none; }
.cs-seg:disabled, .cs-chip:disabled, .cs-pick:disabled { opacity: .5; cursor: not-allowed; }
.cs-said { margin: 0; min-height: 1.5em; color: var(--muted); font-size: var(--fs-s); }
.cs-sheet .sheet-card > .btn.ghost:last-child { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .pv-tile, .pv-av, .pv-video { transition: none; }
}
