/* Mamdoh kiosk: "Mamdoh is the screen" design (v2, 2026-11-26). v1 ("the ai one") is in designs/the-ai-one/.
   The page takes the warm studio colour of Mamdoh's video, so he seems to stand in the room and the video
   has no visible frame. Navy type, the colour PMAU logo (the identity's primary version on light backgrounds)
   and nothing decorative. Font: IBM Plex Sans Arabic (the PMAU website's typeface).
   Screens: body[data-screen] = laptop | tv | totem, chosen with ?screen= (app.js), else from the orientation. */

@font-face { font-family: 'PMAU Sans'; font-weight: 400; font-display: swap; src: url(/brand/fonts/IBMPlexSansArabic-Regular.woff2) format('woff2'); }
@font-face { font-family: 'PMAU Sans'; font-weight: 500; font-display: swap; src: url(/brand/fonts/IBMPlexSansArabic-Medium.woff2) format('woff2'); }
@font-face { font-family: 'PMAU Sans'; font-weight: 600; font-display: swap; src: url(/brand/fonts/IBMPlexSansArabic-SemiBold.woff2) format('woff2'); }
@font-face { font-family: 'PMAU Sans'; font-weight: 700; font-display: swap; src: url(/brand/fonts/IBMPlexSansArabic-Bold.woff2) format('woff2'); }

:root {
  --navy: #111e4d;                     /* PMAU Pantone 662C */
  --navy-2: rgba(17, 30, 77, .66);
  --navy-3: rgba(17, 30, 77, .42);
  --rule: rgba(17, 30, 77, .16);
  --teal: #0e9f9a;                     /* PMAU teal, darkened enough to read on the warm background */
  --amber: #d98a00;                    /* PMAU secondary (Pantone 137), darkened */
  --blue: #0083be;                     /* PMAU Pantone 7460C */
  --paper-top: #ecdccc;                /* sampled from the top of Mamdoh's studio photo */
  --paper-mid: #e3d0bc;
  --paper-bot: #d3bda3;                /* ...and from the bottom */
  --font: 'PMAU Sans', 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --u: 1vh;                            /* type unit, scaled per screen below */
  --stage-h: 100vh;
}
body[data-screen="tv"] { --u: 1.1vh; }
body[data-screen="totem"] { --u: .95vw; --stage-h: 76vh; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font); color: var(--navy); user-select: none; cursor: default; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, var(--paper-top) 0%, var(--paper-mid) 55%, var(--paper-bot) 100%);
}

/* ---------------- Mamdoh ---------------- */
#stage { position: fixed; inset: 0; }                 /* preview.html: full screen */
#stage canvas { display: block; }
#scene #stage {
  inset: auto; top: 0; left: 50%; translate: -50% 0; height: var(--stage-h); aspect-ratio: 756 / 1220; max-width: 100vw;
  /* side edges melt into the page; the photo's own background matches it */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}
body[data-screen="totem"] #scene #stage {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, #000 82%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%), linear-gradient(to bottom, #000 82%, transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
/* still photo (LemonSlice mode), live video and saved clips all fill the column */
#stage .face-poster,
#stage .simli-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; pointer-events: none; }
#stage .simli-video { opacity: 0; transition: opacity .5s ease; background: transparent; }
#stage .simli-video.live { opacity: 1; }
#stage .simli-badge { position: absolute; left: 12px; top: 12px; z-index: 3; font: 600 11px/1 system-ui, sans-serif; color: #fff; background: rgba(0, 0, 0, .5); padding: 5px 8px; border-radius: 4px; pointer-events: none; }
#stage.simli-live > :not(.simli-video), #stage.simli-clip-on > :not(.simli-video) { visibility: hidden; }
body.avatar-lemonslice #stage > :not(.simli-video):not(.face-poster):not(.simli-badge) { visibility: hidden; }

/* ---------------- logo ---------------- */
#brand { position: fixed; z-index: 3; top: calc(var(--u) * 4.2); right: 4.5vw; }
#brand img { display: block; height: calc(var(--u) * 7.4); width: auto; }

/* ---------------- side text (idle) ---------------- */
#intro, #topics {
  position: fixed; z-index: 2; top: 50%; translate: 0 -46%;
  width: min(calc(50vw - var(--stage-h) * .31 - 6vw), calc(var(--u) * 52));
  transition: opacity .5s ease;
}
#intro { right: 4.5vw; }
#topics { left: 4.5vw; }
body:has(.cap.show) #intro, body:has(.cap.show) #topics { opacity: 0; }

