/* scrapy.ir — shared styles */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --accent: #48bb78;
  --accent-dim: #38a169;
  --accent-glow: rgba(72, 187, 120, 0.15);
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --border: #2d3a4f;
  --code-bg: #0d1117;
  --code-border: #30363d;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Vazirmatn', system-ui, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  direction: rtl;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #2f855a);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── Hero ── */
.hero-section {
  position: relative;
  overflow: hidden;
  padding: 4rem 1.5rem 5rem;
  text-align: center;
}

.hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(72, 187, 120, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 60%, rgba(72, 187, 120, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.9;
  max-width: 620px;
  margin: 0 auto 2.5rem;
}

/* ── Code editor window ── */
.code-editor {
  max-width: 580px;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #161b22;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  text-align: left;
  direction: ltr;
}

.code-editor-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #1c2128;
  border-bottom: 1px solid var(--border);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.code-filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.code-editor-body {
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
}

.code-editor-body pre {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #c9d1d9;
  white-space: pre;
}

.code-editor-body .keyword { color: #c678dd; }
.code-editor-body .string  { color: #e5c07b; }
.code-editor-body .func    { color: #61afef; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #0f1419;
  box-shadow: 0 4px 16px rgba(72, 187, 120, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(72, 187, 120, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* ── Sections ── */
.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-desc {
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 2.5rem;
}

/* ── Feature grid ── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: rgba(72, 187, 120, 0.4);
  transform: translateY(-3px);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Code block ── */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  margin: 1rem 0;
}

.code-block pre {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #c9d1d9;
  white-space: pre;
}

.code-block .comment { color: #8b949e; }
.code-block .keyword { color: #ff7b72; }
.code-block .string { color: #a5d6ff; }
.code-block .func { color: #d2a8ff; }

/* ── Resource cards (landing) ── */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.resource-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #2f855a);
  opacity: 0;
  transition: opacity 0.2s;
}

.resource-card:hover {
  border-color: rgba(72, 187, 120, 0.5);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.resource-card:hover::before {
  opacity: 1;
}

.resource-tag {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  width: fit-content;
}

.resource-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.resource-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.resource-arrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Doc page layout ── */
.doc-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.doc-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.doc-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.doc-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.doc-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.doc-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
  color: var(--accent);
}

.doc-content p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.doc-content ul, .doc-content ol {
  color: var(--text-muted);
  margin: 0.75rem 1.5rem 1rem 0;
}

.doc-content li {
  margin-bottom: 0.4rem;
}

.doc-content code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  direction: ltr;
  display: inline-block;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead {
  background: var(--bg-card);
}

th {
  padding: 0.75rem 1rem;
  text-align: right;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

td code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  direction: ltr;
  display: inline-block;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── TOC ── */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.toc h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: none;
  counter-reset: toc;
}

.toc ol li {
  counter-increment: toc;
  margin-bottom: 0.35rem;
}

.toc ol li a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.toc ol li a:hover {
  color: var(--accent);
}

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

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .nav-links {
    display: none;
  }

  .hero-section {
    padding: 2.5rem 1.25rem 3.5rem;
  }

  .doc-layout {
    padding: 2rem 1.25rem 4rem;
  }
}
