/* ==========================================================================
   mo3alemi - base.css - design system: tokens, themes, reset, typography,
   helpers, skeletons. Stage 1 (mobile-first redesign).

   Every token name that existed before is kept, so views.css / player.css /
   meeting.css / components.css keep working; only the values changed, plus new
   tokens. Mobile first: 360px is the design target, then 520, 768, 1024px.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens --- */
:root{
  /* surfaces (never pure white, never pure black) */
  --bg:#F7F8FB;
  --bg-2:#EFF2F8;
  --surface:#FFFFFF;
  --surface-2:#F4F6FA;
  --raised:#EDF0F7;
  --overlay:rgba(16,22,38,.48);
  --line:#E3E7F0;
  --line-2:#D6DCE9;

  /* text */
  --fg:#131A2E;
  --fg-2:#333E5C;
  --muted:#5E6785;

  /* one strong accent + one secondary */
  --accent:#5B4BE8;
  --accent-2:#7A6BFF;
  --accent-fg:#FFFFFF;
  --accent-soft:#ECE9FF;
  --accent-soft-2:#DED9FF;
  --secondary:#0E9F8E;
  --secondary-soft:#DCF5F0;

  /* status */
  --ok:#0E7C57;
  --ok-bg:#DFF4EC;
  --err:#C62D33;
  --err-bg:#FDE9EA;
  --warn:#8A5A05;
  --warn-bg:#FFF3D6;
  --info:#1F5FA8;
  --info-bg:#E4EFFB;

  /* legacy names still referenced by the view/player/meeting sheets: the old
     "notebook" hard-shadow look is gone, so --edge/--shd/--hl now map onto the
     soft modern palette instead of ink edges and offset shadows. */
  --brand:#131A2E;
  --brand-fg:#FFFFFF;
  --hl:var(--accent);
  --hl-fg:var(--accent-fg);
  --edge:var(--line-2);
  --shd:rgba(19,26,46,.10);
  --grid:rgba(19,26,46,.035);
  --margin:rgba(91,75,232,.16);

  /* shape */
  --r-sm:10px;
  --r:12px;
  --r-lg:16px;
  --r-xl:20px;
  --r-pill:999px;
  --tap:44px;

  /* elevation: subtle, never heavy */
  --shadow-1:0 1px 2px rgba(19,26,46,.06), 0 1px 3px rgba(19,26,46,.04);
  --shadow-2:0 2px 6px rgba(19,26,46,.07), 0 8px 20px rgba(19,26,46,.06);
  --shadow-3:0 12px 32px rgba(19,26,46,.14);
  --shadow:var(--shadow-2);

  /* typography */
  --font-ar:'Cairo','Readex Pro',system-ui,-apple-system,'Segoe UI',Tahoma,sans-serif;
  --font-en:'Inter','Plus Jakarta Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --font-mono:ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace;
  --display:var(--font-ar);
  --body:var(--font-ar);

  --fs-h1:26px;
  --fs-h2:21px;
  --fs-h3:17px;
  --fs-body:16px;
  --fs-sm:13px;
  --fs-xs:12px;
  --lh-body:1.65;
  --lh-tight:1.35;

  /* motion */
  --t-fast:120ms;
  --t:200ms;
  --ease:cubic-bezier(.22,.61,.36,1);

  /* decorative background art */
  --bg-line:rgba(19,26,46,.05);
  --bg-line-strong:rgba(91,75,232,.14);

  /* layout */
  --gutter:16px;
  --shell:560px;
  --shell-wide:920px;
  --nav-h:64px;
  --sat:env(safe-area-inset-top,0px);
  --sab:env(safe-area-inset-bottom,0px);
  --sal:env(safe-area-inset-left,0px);
  --sar:env(safe-area-inset-right,0px);

  color-scheme:light;
}

/* English UI: swap the whole stack to the Latin face, same scale */
[lang="en"]{
  --display:var(--font-en);
  --body:var(--font-en);
}

