/* هوية «جدولي» (docs/brand.md): الخط وألوان الواجهة وزواياها، في ملف واحد تقرؤه الواجهة (/brand/brand.css)
   وصفحات Django (/static/brand/brand.css). تباين كل نص مع خلفيته 4.5:1 على الأقل، في الوضعين
   (frontend/src/brand.test.ts يحسبه من هذا الملف).
   الفاتح للجميع دائمًا، والداكن باختيار الزائر من زر الوضع فقط (data-theme="dark" على <html>)، لا من إعداد الجهاز. */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/IBMPlexSansArabic-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("fonts/IBMPlexSansArabic-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/IBMPlexSansArabic-Bold.woff2") format("woff2");
}

:root {
  /* الألوان الأربعة المعتمدة */
  --brand-ink: #10302e;
  --brand-teal: #1f6f68;
  --brand-sand: #f4efe6;
  --brand-gold: #c8892b;

  /* الوضع الفاتح */
  --bg: #f4efe6;
  --card: #fffdf9;
  --text: #10302e;
  --heading: #10302e;
  --muted: #55615f;
  --line: #ddd5c7;
  --soft: #e4eeec;
  --accent: #1f6f68;
  --accent-hover: #185a54;
  --on-accent: #ffffff;
  --ok: #1d6b3a;
  --error: #a3261f;
  --warn: #8a5a00;
  --gold: #c8892b;
  /* سطح غامق (رأس الصفحة الرئيسية وأمثاله): نصه رملي */
  --surface-ink: #10302e;
  --on-ink: #f4efe6;
  --on-ink-muted: #b9c6c2;
  --on-ink-accent: #62bdb2;

  --radius-btn: 10px;
  --radius-card: 14px;
  --font: "IBM Plex Sans Arabic", system-ui, "Geeza Pro", "Segoe UI", Tahoma, sans-serif;

  color-scheme: light;
  font-family: var(--font);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* الوضع الداكن باختيار الزائر (frontend/src/theme.ts وcore/theme_head.html). */
:root[data-theme="dark"] {
  --bg: #0d2120;
  --card: #14302e;
  --text: #efe9de;
  --heading: #efe9de;
  --muted: #a8b7b3;
  --line: #2b4744;
  --soft: #1b3b38;
  --accent: #62bdb2;
  --accent-hover: #86cfc6;
  --on-accent: #0d2120;
  --ok: #7fd19b;
  --error: #f29a92;
  --warn: #f0c060;
  --gold: #c8892b;
  --surface-ink: #081716;
  color-scheme: dark;
}

/* الطباعة من المتصفح بالأبيض والأسود كما كانت، وإن كان الزائر على الوضع الداكن. */
@media print {
  :root,
  :root[data-theme="dark"] {
    --bg: #fff;
    --card: #fff;
    --text: #000;
    --heading: #000;
    --muted: #333;
    --line: #999;
    --soft: #fff;
    --accent: #000;
    --accent-hover: #000;
    --on-accent: #fff;
    --surface-ink: #fff;
    --on-ink: #000;
    --on-ink-muted: #333;
    --on-ink-accent: #000;
    color-scheme: light;
  }
}

/* زر الوضع (شمس وقمر) في التطبيق والصفحات العامة وصفحة المعلم: القمر في الفاتح، والشمس في الداكن. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--heading);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--soft);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

@media print {
  .theme-toggle {
    display: none;
  }
}
