/* Specialist site. Direction: a contact sheet on a light table: the page takes the renders' own dark slate, so the videos sit in it as
   one wall, and a verdict lands on a sign like a grease-pencil mark. Arabic first: no letter-spacing, taller lines, Western digits. */
:root {
  --bg: #15171c;
  --panel: #1d2027;
  --tile: #272a32;
  --shot: #2b2e36;            /* the renders' background, so a loading video does not flash */
  --line: #343844;
  --line-strong: #4b5060;
  --ink: #f2f4f8;
  --muted: #aab0bd;
  --faint: #8b92a3;
  --blue: #3d49de;            /* the avatar's shirt */
  --blue-hi: #9aa5ff;
  --ok: #38c98c;
  --bad: #ff7272;
  --unknown: #f0b84c;
  --ok-ink: #05291a;
  --bad-ink: #3d0a0a;
  --unknown-ink: #2f2103;
  --r: 12px;
  --r-s: 8px;
  --lh-body: 1.75;
  --lh-ui: 1.5;
  --lh-head: 1.4;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
  --gutter: clamp(12px, 2.4vw, 28px);
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: var(--lh-body); letter-spacing: 0; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-block-size: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; }
button { cursor: pointer; line-height: var(--lh-ui); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; inset-block-start: -80px; z-index: 50; padding: 8px 14px; border-radius: var(--r-s); background: var(--blue); color: #fff; }
.skip:focus { inset-block-start: 8px; }

/* ---- top bar ---- */
.bar { position: sticky; inset-block-start: 0; z-index: 20; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 20px;
  padding: 10px var(--gutter); background: rgba(21, 23, 28, .93); backdrop-filter: blur(10px); border-block-end: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand strong { font-size: 1.4rem; font-weight: 800; line-height: var(--lh-head); }
.brand-sub { color: var(--muted); font-size: .9rem; }
.search input { inline-size: 100%; max-inline-size: 520px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); line-height: var(--lh-ui); }
.search input::placeholder { color: var(--faint); }
.progress { display: grid; gap: 4px; min-inline-size: 150px; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; line-height: var(--lh-ui); }
.progress b { color: var(--ink); }
.progress-track { block-size: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress-fill { display: block; block-size: 100%; inline-size: 0; background: var(--ok); transition: inline-size .3s var(--ease); }

/* ---- filters ---- */
main { max-inline-size: 1680px; margin-inline: auto; padding: 16px var(--gutter) 56px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; min-block-size: 36px; border-radius: 14px; color: var(--muted); font-size: .92rem; transition: background-color .14s, color .14s; }
.seg button .n { margin-inline-start: 6px; color: var(--faint); font-size: .82em; font-variant-numeric: tabular-nums; }
.seg button:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, .06); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #14161a; font-weight: 700; }
.seg button[aria-pressed="true"] .n { color: #3b404c; }
.seg.small button { padding: 4px 10px; min-block-size: 32px; font-size: .85rem; }

.owner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-block-start: 12px; padding: 10px 14px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); font-size: .92rem; }
.owner select { padding: 6px 10px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--panel); }
.readonly-note { color: var(--unknown); }
.readonly-note:is(p) { margin: 0; font-size: .9rem; }
/* The owner's overview of the specialists. */
.team { flex: 1 1 100%; overflow-x: auto; }
.team table { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; color: var(--ink); }
.team caption { padding-block-end: 6px; color: var(--muted); text-align: start; font-weight: 700; }
.team th, .team td { padding: 6px 10px; border-block-end: 1px solid var(--line); text-align: start; white-space: nowrap; }
.team thead th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.team tbody th { font-weight: 700; }
.team td.off { color: var(--unknown); }
/* A sign in another specialist's share: for a look only. */
.other-tag { flex: none; padding: 0 8px; border-radius: 999px; background: rgba(240, 184, 76, .14); color: var(--unknown); font-size: .72rem; line-height: 1.7; white-space: nowrap; }
.card.other .marks { opacity: .9; }

