/* دوسية الطيف في الكيمياء — هوية العرض الداكنة
   من config/presentation-design-tokens.json */
:root {
  --bg: #05101F;
  --bg-alt: #0A1B33;
  --panel: #0E2440;
  --panel-light: #14305A;
  --deep: #0B3B67;
  --navy: #082A49;
  --white: #FFFFFF;
  --text: #ECF4FC;
  --muted: #93ADC6;
  --accent: #6FC7F2;
  --accent-soft: #3E86C0;
  --line: #1D3A5F;
  --ph-border: #C0392B;
  --ph-bg: rgba(192, 57, 43, 0.14);
  --c-before: #7FD1F7; --c-definition: #8BC48A; --c-law: #C9A8E0;
  --c-example: #F79646; --c-exercise: #45B8AC; --c-note: #F2C14E; --c-sources: #9AA5AE;
  --radius: 14px;
  --line-ease: cubic-bezier(0.33, 1, 0.68, 1);
}

.reveal-viewport { background: var(--bg); }
.reveal {
  font-family: 'Tajawal', 'Tahoma', 'Segoe UI', sans-serif;
  font-size: 34px;
  direction: rtl;
}
.reveal .slides { text-align: right; }
/* Reveal 6: لا يفرض ارتفاعًا ثابتًا للأقسام — نثبته ليعمل التمركز والمقاس 1280×720 */
.reveal .slides > section { height: 720px; }
.reveal .slides > section > .slide-body { height: 100%; box-sizing: border-box; }
.reveal .slide-number {
  direction: ltr; right: auto; left: 10px; bottom: 8px;
  font-family: 'Tajawal', sans-serif; font-size: 15px;
  background: rgba(8, 42, 73, .8); color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px;
}
.reveal .progress {
  top: 0; bottom: auto; height: 4px; color: var(--accent);
}
.reveal .controls { direction: ltr; }

/* ---------- أجزاء عامة ---------- */
.kicker {
  display: inline-block; font-size: 15px; letter-spacing: .3px;
  color: var(--accent); border: 1px solid var(--accent-soft);
  border-radius: 999px; padding: 3px 14px; margin-bottom: 10px;
  background: rgba(111, 199, 242, .08);
}
.chip {
  display: inline-block; font-size: 15px; font-weight: 700;
  color: var(--cat, var(--accent)); background: var(--chip-bg, rgba(111,199,242,.12));
  border: 1px solid color-mix(in srgb, var(--cat, var(--accent)) 45%, transparent);
  border-radius: 999px; padding: 4px 16px; margin-bottom: 12px;
}
h1.h-hero {
  font-size: 54px; font-weight: 800; color: var(--white);
  line-height: 1.25; margin: 12px 0;
}
h2.h-title { font-size: 34px; font-weight: 800; color: var(--white); margin: 0 0 18px; }
h2.h-title .t-underline {
  display: block; width: 64px; height: 4px; border-radius: 2px;
  background: var(--cat, var(--accent)); margin-top: 10px;
}
h3.g-sectionnum {
  font-size: 46px; color: var(--accent); opacity: .9; margin: 0; font-weight: 800;
}
p, li { color: var(--text); line-height: 1.7; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 26px;
}
.panel.accentbar { border-right: 5px solid var(--cat, var(--accent)); }

ul.g-list { list-style: none; margin: 0; padding: 0; }
ul.g-list li {
  position: relative; padding-right: 26px; margin-bottom: 12px; font-size: 21px;
}
ul.g-list li::before {
  content: ''; position: absolute; right: 2px; top: 13px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cat, var(--accent));
}

/* ---------- شبكات ---------- */
.g-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.g-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.g-center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.g-visual { display: flex; flex-direction: column; align-items: center; }
.g-visual figcaption { font-size: 15px; color: var(--muted); margin-top: 10px; text-align: center; max-width: 92%; }