/* dark theme, applied explicitly or by the OS (auto) */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0F1419;
    --bg-2:#0B1015;
    --surface:#161C24;
    --surface-2:#1A212B;
    --raised:#202836;
    --overlay:rgba(3,6,10,.62);
    --line:#28313F;
    --line-2:#333E4E;
    --fg:#EEF1F7;
    --fg-2:#CFD6E4;
    --muted:#9AA6BC;
    --accent:#9C8FFF;
    --accent-2:#B4A9FF;
    --accent-fg:#0C1020;
    --accent-soft:#262046;
    --accent-soft-2:#2E2757;
    --secondary:#4FD6C2;
    --secondary-soft:#12332F;
    --ok:#4FD1A0; --ok-bg:#12362B;
    --err:#FF8A8A; --err-bg:#3B1A1F;
    --warn:#F0C25C; --warn-bg:#3A2F10;
    --info:#8CC0F5; --info-bg:#14283D;
    --brand:#EEF1F7; --brand-fg:#0C1020;
    --hl:var(--accent); --hl-fg:var(--accent-fg);
    --edge:var(--line-2);
    --shd:rgba(0,0,0,.5);
    --grid:rgba(255,255,255,.035);
    --margin:rgba(156,143,255,.18);
    --bg-line:rgba(255,255,255,.05);
    --bg-line-strong:rgba(156,143,255,.18);
    --shadow-1:0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
    --shadow-2:0 2px 8px rgba(0,0,0,.45), 0 10px 24px rgba(0,0,0,.35);
    --shadow-3:0 16px 40px rgba(0,0,0,.55);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0F1419; --bg-2:#0B1015; --surface:#161C24; --surface-2:#1A212B; --raised:#202836;
  --overlay:rgba(3,6,10,.62); --line:#28313F; --line-2:#333E4E;
  --fg:#EEF1F7; --fg-2:#CFD6E4; --muted:#9AA6BC;
  --accent:#9C8FFF; --accent-2:#B4A9FF; --accent-fg:#0C1020;
  --accent-soft:#262046; --accent-soft-2:#2E2757;
  --secondary:#4FD6C2; --secondary-soft:#12332F;
  --ok:#4FD1A0; --ok-bg:#12362B; --err:#FF8A8A; --err-bg:#3B1A1F;
  --warn:#F0C25C; --warn-bg:#3A2F10; --info:#8CC0F5; --info-bg:#14283D;
  --brand:#EEF1F7; --brand-fg:#0C1020; --hl:var(--accent); --hl-fg:var(--accent-fg);
  --edge:var(--line-2); --shd:rgba(0,0,0,.5);
  --grid:rgba(255,255,255,.035); --margin:rgba(156,143,255,.18);
  --bg-line:rgba(255,255,255,.05); --bg-line-strong:rgba(156,143,255,.18);
  --shadow-1:0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --shadow-2:0 2px 8px rgba(0,0,0,.45), 0 10px 24px rgba(0,0,0,.35);
  --shadow-3:0 16px 40px rgba(0,0,0,.55);
  color-scheme:dark;
}
:root[data-theme="light"]{color-scheme:light}

/* ----------------------------------------------------------------- reset --- */
*,*::before,*::after{box-sizing:border-box}
html{
  -webkit-text-size-adjust:100%;
  scroll-padding-top:calc(var(--sat) + 68px);
  background-color:var(--bg);
}

/* ------------------------------------------------ decorative background --- */
/* A fixed art layer behind the whole app: blurred colour orbs, a faint grid
   and flowing line work. Everything uses theme tokens, so it adapts to both
   light and dark mode without ever fighting the content for attention. */