.hint { display: flex; align-items: flex-start; gap: 14px; margin-block-start: 12px; padding: 12px 16px; background: var(--panel); border-inline-start: 3px solid var(--blue-hi); border-radius: var(--r-s); color: var(--muted); font-size: .95rem; }
.hint p { margin: 0; max-inline-size: 78ch; }
.hint button { flex: none; }
.k-ok { color: var(--ok); }
.k-bad { color: var(--bad); }
.k-unknown { color: var(--unknown); }

.count { margin: 16px 0 10px; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.empty { margin: 48px 0; text-align: center; color: var(--muted); }

.ghost, .primary, .icon { min-block-size: 40px; padding: 8px 16px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: transparent; transition: background-color .14s; }
.ghost:hover:not(:disabled), .icon:hover { background: rgba(255, 255, 255, .06); }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.primary:hover:not(:disabled) { background: #4a57ea; }
.icon { padding: 4px 12px; }

/* ---- the wall of signs ---- */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 264px), 1fr)); gap: 14px; }
.card { position: relative; display: grid; grid-template-rows: auto 1fr auto; background: var(--tile); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  animation: card-in .26s var(--ease) both; animation-delay: calc(var(--i, 0) * 16ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.card::before { content: ""; position: absolute; z-index: 2; inset-block-start: 0; inset-inline: 0; block-size: 3px; background: transparent; transition: background-color .16s; }
.card[data-v="ok"]::before { background: var(--ok); }
.card[data-v="bad"]::before { background: var(--bad); }
.card[data-v="unknown"]::before { background: var(--unknown); }

.shot { position: relative; display: block; inline-size: 100%; padding: 0; border: 0; background: var(--shot); aspect-ratio: 3 / 2; cursor: zoom-in; }
.shot video { display: block; inline-size: 100%; block-size: 100%; object-fit: cover; pointer-events: none; }
.shot:focus-visible { outline-offset: -3px; }
.stamp { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; inline-size: 30px; block-size: 30px; display: grid; place-items: center; border-radius: 50%;
  font-size: 1rem; font-weight: 800; line-height: 1; opacity: 0; transform: scale(.6); transition: opacity .16s, transform .22s var(--ease); }
.card[data-v="ok"] .stamp { background: var(--ok); color: var(--ok-ink); opacity: 1; transform: none; }
.card[data-v="bad"] .stamp { background: var(--bad); color: var(--bad-ink); opacity: 1; transform: none; }
.card[data-v="unknown"] .stamp { background: var(--unknown); color: var(--unknown-ink); opacity: 1; transform: none; }
.card.has-note .shot::after { content: "ملاحظة"; position: absolute; inset-block-end: 8px; inset-inline-start: 8px; padding: 1px 8px; border-radius: 999px; background: rgba(10, 11, 14, .74); color: var(--ink); font-size: .72rem; line-height: 1.6; }

.meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 10px 4px; }
.word { margin: 0; font-size: 1rem; font-weight: 700; line-height: var(--lh-head); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { flex: none; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); font-size: .72rem; line-height: 1.7; white-space: nowrap; }

.marks { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 6px; padding: 6px 10px 10px; }
.mark { min-block-size: 40px; padding: 6px 4px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-size: .9rem; font-weight: 600;
  transition: background-color .14s, border-color .14s, color .14s; }
.mark-ok:hover:not(:disabled) { border-color: var(--ok); }
.mark-bad:hover:not(:disabled) { border-color: var(--bad); }
.mark-unknown:hover:not(:disabled) { border-color: var(--unknown); }
.mark-ok[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.mark-bad[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }
.mark-unknown[aria-pressed="true"] { background: var(--unknown); border-color: var(--unknown); color: var(--unknown-ink); }
.mark[aria-pressed="true"]:disabled { opacity: .85; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-block-start: 28px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager input { inline-size: 6ch; padding: 7px 4px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--panel); text-align: center; }

.gate { max-inline-size: 46ch; margin: 18vh auto 0; padding: 0 var(--gutter); text-align: center; }
.gate h1 { margin: 0 0 8px; font-size: 1.6rem; line-height: var(--lh-head); }
.gate p { margin: 0; color: var(--muted); }

/* ---- one sign, large ---- */
.viewer { inline-size: min(1180px, calc(100vw - 24px)); max-block-size: calc(100dvh - 24px); padding: 0; overflow: auto; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--panel); color: var(--ink); }
.viewer::backdrop { background: rgba(8, 9, 12, .82); }
.viewer[open] { animation: viewer-in .2s var(--ease); }
@keyframes viewer-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.v-box { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); grid-template-areas: "head head" "stage side"; }
.v-head { grid-area: head; display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-block-end: 1px solid var(--line); color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.v-head .icon { margin-inline-start: auto; }
.saved { color: var(--ok); font-size: .88rem; }
.saved.failed { color: var(--bad); }
.v-stage { grid-area: stage; display: grid; align-content: start; background: var(--shot); }
.v-stage video { display: block; inline-size: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: var(--shot); cursor: pointer; }
.v-ctl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border-block-start: 1px solid var(--line); }
.v-ctl input[type="range"] { inline-size: 100%; accent-color: var(--blue-hi); }
.v-side { grid-area: side; display: grid; align-content: start; gap: 12px; padding: 16px 18px 18px; border-inline-start: 1px solid var(--line); }
.v-word { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 800; line-height: var(--lh-head); overflow-wrap: anywhere; }
.v-meta, .v-forms, .keys { margin: 0; }
.v-forms { color: var(--muted); font-size: .9rem; }
.marks.big { padding: 0; gap: 8px; }
.marks.big .mark { min-block-size: 52px; font-size: 1.05rem; }
.parts { margin: 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: var(--r-s); min-inline-size: 0; }
.parts legend { padding: 0 6px; color: var(--muted); font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-block-size: 36px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; font-size: .88rem; transition: background-color .14s, border-color .14s, color .14s; }
.chip:hover:not(:disabled) { border-color: var(--bad); }
.chip[aria-pressed="true"] { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); font-weight: 700; }
.note { display: grid; gap: 6px; color: var(--muted); font-size: .88rem; }
.note textarea { min-block-size: 76px; padding: 10px 12px; resize: vertical; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); font-size: 1rem; line-height: var(--lh-body); }
.note textarea::placeholder { color: var(--faint); }
.v-nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.v-nav button { min-block-size: 48px; }
.keys { color: var(--faint); font-size: .8rem; }