.kicker { margin: 0 0 calc(var(--u) * 1.2); font-size: calc(var(--u) * 1.9); font-weight: 500; color: var(--navy-2); line-height: 1.5; }
#intro h1 { margin: 0; font-size: calc(var(--u) * 13); font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.name-en { margin: calc(var(--u) * 1.4) 0 0; font-size: calc(var(--u) * 2.4); color: var(--navy-2); text-align: right; }
.invite { margin: calc(var(--u) * 5) 0 0; padding-top: calc(var(--u) * 2.6); border-top: 2px solid var(--navy); font-size: calc(var(--u) * 2.8); font-weight: 600; line-height: 1.4; }
.invite-en { margin: calc(var(--u) * .6) 0 0; font-size: calc(var(--u) * 2); color: var(--navy-2); text-align: right; }
.hint { margin: calc(var(--u) * 3) 0 0; font-size: calc(var(--u) * 1.7); color: var(--navy-3); line-height: 1.5; }
.hint span { display: block; text-align: right; }

#topics h2 { margin: 0 0 calc(var(--u) * 1.6); font-size: calc(var(--u) * 1.9); font-weight: 500; color: var(--navy-2); display: flex; justify-content: space-between; }
#topics ul { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
#topics li {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6em;
  padding: calc(var(--u) * 1.75) 0; border-top: 1px solid var(--rule);
}
#topics li b { font-size: calc(var(--u) * 2.6); font-weight: 600; white-space: nowrap; }
#topics li span { font-size: calc(var(--u) * 1.65); color: var(--navy-2); white-space: nowrap; }

/* ---------------- subtitles ---------------- */
#captions {
  position: fixed; z-index: 4; left: 50%; translate: -50% 0; bottom: calc(var(--u) * 10.5);
  width: min(78vw, calc(var(--u) * 150)); display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 1.2);
  pointer-events: none;
}
/* Hidden unless switched on with the F key (app.js sets body[data-captions]; off by default, 2026-11-29). */
body:not([data-captions="on"]) #captions { display: none; }
.msg { display: flex; justify-content: center; max-width: 100%; }
.msg:not(:has(.cap.show)) { display: none; }
.cap { unicode-bidi: plaintext; text-align: center; overflow-wrap: anywhere; animation: appear .35s ease both; }
.msg.user .cap {
  padding: calc(var(--u) * .9) calc(var(--u) * 1.8); border-radius: 4px;
  background: rgba(255, 255, 255, .9); color: var(--navy-2); font-size: calc(var(--u) * 2.5); line-height: 1.45;
}
.msg.bot .cap {
  max-height: calc(var(--u) * 3.7 * 1.55 * 4 + var(--u) * 3.4); overflow-y: auto; scrollbar-width: none;
  padding: calc(var(--u) * 1.7) calc(var(--u) * 3); border-radius: 4px;
  background: rgba(17, 30, 77, .94); color: #fff; font-size: calc(var(--u) * 3.7); line-height: 1.55; font-weight: 500;
}
.msg.bot .cap::-webkit-scrollbar { display: none; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- listening indicator ---------------- */
#status {
  position: fixed; z-index: 4; left: 50%; translate: -50% 0; bottom: calc(var(--u) * 3.6);
  display: flex; align-items: center; gap: calc(var(--u) * 1.1); white-space: nowrap;
  padding: calc(var(--u) * .9) calc(var(--u) * 2) calc(var(--u) * .9) calc(var(--u) * 1.6);
  border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 3px rgba(17, 30, 77, .12);
  font-size: calc(var(--u) * 1.9);
}
#mic-ring { display: grid; place-items: center; width: calc(var(--u) * 1.5); aspect-ratio: 1; transition: transform .08s linear; }
#mic-dot { width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--navy-3); }
body[data-state="listening"] #mic-dot { background: var(--teal); }
body[data-state="hearing"] #mic-dot { background: var(--amber); }
body[data-state="thinking"] #mic-dot { background: var(--blue); animation: blink 1s ease-in-out infinite; }
body[data-state="speaking"] #mic-dot { background: var(--navy); }
@keyframes blink { 50% { opacity: .25; } }
#status-text { display: flex; align-items: baseline; gap: .75em; }
#status-text .ar { font-weight: 600; }
#status-text .en { color: var(--navy-2); direction: ltr; }

