/* رصيد — مدونة الشرح */
:root {
  --gold: #c9a84c;
  --gold-light: #e2d1a4;
  --gold-dim: #8a7336;
  --bg: #030712;
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.1);
  --muted: #94a3b8;
  --text: #f1f5f9;
  --accent: #3b82f6;
  --emerald: #10b981;
  --font-body: 'Cairo', system-ui, sans-serif;
  --font-display: 'Tajawal', system-ui, sans-serif;
  --radius: 1.25rem;
  --nav-h: 4.25rem;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.92);
  --border: rgba(15, 23, 42, 0.12);
  --muted: #64748b;
  --text: #0f172a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  padding-top: calc(var(--nav-h) + 1rem);
  transition: background 0.35s, color 0.35s;
}

a { color: var(--gold); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.92; text-decoration: underline; }

/* Background */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 85% -10%, rgba(201, 168, 76, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(59, 130, 246, 0.1), transparent),
    var(--bg);
  pointer-events: none;
}

/* Nav */
.blog-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2rem);
  background: rgba(10, 15, 25, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .blog-nav {
  background: rgba(248, 250, 252, 0.9);
}

.blog-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.blog-nav__brand:hover { text-decoration: none; opacity: 1; }

.blog-nav__brand small {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
}

.gold-grad {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-nav__links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.blog-nav__links a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}
.blog-nav__links a:hover { color: var(--gold); }

.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Layout */
.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding-bottom: 4rem;
}

/* Index hero */
.hero {
  text-align: center;
  padding: 2.5rem 0 3rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 900;
  line-height: 1.15;
  margin: 0 0 1rem;
}
.hero .lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 38rem;
  margin: 0 auto 2rem;
}

.category-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.35s cubic-bezier(0.34, 1.45, 0.64, 1), border-color 0.25s, box-shadow 0.35s;
  position: relative;
  overflow: hidden;
}
.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(201, 168, 76, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.category-card:hover {
  transform: translateY(-6px);
  border-color: rgba(201, 168, 76, 0.45);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.22);
}
.category-card:hover::before { opacity: 1; }

.category-card h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.category-card .emoji { font-size: 1.5rem; line-height: 1; }

.category-card ul {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.category-card li {
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}
.category-card li a {
  color: var(--text);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.category-card li a::before {
  content: '←';
  font-size: 0.75rem;
  opacity: 0.5;
}

/* Article */
article.doc {
  max-width: 820px;
  margin-inline: auto;
}

.doc-header {
  margin-bottom: 2rem;
}
.doc-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}
.doc .lede {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--gold); }

.shot {
  margin: 1.75rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.shot img {
  width: 100%;
  display: block;
  vertical-align: middle;
}
.shot figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* Placeholder when image missing */
.shot .shot__ph {
  display: none;
  min-height: 220px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  padding: 2rem;
  background: linear-gradient(145deg, rgba(201, 168, 76, 0.08), rgba(59, 130, 246, 0.06));
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--muted);
  text-align: center;
}
.shot-missing .shot__ph {
  display: flex !important;
}
.shot-missing img { display: none; }

.doc section {
  margin: 2rem 0;
}
.doc h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid rgba(201, 168, 76, 0.35);
}
.doc h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}
.doc p { margin: 0 0 0.9rem; }
.doc ul, .doc ol { margin: 0 0 1rem; padding-inline-start: 1.35rem; }
.doc li { margin-bottom: 0.4rem; }

.callout {
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(201, 168, 76, 0.08);
  margin: 1.5rem 0;
  font-weight: 600;
}
.callout--tip {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}
.callout--route {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  direction: ltr;
  text-align: left;
  unicode-bidi: embed;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: 2.5rem;
  margin-bottom: 1rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  right: 0;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #0a0a0a;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pager a {
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.pager a:hover {
  border-color: var(--gold);
  text-decoration: none;
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(201, 168, 76, 0.2);
  color: var(--gold-light);
  margin-bottom: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
