/* ==========================================================================
   mhmdfouda.com design system — shared by the public site and the workspace.
   Change colours, type and spacing HERE only.
   ========================================================================== */


/* ---- Fonts: IBM Plex, self-hosted from /fonts (SIL Open Font License, see /fonts/OFL-LICENSE.txt).
   No external font service is needed; if a file fails to load, the system fallbacks below keep text readable. ---- */
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/IBMPlexSansArabic-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Arabic'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/IBMPlexSansArabic-Bold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/IBMPlexSans-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/IBMPlexSans-Medium.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/IBMPlexSans-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/IBMPlexSans-Bold.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/IBMPlexMono-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/IBMPlexMono-Medium.woff2') format('woff2'); }

/* ---- Colour: dark (default) ---- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0E12;            /* page */
  --surface: #11151B;       /* panels, tables */
  --surface-2: #161B22;     /* table headers, inputs, hover */
  --surface-3: #1D232C;     /* raised: menus, dialogs */
  --line: rgba(222, 230, 241, .09);
  --line-strong: rgba(222, 230, 241, .17);
  --text: #E7EBF1;
  --text-2: #B6BFCB;
  --muted: #8C96A4;
  --accent: #5C8DF0;
  --accent-strong: #84AAF6;
  --accent-soft: rgba(92, 141, 240, .14);
  --accent-fill: #3B6BDB;   /* filled buttons: white text stays above 4.5:1 */
  --accent-fill-hover: #335FC6;
  --on-accent: #FFFFFF;
  --ok: #46B17F;     --ok-soft: rgba(70, 177, 127, .13);
  --warn: #D6A13F;   --warn-soft: rgba(214, 161, 63, .14);
  --danger: #E06A63; --danger-soft: rgba(224, 106, 99, .13);
  --danger-strong: #B8443D;
  --info: #8C96A4;   --info-soft: rgba(140, 150, 164, .14);
  --pending: #7BA2F4;--pending-soft: rgba(123, 162, 244, .13);
  --overlay: rgba(4, 6, 9, .62);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, .45);
}
/* ---- Colour: light ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F0F2F5;
  --surface-3: #FFFFFF;
  --line: rgba(17, 24, 39, .09);
  --line-strong: rgba(17, 24, 39, .17);
  --text: #121722;
  --text-2: #3A4351;
  --muted: #5E6978;
  --accent: #2F5FD0;
  --accent-strong: #244CAD;
  --accent-soft: rgba(47, 95, 208, .09);
  --accent-fill: #2F5FD0;
  --accent-fill-hover: #244CAD;
  --on-accent: #FFFFFF;
  --ok: #17704A;     --ok-soft: rgba(29, 127, 82, .1);
  --warn: #865C06;   --warn-soft: rgba(176, 122, 18, .12);
  --danger: #C2382F; --danger-soft: rgba(194, 56, 47, .09);
  --danger-strong: #9C2B24;
  --info: #5E6978;   --info-soft: rgba(94, 105, 120, .11);
  --pending: #2F5FD0;--pending-soft: rgba(47, 95, 208, .09);
  --overlay: rgba(17, 24, 39, .38);
  --shadow-1: 0 1px 2px rgba(17, 24, 39, .06);
  --shadow-2: 0 18px 44px rgba(17, 24, 39, .14);
}

/* ---- Type, spacing, shape (theme independent) ---- */
:root {
  --font-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', 'Segoe UI', Tahoma, 'Geeza Pro', 'Noto Sans Arabic', system-ui, sans-serif;
  --font-en: 'IBM Plex Sans', 'IBM Plex Sans Arabic', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --fs-xs: 12px;  --fs-sm: 13.5px; --fs-base: 15px; --fs-md: 17px;
  --fs-lg: 20px;  --fs-xl: 26px;   --fs-2xl: 34px;
  --fs-display: clamp(34px, 4.6vw, 58px);
  --lh-tight: 1.2; --lh: 1.6; --lh-relaxed: 1.8;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s7: 32px; --s8: 40px; --s9: 48px; --s10: 64px; --s11: 80px; --s12: 112px;
  --r-sm: 6px; --r: 8px; --r-lg: 12px; --r-pill: 999px;
  --w-page: 1200px; --w-prose: 680px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 150ms; --t: 220ms;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-en); font-size: var(--fs-base); line-height: var(--lh);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
:root[lang="ar"] body { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--accent-fill); color: var(--on-accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.mono, code { font-family: var(--font-mono); font-size: .93em; }
.num { font-variant-numeric: tabular-nums; }   /* numbers & dates: body font, aligned digits (mono is for codes/refs only) */
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: var(--s4); top: -60px; z-index: 100; background: var(--accent-fill); color: var(--on-accent); padding: var(--s2) var(--s4); border-radius: var(--r); }
.skip:focus { top: var(--s3); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 40px; padding: 0 var(--s4); border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger-strong); color: #fff; }
.btn-lg { height: 48px; padding: 0 var(--s6); font-size: var(--fs-base); }
.btn-sm { height: 32px; padding: 0 var(--s3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-icon { width: 38px; padding: 0; }
.btn svg { flex: none; }
.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---- Badges (status) ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
  background: var(--info-soft); color: var(--text-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.danger-solid { background: var(--danger-strong); color: #fff; }
.badge.pending { background: var(--pending-soft); color: var(--pending); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); }

/* ---- Inputs ---- */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 var(--s3); border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { height: auto; min-height: 88px; padding: var(--s2) var(--s3); resize: vertical; line-height: var(--lh); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }

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