.bg-art{position:fixed;inset:0;z-index:-1;pointer-events:none;overflow:hidden;background:var(--bg)}
.bg-glow{position:absolute;display:block;border-radius:50%;filter:blur(80px)}
.bg-glow.g1{
  width:min(62vw,780px);height:min(62vw,780px);left:-14vw;top:-18vw;
  background:radial-gradient(circle,var(--accent) 0%,transparent 68%);opacity:.55;
}
.bg-glow.g2{
  width:min(52vw,680px);height:min(52vw,680px);right:-12vw;top:4vh;
  background:radial-gradient(circle,var(--secondary) 0%,transparent 68%);opacity:.34;
}
.bg-glow.g3{
  width:min(72vw,900px);height:min(50vw,640px);left:20vw;bottom:-26vh;
  background:radial-gradient(circle,var(--accent-2) 0%,transparent 70%);opacity:.32;
}
.bg-grid{
  position:absolute;inset:0;
  background-image:
    linear-gradient(to right,var(--bg-line) 1px,transparent 1px),
    linear-gradient(to bottom,var(--bg-line) 1px,transparent 1px);
  background-size:48px 48px;
  -webkit-mask-image:linear-gradient(to bottom,transparent,black 14%,black 82%,transparent);
  mask-image:linear-gradient(to bottom,transparent,black 14%,black 82%,transparent);
}
.bg-lines{
  position:absolute;inset:0;width:100%;height:100%;
  fill:none;stroke:var(--bg-line-strong);stroke-width:1.4;stroke-linecap:round;
}

body{
  margin:0;
  padding:0;
  padding-inline:var(--gutter);
  padding-inline-start:calc(var(--gutter) + var(--sal));
  padding-inline-end:calc(var(--gutter) + var(--sar));
  padding-bottom:calc(28px + var(--sab));
  min-height:100dvh;
  background:transparent;
  color:var(--fg);
  font-family:var(--body);
  font-size:var(--fs-body);
  line-height:var(--lh-body);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
@supports (min-height:100svh){body{min-height:100svh}}
img,svg,video,canvas{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}
p{margin:0}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit;line-height:inherit}
button{touch-action:manipulation}
a{color:var(--accent)}

@media (min-width:520px){:root{--gutter:20px}}
@media (min-width:768px){
  :root{--gutter:24px;--fs-h1:30px;--fs-h2:23px;--fs-h3:18px;--nav-h:68px}
}
@media (min-width:1024px){:root{--fs-h1:32px}}

/* ------------------------------------------------------------ typography --- */
h1,h2,h3,h4{
  font-family:var(--display);
  font-weight:700;
  margin:0;
  line-height:var(--lh-tight);
  text-wrap:balance;
  letter-spacing:-.01em;
}
h1{font-size:var(--fs-h1)}
h2{font-size:var(--fs-h2)}
h3{font-size:var(--fs-h3)}
h4{font-size:var(--fs-body)}
.muted{color:var(--muted)}
.sm-t{font-size:var(--fs-sm);line-height:1.5}
.xs-t{font-size:var(--fs-xs);line-height:1.5}
.ltr{direction:ltr;unicode-bidi:isolate}
.num{font-variant-numeric:tabular-nums}
.wrap-any{overflow-wrap:anywhere}

/* -------------------------------------------------------- focus and a11y --- */
:focus{outline:none}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px;border-radius:6px}
.sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (prefers-contrast:more){:root{--muted:#3B4460;--line:#B9C1D4}}

/* ------------------------------------------------------------- skeletons --- */
.sk{position:relative;overflow:hidden;background:var(--raised);border-radius:var(--r-sm)}
.sk::after{
  content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--surface) 60%,transparent),transparent);
  animation:sk-shimmer 1.4s var(--ease) infinite;
}
@keyframes sk-shimmer{100%{transform:translateX(100%)}}
.sk-line{height:12px;margin-block:6px}
.sk-line.lg{height:16px}
.sk-line.sm{height:9px;width:45%}
.sk-av{width:40px;height:40px;border-radius:50%;flex:none}
.sk-card{height:96px;border-radius:var(--r-lg)}
.sk-thumb{aspect-ratio:16/9;border-radius:var(--r-lg);width:100%}
.sk-row{display:flex;align-items:center;gap:12px;padding:12px 0}
.sk-row .sk-col{flex:1;min-width:0}
.sk-btn{height:var(--tap);border-radius:var(--r);width:120px}

/* ---------------------------------------------------------------- motion --- */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
    scroll-behavior:auto !important;
  }
  .sk::after{display:none}
}
