/* ChemLab / كيمياء لاب — تصميم متجاوب ثنائي الاتجاه (RTL/LTR) */
:root {
  --bg: #0b1021;
  --surface: #131a33;
  --surface-2: #1c2545;
  --text: #eef2ff;
  --muted: #9aa3c4;
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --border: #2d3a6b;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --motion: 0.3s;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Tahoma, "Noto Sans Arabic", "Segoe UI Arabic", Arial, sans-serif;
}
[data-theme="light"] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0891b2;
  --accent-hover: #0369a1;
  --border: #cbd5e1;
  --shadow: 0 8px 24px rgba(15,23,42,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  direction: rtl;
}
[dir="ltr"] body { direction: ltr; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
.shell { max-width: 980px; margin-inline: auto; padding: 0 16px; }

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

/* Header */
header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; }
.logo span { font-size: 0.85rem; opacity: 0.8; font-weight: 600; }
.icon-btn { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 1.1rem; }
.icon-btn:hover { background: var(--surface-2); }

/* Nav */
header nav { padding: 10px 0; border-bottom: 1px solid var(--border); }
header nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
header nav a { padding: 8px 14px; border-radius: 10px; font-size: 0.95rem; border: 1px solid transparent; white-space: nowrap; }
header nav a:hover { background: var(--surface-2); border-color: var(--border); }
header nav a.active { background: var(--accent); color: #001522; border-color: var(--accent); }
header nav a[aria-current="page"] { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Main */
main { padding: 24px 0 80px; min-height: 40vh; }
footer { margin-top: 40px; padding: 24px 0; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--border); text-align: center; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 10px; font-size: 1.25rem; color: var(--accent); }
.card h3 { margin: 12px 0 6px; font-size: 1.05rem; color: var(--text); }
.card p { color: var(--muted); margin-bottom: 10px; }
ul { margin-inline-start: 1.2rem; margin-bottom: 10px; }
[dir="ltr"] ul { margin-inline-start: 0; margin-inline-end: 1.2rem; }
li { margin-bottom: 5px; color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.btn { display: inline-block; padding: 10px 16px; background: var(--accent); color: #001522; border-radius: 10px; font-weight: 700; font-size: 0.95rem; border: none; cursor: pointer; transition: background var(--motion); }
.btn:hover { background: var(--accent-hover); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }

/* Home */
.hero { text-align: center; padding: 40px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin-bottom: 24px; }
.hero h1 { font-size: 2rem; margin-bottom: 10px; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin-inline: auto; }

/* Branches list */
.branch-card { cursor: pointer; transition: transform .15s, border-color .15s; }
.branch-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.branch-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.badge { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; user-select: none; }
.badge:hover { border-color: var(--accent); }
.badge.active { background: var(--accent); color: #001522; font-weight: 700; border-color: var(--accent); }

/* Branch detail */
.meta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.meta { background: var(--surface-2); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; font-size: 0.85rem; color: var(--muted); }

/* Glossary */
.search-wrap { margin-bottom: 16px; position: relative; }
.search-wrap input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.95rem; }
.search-wrap input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.term-item { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.term-item:hover { background: var(--surface-2); }
.term-name { font-weight: 700; color: var(--accent); }
.term-en { color: var(--muted); font-size: 0.9rem; }

/* Stub */
.stub { text-align: center; padding: 60px 16px; color: var(--muted); }
.stub h2 { margin-bottom: 8px; color: var(--text); }

/* Periodic table */
.pt-cell { border: 1px solid var(--border); border-radius: 6px; padding: 6px 2px; text-align: center; font-size: 11px; cursor: pointer; background: var(--surface); transition: all var(--motion); }
.pt-cell:hover { background: var(--surface-2); border-color: var(--accent); transform: scale(1.05); z-index: 5; position: relative; }
.pt-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pt-cell.metal { border-left: 3px solid #3b82f6; }
.pt-cell.nonmetal { border-left: 3px solid #a855f7; }
.pt-cell.noble { border-left: 3px solid #22d3ee; }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.badge-new { background: var(--accent); color: #001522; font-weight: 700; }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: 1fr; }
  header nav a { padding: 8px 10px; font-size: 0.9rem; }
  .toolbar { gap: 8px; }
}
</content>