/* ---------------- totem (portrait) ---------------- */
body[data-screen="totem"] #brand { top: calc(var(--u) * 4); right: 5vw; }
body[data-screen="totem"] #brand img { height: calc(var(--u) * 8); }
body[data-screen="totem"] #intro,
body[data-screen="totem"] #topics { top: calc(var(--stage-h) - 1vh); translate: none; width: auto; }
body[data-screen="totem"] #intro { right: 6vw; left: 52vw; }
body[data-screen="totem"] #topics { left: 6vw; right: 54vw; }
body[data-screen="totem"] #intro h1 { font-size: calc(var(--u) * 10); }
body[data-screen="totem"] .invite { margin-top: calc(var(--u) * 2.6); padding-top: calc(var(--u) * 2); font-size: calc(var(--u) * 2.9); }
body[data-screen="totem"] .hint { display: none; }
body[data-screen="totem"] #topics li { padding: calc(var(--u) * 1.15) 0; }
body[data-screen="totem"] #topics li b { font-size: calc(var(--u) * 2.5); }
body[data-screen="totem"] #topics li span { font-size: calc(var(--u) * 1.7); }
body[data-screen="totem"] #status { bottom: calc(100vh - var(--stage-h) + var(--u) * 3); }
body[data-screen="totem"] #captions { width: 90vw; top: calc(var(--stage-h) + var(--u) * 1.5); bottom: auto; }
body[data-screen="totem"] .msg.bot .cap { max-height: calc(100vh - var(--stage-h) - var(--u) * 14); }
body[data-screen="totem"] .msg.bot .cap { font-size: calc(var(--u) * 3.6); }

/* ---------------- overlays ---------------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(236, 220, 204, .82); z-index: 20; }
.hidden { display: none !important; }
.big-btn {
  font: inherit; color: #fff; background: var(--navy); border: 0; cursor: pointer; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; gap: .3em;
  padding: calc(var(--u) * 4) calc(var(--u) * 8); font-size: calc(var(--u) * 4.4); font-weight: 700;
}
.big-btn small { font-size: .48em; font-weight: 500; opacity: .8; }

/* settings panel (technician only) */
.panel {
  width: min(94vw, 680px); max-height: 92vh; overflow: auto; background: #fff; color: #161d2f; border-radius: 8px; padding: 26px 30px;
  box-shadow: 0 20px 60px rgba(17, 30, 77, .3); user-select: text; border-top: 5px solid var(--navy);
}
.panel h2 { margin: 0 0 4px; color: var(--navy); font-size: 22px; }
.panel h3.sub { margin: 16px 0 8px; color: var(--navy); font-size: 15px; }
.panel .hint { color: #5b6b7a; font-size: 13px; margin: 4px 0 14px; }
.panel label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; flex: 1; }
.panel input, .panel select { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-size: 14px; border: 1px solid #cbd1d1; border-radius: 6px; background: #fff; color: inherit; }
.panel input:focus, .panel select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.panel .row { display: flex; gap: 14px; }
.panel .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.panel button { font: inherit; font-size: 14px; padding: 9px 16px; border-radius: 6px; border: 1px solid #cbd1d1; background: #fff; color: inherit; cursor: pointer; }
.panel button.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.test-result { font-size: 13px; white-space: pre-wrap; font-family: Consolas, monospace; }
.test-result .ok { color: #0a7f6f; }
.test-result .bad { color: #b3261e; }
@media (max-width: 600px) { .panel .row { flex-direction: column; gap: 0; } }

/* debug */
#debug {
  position: fixed; bottom: 12px; left: 12px; z-index: 15; width: 560px; max-height: 90vh; overflow: hidden; background: rgba(0, 0, 0, .78); color: #d9f99d;
  border-radius: 6px; padding: 8px; font: 12px/1.4 Consolas, monospace; pointer-events: none; text-align: left;
}
#debug video { width: 100%; border-radius: 4px; transform: scaleX(-1); background: #000; }
#debug pre { margin: 6px 0 0; white-space: pre-wrap; }
#debug.off { opacity: 0; }
