@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Thin-FD.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Light-FD.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Regular-FD.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Medium-FD.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Bold-FD.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: VazirLocal;
  src: url("/assets/fonts/Farsi-Digits/Vazir-Black-FD.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070816;
  --bg-soft: rgba(13, 18, 41, 0.75);
  --surface: rgba(15, 20, 47, 0.8);
  --surface-strong: rgba(20, 27, 64, 0.95);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eff3ff;
  --muted: rgba(225, 232, 255, 0.72);
  --soft: rgba(180, 193, 255, 0.42);
  --accent: #9f7aea;
  --accent-2: #38bdf8;
  --accent-3: #22c55e;
  --accent-4: #f59e0b;
  --shadow: 0 24px 80px rgba(3, 5, 14, 0.42);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(140, 92, 255, 0.18), transparent 32%),
    radial-gradient(circle at 85% 18%, rgba(56, 189, 248, 0.16), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(34, 197, 94, 0.11), transparent 30%),
    linear-gradient(180deg, #050612 0%, #080b1a 40%, #050612 100%);
  color: var(--text);
  font-family: VazirLocal, "Vazir FD", "Vazirmatn", "Segoe UI", sans-serif;
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.doc-page {
  padding: 88px 26px 48px;
  color-scheme: dark;
}

body.doc-page[data-theme="light"] {
  color-scheme: light;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.12), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(14, 165, 233, 0.08), transparent 24%),
    linear-gradient(180deg, #f7fafc 0%, #edf2f7 48%, #e2e8f0 100%);
  color: #0f172a;
}

body.doc-page a {
  color: #7dd3fc;
}

body.doc-page[data-theme="light"] a {
  color: #2563eb;
}

body.doc-page a:hover {
  color: #c4b5fd;
}

body.doc-page[data-theme="light"] a:hover {
  color: #7c3aed;
}

body.doc-page h1,
body.doc-page h2,
body.doc-page h3,
body.doc-page h4,
body.doc-page h5,
body.doc-page h6 {
  color: #f8fbff;
}

body.doc-page[data-theme="light"] h1,
body.doc-page[data-theme="light"] h2,
body.doc-page[data-theme="light"] h3,
body.doc-page[data-theme="light"] h4,
body.doc-page[data-theme="light"] h5,
body.doc-page[data-theme="light"] h6 {
  color: #0f172a;
}

body.doc-page hr,
body.doc-page h1,
body.doc-page table > thead > tr > th,
body.doc-page table > tbody > tr + tr > td {
  border-color: rgba(255, 255, 255, 0.14);
}

body.doc-page[data-theme="light"] hr,
body.doc-page[data-theme="light"] h1,
body.doc-page[data-theme="light"] table > thead > tr > th,
body.doc-page[data-theme="light"] table > tbody > tr + tr > td {
  border-color: rgba(15, 23, 42, 0.14);
}

body.doc-page blockquote {
  background: rgba(125, 211, 252, 0.08);
  border-left-color: rgba(125, 211, 252, 0.55);
}

body.doc-page[data-theme="light"] blockquote {
  background: rgba(37, 99, 235, 0.08);
  border-left-color: rgba(37, 99, 235, 0.45);
}

body.doc-page code {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: #e2e8f0;
  padding: 0.15rem 0.35rem;
}

body.doc-page[data-theme="light"] code {
  background: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.35);
  color: #0f172a;
}

body.doc-page pre:not(.hljs),
body.doc-page pre.hljs code > div {
  background: rgba(2, 6, 23, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
}

body.doc-page[data-theme="light"] pre:not(.hljs),
body.doc-page[data-theme="light"] pre.hljs code > div {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

/* Extra credit sections (star/premium sections) */
body.doc-page div[style*="background-color: #fffacd"] {
  background-color: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.5) !important;
}

body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] {
  background-color: #fffacd !important;
  border-color: #ffcc00 !important;
}

body.doc-page div[style*="background-color: #fffacd"] strong {
  color: #60a5fa !important;
}

body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] strong {
  color: #ff9800 !important;
}

body.doc-page div[style*="background-color: #fffacd"] p,
body.doc-page div[style*="background-color: #fffacd"] ul,
body.doc-page div[style*="background-color: #fffacd"] li {
  color: #e2e8f0 !important;
}

body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] p,
body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] ul,
body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] li {
  color: #000000 !important;
}