.toast { position: fixed; z-index: 100; inset-block-end: 20px; inset-inline: 0; inline-size: fit-content; max-inline-size: calc(100vw - 32px); margin-inline: auto; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #14161a; font-weight: 600; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.toast.on { opacity: 1; transform: none; }

@media (pointer: coarse) {
  .mark { min-block-size: 44px; }
  .seg button { min-block-size: 44px; }
  .chip { min-block-size: 44px; }
}
.scope button { min-block-size: 44px; font-weight: 600; }
@media (max-width: 860px) {
  .viewer { inline-size: 100vw; max-inline-size: 100vw; block-size: 100dvh; max-block-size: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .v-box { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "stage" "side"; }
  .v-side { border-inline-start: 0; }
  .keys { display: none; }
}
@media (max-width: 640px) {
  .bar { grid-template-columns: minmax(0, 1fr) auto; }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .brand-sub { display: none; }
  .progress { min-inline-size: 120px; }
  .hint { flex-direction: column; }
  /* One row of filters that slides sideways, so the signs start high on a phone. */
  .filters { gap: 8px; }
  .filters .seg { flex-wrap: nowrap; max-inline-size: 100%; overflow-x: auto; scrollbar-width: none; }
  .filters .seg::-webkit-scrollbar { display: none; }
  .filters .seg button { flex: none; white-space: nowrap; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .meta { padding: 6px 8px 2px; }
  .word { font-size: .92rem; }
  .card .tag { display: none; }
  .marks { padding: 6px; gap: 4px; }
  .mark { padding-inline: 2px; font-size: .8rem; }
  .marks.big .mark { font-size: 1rem; }
  .v-ctl { grid-template-columns: auto minmax(0, 1fr); }
  .v-ctl .seg { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