/* ---------- تعريف/قانون/مفهوم ---------- */
.def-card {
  background: var(--cat, var(--accent)); border-radius: var(--radius);
  padding: 30px 34px; margin: 0 auto; max-width: 1050px;
}
.def-card .d-term { font-size: 30px; font-weight: 800; color: var(--bg); margin: 0 0 10px; }
.def-card .d-text { font-size: 22px; color: #10243C; line-height: 1.75; margin: 0; }
.def-card .d-en { font-size: 18px; font-weight: 700; color: rgba(9, 26, 45, .75); }

.symbols { margin-top: 16px; }
.symbols .srow {
  display: flex; gap: 14px; align-items: baseline; padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.symbols .srow:last-child { border-bottom: none; }
.symbols .ssym { min-width: 110px; font-weight: 800; color: var(--cat, var(--accent)); direction: ltr; text-align: right; font-size: 21px; }
.symbols .smea { flex: 1; font-size: 19px; color: var(--text); }
.symbols .sunit { color: var(--muted); font-size: 17px; direction: ltr; }

.formula-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-right: 5px solid var(--cat, var(--accent));
  border-radius: var(--radius); padding: 20px 30px; text-align: center;
}
.formula-panel svg.mathsvg { height: 44px; max-width: 100%; }
.formula-panel .f-cap { font-size: 16px; color: var(--muted); margin-top: 6px; }

/* ---------- خطوات الحل ---------- */
.steps { counter-reset: stp; }
.steps .stp {
  position: relative; padding: 12px 62px 12px 18px; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.steps .stp::before {
  counter-increment: stp; content: counter(stp);
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--cat, var(--accent)); color: var(--bg);
  font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.steps .stp .stp-label { font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: .4px; }
.steps .stp .stp-text { font-size: 20px; color: var(--text); }
.steps .stp.final { border-color: var(--c-example); background: rgba(247, 150, 70, .1); }
.steps .stp.final .stp-text { font-weight: 800; color: var(--c-example); }

/* ---------- جدول ---------- */
.g-table { border-collapse: collapse; margin: 0 auto; width: 100%; max-width: 1080px; }
.g-table th {
  background: var(--deep); color: var(--white); font-weight: 700;
  padding: 10px 16px; font-size: 19px; border: 1px solid var(--line);
}
.g-table td {
  padding: 9px 16px; font-size: 18px; color: var(--text);
  border: 1px solid var(--line); background: rgba(14, 36, 64, .55);
}
.g-table tr:nth-child(even) td { background: rgba(20, 48, 90, .45); }
.g-table .rowhl td { background: rgba(242, 193, 78, .16); font-weight: 700; }

/* ---------- MCQ ---------- */
.quiz-opts { display: grid; gap: 12px; max-width: 900px; margin: 8px auto; }
.quiz-opts .opt {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 20px; font-size: 21px; color: var(--text);
  text-align: right;
}
.quiz-opts .opt .okey {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 36px;
  background: var(--navy); border: 1px solid var(--accent-soft); color: var(--accent);
  font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.quiz-opts .opt.correct { border-color: var(--c-definition); background: rgba(139, 196, 138, .14); }
.quiz-opts .opt.correct .okey { background: var(--c-definition); color: var(--bg); border-color: transparent; }
.quiz-opts .opt.correct .okey::after { content: '✓'; }
.quiz-opts .opt.correct .okey span { display: none; }

/* ---------- Placeholder صور ---------- */
.ph-box {
  width: 100%; height: 100%; min-height: 300px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: var(--ph-bg);
  border: 2px dashed var(--ph-border); border-radius: var(--radius);
  color: #F3B6AE; text-align: center; padding: 20px;
}
.ph-box .ph-tag { font-size: 24px; font-weight: 800; color: #F0847A; letter-spacing: .5px; }
.ph-box .ph-req {
  font-size: 14px; font-weight: 700; letter-spacing: 1.2px;
  color: #0A1B33; background: #F0847A; border-radius: 999px;
  padding: 3px 14px;
}
.ph-box .ph-name { font-size: 15px; color: var(--muted); direction: ltr; }

/* صورة مولدة التُقطت تلقائيًا داخل حاوية الـplaceholder نفسها */
.ph-resolved-host {
  width: 100%; height: 100%; min-height: 300px;
  position: relative; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); overflow: hidden;
  background: rgba(8, 42, 73, .5); border: 1px solid var(--line);
}
.ph-resolved { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ph-resolved img {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; border-radius: var(--radius); display: block;
}
.ph-badge {
  position: absolute; top: 8px; left: 8px; z-index: 5;
  font-size: 12px; font-weight: 700; letter-spacing: .6px; direction: ltr;
  color: var(--muted); background: rgba(8, 42, 73, .85);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px;
}

/* ---------- زر الشاشة الكاملة ---------- */
#g-fs-btn {
  position: fixed; bottom: 46px; left: 14px; z-index: 60;
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: rgba(8, 42, 73, .8);
  border: 1px solid var(--line); cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s;
}
#g-fs-btn:hover { color: var(--accent); border-color: var(--accent-soft); transform: scale(1.06); }

/* ---------- SVG عام ---------- */
svg.fig { max-width: 100%; max-height: 480px; height: auto; }
svg.fig text, svg .lbl { font-family: 'Tajawal', 'Tahoma', sans-serif; fill: var(--text); }
svg .lbl-muted { fill: var(--muted); }
svg .lbl-strong { fill: var(--white); font-weight: 700; }
svg .hl-target { transition: filter .3s; }
svg .hl {
  filter: drop-shadow(0 0 6px rgba(242, 193, 78, .95));
}
svg .hl.fill-target { fill: var(--c-note); }

/* ---------- D3 ---------- */
.g-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.d3-holder { width: 100%; max-width: 660px; height: auto; }
.g3-axis { stroke: var(--muted); stroke-width: 2; }
.g3-gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.g3-tick { stroke: var(--muted); }
.g3-num { fill: var(--muted); font-size: 15px; font-family: 'Tajawal', sans-serif; }
.g3-label { fill: var(--text); font-size: 18px; font-family: 'Tajawal', sans-serif; font-weight: 700; }
.g3-curve { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.g3-point { fill: var(--accent); stroke: var(--bg); stroke-width: 2; cursor: pointer; }
.g3-refline { stroke: var(--c-note); stroke-width: 2; stroke-dasharray: 8 6; }
.g3-reflabel { fill: var(--c-note); font-size: 15px; font-family: 'Tajawal', sans-serif; }
.g3-annring { fill: none; stroke: var(--c-example); stroke-width: 2.5; }
.g3-annlabel { fill: var(--c-example); font-size: 16px; font-family: 'Tajawal', sans-serif; font-weight: 700; direction: ltr; unicode-bidi: isolate; }
svg .sub { font-size: 0.72em; baseline-shift: sub; }
.d3-tip {
  display: none; position: absolute; z-index: 30; pointer-events: none;
  background: var(--navy); border: 1px solid var(--accent-soft); border-radius: 10px;
  padding: 8px 14px; font-size: 16px; color: var(--text); direction: rtl; white-space: nowrap;
}

/* ---------- تجربة ---------- */
.exp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.exp-cols h4 { color: var(--cat, var(--accent)); font-size: 20px; margin: 8px 0 8px; }
.exp-cols ul { margin: 0; }

/* ---------- مقارنة ---------- */
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.cmp .col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.cmp .col h4 { color: var(--col, var(--accent)); margin: 0 0 10px; font-size: 20px; }
.cmp .col ul { margin: 0; }

/* ---------- فوتر الشريحة ---------- */
.slide-footer {
  position: absolute; bottom: 10px; right: 40px; left: 40px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 6px;
}
.slide-footer .f-brand { font-weight: 700; }
.reveal .slide.rtl-guarantee { direction: rtl; }

/* ---------- بنية الشريحة ---------- */
.reveal .slides section .slide-body {
  position: relative; height: 100%;
  padding: 30px 56px 48px;
}
.g-frag.fragment {
  position: absolute; width: 2px; height: 2px;
  opacity: 0; pointer-events: none; left: 0; bottom: 0;
}
.m-svg svg { vertical-align: middle; }
.m-holder { display: inline-block; }
/* معادلات MathJax: حبر فاتح على الداكن + عدم فيض العرض */
.m-svg { color: var(--text); max-width: 100%; display: inline-block; }
.m-svg svg { color: var(--text); max-width: 100%; height: auto; }
.formula-panel { overflow-x: auto; max-width: 100%; }
.formula-panel .m-svg svg { max-height: 64px; }

/* ---------- ألوان التصنيف لكل شريحة ---------- */
section[data-category="definition"] { --cat: var(--c-definition); }
section[data-category="law"]        { --cat: var(--c-law); }
section[data-category="example"]    { --cat: var(--c-example); }
section[data-category="exercise"]   { --cat: var(--c-exercise); }
section[data-category="note"]       { --cat: var(--c-note); }
section[data-category="before"]     { --cat: var(--c-before); }
section[data-category="sources"]    { --cat: var(--c-sources); }

.def-card { background: var(--cat, var(--c-definition)); }
section[data-category="definition"] .chip { --cat: var(--c-definition); --chip-bg: rgba(139,196,138,.12); }
section[data-category="exercise"] .chip { --cat: var(--c-exercise); --chip-bg: rgba(69,184,172,.12); }
section[data-category="note"] .chip { --cat: var(--c-note); --chip-bg: rgba(242,193,78,.12); }
section[data-category="example"] .chip { --cat: var(--c-example); --chip-bg: rgba(247,150,70,.12); }

.g-visual svg.fig { max-width: 100%; max-height: 470px; }
.g-visual .panel svg { max-height: 200px; }

/* حاوية شريحة العنوان — زخرفة خطية هادئة */
section[data-slide-id$="01"] .slide-body::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% -10%, rgba(11, 59, 103, .55), transparent 55%),
    radial-gradient(ellipse at 90% 110%, rgba(11, 59, 103, .45), transparent 50%);
}