/* Yellow highlighted code in extra credit sections */
body.doc-page div[style*="background-color: #fffacd"] code {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(100, 116, 139, 0.4);
  color: #cbd5e1;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

body.doc-page[data-theme="light"] div[style*="background-color: #fffacd"] code {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #000000 !important;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

/* HLJS Dark Mode */
body.doc-page[data-theme="dark"] .hljs {
  color: #e2e8f0 !important;
  background: rgba(30, 41, 59, 0.8) !important;
}

body.doc-page[data-theme="dark"] .hljs-comment,
body.doc-page[data-theme="dark"] .hljs-quote {
  color: #64748b !important;
}

body.doc-page[data-theme="dark"] .hljs-variable,
body.doc-page[data-theme="dark"] .hljs-template-variable,
body.doc-page[data-theme="dark"] .hljs-tag,
body.doc-page[data-theme="dark"] .hljs-name,
body.doc-page[data-theme="dark"] .hljs-selector-id,
body.doc-page[data-theme="dark"] .hljs-selector-class,
body.doc-page[data-theme="dark"] .hljs-regexp,
body.doc-page[data-theme="dark"] .hljs-deletion {
  color: #f87171 !important;
}

body.doc-page[data-theme="dark"] .hljs-number,
body.doc-page[data-theme="dark"] .hljs-built_in,
body.doc-page[data-theme="dark"] .hljs-builtin-name,
body.doc-page[data-theme="dark"] .hljs-literal,
body.doc-page[data-theme="dark"] .hljs-type,
body.doc-page[data-theme="dark"] .hljs-params,
body.doc-page[data-theme="dark"] .hljs-meta,
body.doc-page[data-theme="dark"] .hljs-link {
  color: #fb923c !important;
}

body.doc-page[data-theme="dark"] .hljs-attribute {
  color: #fbbf24 !important;
}

body.doc-page[data-theme="dark"] .hljs-string,
body.doc-page[data-theme="dark"] .hljs-symbol,
body.doc-page[data-theme="dark"] .hljs-bullet,
body.doc-page[data-theme="dark"] .hljs-addition {
  color: #86efac !important;
}

body.doc-page[data-theme="dark"] .hljs-title,
body.doc-page[data-theme="dark"] .hljs-section {
  color: #60a5fa !important;
}

body.doc-page[data-theme="dark"] .hljs-keyword,
body.doc-page[data-theme="dark"] .hljs-selector-tag {
  color: #c084fc !important;
}

/* HLJS Light Mode */
body.doc-page[data-theme="light"] .hljs {
  color: #0f172a !important;
  background: rgba(241, 245, 250, 0.95) !important;
}

body.doc-page[data-theme="light"] .hljs-comment,
body.doc-page[data-theme="light"] .hljs-quote {
  color: #64748b !important;
}

body.doc-page[data-theme="light"] .hljs-variable,
body.doc-page[data-theme="light"] .hljs-template-variable,
body.doc-page[data-theme="light"] .hljs-tag,
body.doc-page[data-theme="light"] .hljs-name,
body.doc-page[data-theme="light"] .hljs-selector-id,
body.doc-page[data-theme="light"] .hljs-selector-class,
body.doc-page[data-theme="light"] .hljs-regexp,
body.doc-page[data-theme="light"] .hljs-deletion {
  color: #dc2626 !important;
}

body.doc-page[data-theme="light"] .hljs-number,
body.doc-page[data-theme="light"] .hljs-built_in,
body.doc-page[data-theme="light"] .hljs-builtin-name,
body.doc-page[data-theme="light"] .hljs-literal,
body.doc-page[data-theme="light"] .hljs-type,
body.doc-page[data-theme="light"] .hljs-params,
body.doc-page[data-theme="light"] .hljs-meta,
body.doc-page[data-theme="light"] .hljs-link {
  color: #ea580c !important;
}

body.doc-page[data-theme="light"] .hljs-attribute {
  color: #b45309 !important;
}

body.doc-page[data-theme="light"] .hljs-string,
body.doc-page[data-theme="light"] .hljs-symbol,
body.doc-page[data-theme="light"] .hljs-bullet,
body.doc-page[data-theme="light"] .hljs-addition {
  color: #16a34a !important;
}

body.doc-page[data-theme="light"] .hljs-title,
body.doc-page[data-theme="light"] .hljs-section {
  color: #2563eb !important;
}

body.doc-page[data-theme="light"] .hljs-keyword,
body.doc-page[data-theme="light"] .hljs-selector-tag {
  color: #7c3aed !important;
}

/* Improve general code block styling */
body.doc-page code {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #cbd5e1;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

body.doc-page[data-theme="light"] code {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #000000;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
}

body.doc-page .back-button,
body.doc-page .theme-toggle {
  position: fixed;
  top: 18px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #f8fbff;
  text-decoration: none;
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(16px);
  cursor: pointer;
  font: inherit;
}

body.doc-page .back-button {
  right: 18px;
}

body.doc-page .theme-toggle {
  right: 186px;
}

body.doc-page[data-theme="light"] .back-button,
body.doc-page[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
}

body.doc-page .back-button:hover,
body.doc-page .theme-toggle:hover {
  border-color: rgba(125, 211, 252, 0.5);
  background: rgba(15, 23, 42, 0.94);
  text-decoration: none;
}

body.doc-page[data-theme="light"] .back-button:hover,
body.doc-page[data-theme="light"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(37, 99, 235, 0.35);
}

body.doc-page .back-button:focus-visible,
body.doc-page .theme-toggle:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
}

body.doc-page[data-theme="light"] .back-button:focus-visible,
body.doc-page[data-theme="light"] .theme-toggle:focus-visible {
  outline-color: #2563eb;
}