/* =========================================================
   JustBot.ir — stylesheet (light theme)
   Design tokens: soft Telegram-blue-tinted light background,
   white elevated cards, Telegram blue as primary accent
   (grounded in the product itself), amber for secondary CTAs,
   a deliberately dark "terminal" island as the one accent that
   breaks the light theme on purpose (developer motif).
   Vazirmatn for Persian type, JetBrains Mono for code/labels.
   ========================================================= */

:root {
  --bg:            #f4f7fb;
  --bg-soft:       #eaf1f8;
  --surface:       #ffffff;
  --surface-2:     #f6f9fc;
  --ink:           #16212e;
  --ink-dim:       #4d5b6c;
  --ink-faint:     #8492a3;
  --border:        rgba(22, 33, 46, 0.10);
  --border-soft:   rgba(22, 33, 46, 0.06);

  --tg-blue:       #229ed9;
  --tg-blue-2:     #2aabee;
  --tg-blue-soft:  rgba(42, 171, 238, 0.10);
  --amber:         #e08a00;
  --amber-soft:    rgba(224, 138, 0, 0.12);
  --term-green:    #1f9d55;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  --font-body:    'Vazirmatn', sans-serif;
  --font-display: 'Vazirmatn', sans-serif;
  --mono-font:    'JetBrains Mono', 'Vazirmatn', monospace;

  --wrap: 1180px;
  --shadow: 0 10px 30px -14px rgba(22, 33, 46, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(22, 33, 46, 0.22);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; color: var(--ink-dim); }

.mono { font-family: var(--mono-font); }
.muted { color: var(--ink-faint); }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  right: -999px;
  top: 0;
  background: var(--tg-blue);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  z-index: 999;
}
.skip-link:focus { right: 0; }

:focus-visible {
  outline: 2px solid var(--tg-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* background texture: faint grid, subject-appropriate (circuitry/code feel) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 90%);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.96rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--tg-blue-2), var(--tg-blue));
  color: #fff;
  box-shadow: 0 10px 26px -10px rgba(34, 158, 217, 0.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(34, 158, 217, 0.6); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--tg-blue); color: var(--tg-blue); }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; }
.btn-lg { padding: 16px 34px; font-size: 1.05rem; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(244, 247, 251, 0.82);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 14px;
}
.brand { display: flex; align-items: center; }
.brand-logo { height: 34px; width: auto; }

.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a {
  font-size: 0.94rem;
  color: var(--ink-dim);
  position: relative;
  padding-block: 4px;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a::after {
  content: "";
  position: absolute;
  right: 0; bottom: -2px;
  width: 0; height: 2px;
  background: var(--tg-blue);
  transition: width 0.2s ease;
}
.main-nav a:hover::after { width: 100%; }

.header-actions { display: flex; align-items: center; gap: 14px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--ink); display: block; }

/* ---------- hero ---------- */
.hero { padding-block: 64px 88px; }
.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.eyebrow {
  display: inline-block;
  color: var(--term-green);
  font-size: 0.82rem;
  background: rgba(31, 157, 85, 0.08);
  border: 1px solid rgba(31, 157, 85, 0.25);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-copy h1 {
  font-size: clamp(1.9rem, 4.2vw, 3.4rem);
  line-height: 1.28;
  margin-bottom: 22px;
}
.text-accent {
  background: linear-gradient(90deg, var(--tg-blue), var(--term-green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lead { font-size: 1.06rem; max-width: 46ch; margin-bottom: 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 40px; }

.hero-stats {
  display: flex;
  gap: 34px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}
.hero-stats div { display: flex; flex-direction: column; gap: 4px; }
.hero-stats strong { font-family: var(--mono-font); font-size: 1.05rem; color: var(--ink); }
.hero-stats span { font-size: 0.8rem; color: var(--ink-faint); }

/* --- signature element: terminal + chat mockup ---
   Deliberately dark, like a real code editor/terminal — the one
   intentional accent that breaks the light page. */
.hero-visual { position: relative; min-height: 420px; }

.term-window {
  background: #0d1420;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
  max-width: 480px;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #10192a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }
.term-title { margin-inline-start: 10px; font-size: 0.78rem; color: #6b7c93; }
.term-body {
  margin: 0;
  padding: 20px;
  font-size: 0.85rem;
  line-height: 1.75;
  color: #4ee08a;
  min-height: 220px;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-body .cursor { display: inline-block; width: 8px; background: #4ee08a; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.chat-bubble-mock {
  position: absolute;
  bottom: -20px;
  left: -10px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.chat-bubble-mock.show { opacity: 1; transform: translateY(0); }
.chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.chat-head img { width: 28px; height: 28px; border-radius: 50%; background: #fff; padding: 2px; border: 1px solid var(--border); }
.chat-head strong { display: block; font-size: 0.85rem; color: var(--ink); }
.chat-head .online { font-size: 0.7rem; color: var(--term-green); }
.chat-msg {
  background: var(--tg-blue-soft);
  border: 1px solid rgba(34,158,217,0.2);
  color: var(--ink);
  font-size: 0.82rem;
  padding: 10px 12px;
  border-radius: 12px;
  border-start-end-radius: 4px;
  min-height: 20px;
}

/* ---------- generic section ---------- */
.section { padding-block: 80px; }
.section-alt { background: var(--bg-soft); border-block: 1px solid var(--border-soft); }
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-block: 10px 12px; }
.section-head p { font-size: 1rem; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- services grid ---------- */
.grid { display: grid; gap: 20px; }
.services-grid { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: rgba(34,158,217,0.35); transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.tag {
  display: inline-block;
  font-size: 0.76rem;
  color: var(--tg-blue);
  background: var(--tg-blue-soft);
  border: 1px solid rgba(34,158,217,0.2);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.service-card h3 { font-size: 1.06rem; margin-bottom: 8px; color: var(--ink); }
.service-card p { font-size: 0.92rem; }

/* ---------- sources ---------- */
.sources-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 50px;
  align-items: center;
}
.check-list { margin: 20px 0 28px; display: flex; flex-direction: column; gap: 10px; }
.check-list li { position: relative; padding-inline-start: 26px; color: var(--ink); font-size: 0.95rem; }
.check-list li::before {
  content: "✓";
  position: absolute; right: 0; top: 0;
  color: var(--term-green);
  font-weight: 700;
}
.sources-copy h2 { margin-block: 10px 14px; font-size: clamp(1.4rem, 2.8vw, 2rem); }
.sources-copy > p { margin-bottom: 6px; }

.file-stack { display: flex; flex-direction: column; gap: 14px; }
.file-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.86rem;
  color: var(--ink-dim);
  box-shadow: var(--shadow);
}
.file-chip::before { content: "◆ "; color: var(--amber); }
.file-stack .file-chip:nth-child(1) { transform: translateX(-10px); }
.file-stack .file-chip:nth-child(3) { transform: translateX(10px); }

/* ---------- workflow ---------- */
.workflow-list { display: flex; flex-direction: column; }
.workflow-list li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 22px;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}
.workflow-list li:last-child { border-bottom: 1px solid var(--border); }
.wf-num { font-size: 1.6rem; color: var(--tg-blue); opacity: 0.55; }
.workflow-list h3 { font-size: 1.04rem; margin-bottom: 6px; color: var(--ink); }
.workflow-list p { font-size: 0.92rem; max-width: 60ch; }

/* ---------- telegram channel panel ---------- */
.channel-inner .section-head { margin-inline: auto; text-align: center; }
.channel-inner .section-head p { margin-inline: auto; }

.channel-panel {
  max-width: 620px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.channel-header img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 4px; border: 1px solid var(--border); }
.channel-header strong { display: block; font-size: 0.98rem; color: var(--ink); }
.channel-header span { font-size: 0.8rem; color: var(--ink-faint); }
.channel-header-cta {
  margin-inline-start: auto;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--tg-blue);
  border: 1px solid rgba(34,158,217,0.3);
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.channel-header-cta:hover { background: var(--tg-blue-soft); }

/* body mimics a Telegram chat surface: soft blue-gray backdrop,
   messages as simple left-aligned bubbles, newest first, top to bottom */
.channel-body {
  background: #e9f1f8;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 640px;
  overflow-y: auto;
}
.channel-body::-webkit-scrollbar { width: 6px; }
.channel-body::-webkit-scrollbar-thumb { background: rgba(22,33,46,0.15); border-radius: 4px; }

.feed-skeleton {
  height: 88px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #fff 25%, #dfe9f2 37%, #fff 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.feed-post {
  background: var(--surface);
  border-radius: var(--radius-sm);
  border-start-start-radius: 3px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(22,33,46,0.08);
  max-width: 92%;
}
.feed-post img { border-radius: 8px; margin-bottom: 8px; max-height: 160px; width: 100%; object-fit: cover; }
.feed-post p { color: var(--ink); font-size: 0.88rem; margin-bottom: 8px; white-space: pre-line; }
.feed-post a { font-size: 0.74rem; color: var(--tg-blue); font-weight: 600; }
.feed-post time { font-size: 0.72rem; color: var(--ink-faint); display: block; margin-bottom: 5px; }

.feed-empty {
  text-align: center;
  padding: 34px 12px;
  color: var(--ink-dim);
  font-size: 0.88rem;
}
.feed-empty a { color: var(--tg-blue); font-weight: 700; display: inline-block; margin-top: 8px; }

.channel-footer {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  padding: 14px 0;
  color: var(--tg-blue);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-weight: 700;
}
.channel-footer:hover { background: var(--tg-blue-soft); }

/* ---------- CTA ---------- */
.cta-section { text-align: center; }
.cta-inner h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); margin-bottom: 10px; }
.cta-inner p { margin-bottom: 28px; font-size: 1rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding-top: 56px; }
.footer-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-logo { height: 30px; margin-bottom: 14px; }
.footer-brand p { max-width: 40ch; margin-bottom: 16px; font-size: 0.9rem; }
.footer-tg { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--tg-blue); font-weight: 700; }
.tg-icon { width: 20px; height: 20px; }

.footer-links { display: flex; gap: 60px; }
.footer-col h4 { font-size: 0.86rem; color: var(--ink-faint); margin-bottom: 14px; font-weight: 700; }
.footer-col a, .footer-col span { display: block; font-size: 0.9rem; color: var(--ink-dim); margin-bottom: 10px; }
.footer-col a:hover { color: var(--tg-blue); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-block: 18px;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.back-to-top {
  position: fixed;
  bottom: 22px;
  left: 22px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow);
  z-index: 90;
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ============================================================
   Responsive — tuned in three steps so mobile gets real care,
   not just a squeeze of the desktop grid.
   ============================================================ */

/* tablets / small laptops */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; min-height: 300px; }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .sources-inner { grid-template-columns: 1fr; }
  .sources-visual { order: -1; }
  .footer-inner { grid-template-columns: 1fr; gap: 30px; }
}

/* phones */
@media (max-width: 720px) {
  .wrap { padding-inline: 18px; }

  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .header-actions .btn-sm span { display: none; }

  .site-header.nav-open .main-nav {
    display: flex;
    position: absolute;
    top: 100%; right: 0; left: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 18px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    gap: 4px;
  }
  .site-header.nav-open .main-nav a {
    padding: 12px 10px;
    border-radius: 8px;
  }
  .site-header.nav-open .main-nav a:hover { background: var(--bg-soft); }

  .hero { padding-block: 40px 56px; }
  .hero-copy h1 { font-size: 1.9rem; line-height: 1.32; }
  .hero-lead { font-size: 1rem; max-width: none; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { justify-content: center; }
  .hero-stats { gap: 18px; justify-content: space-between; }

  /* terminal + chat mockup: drop the absolute overlap, stack cleanly */
  .hero-visual { min-height: 0; }
  .term-window { max-width: 100%; }
  .term-body { font-size: 0.78rem; padding: 16px; min-height: 180px; }
  .chat-bubble-mock {
    position: static;
    width: 100%;
    margin-top: 14px;
    transform: none;
  }
  .chat-bubble-mock.show { transform: none; }

  .section { padding-block: 56px; }
  .section-head { margin-bottom: 30px; }

  .services-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }

  .workflow-list li { grid-template-columns: 40px 1fr; gap: 14px; padding: 20px 0; }
  .wf-num { font-size: 1.3rem; }

  .channel-panel { border-radius: var(--radius); }
  .channel-header { padding: 12px 14px; }
  .channel-header img { width: 36px; height: 36px; }
  .channel-header-cta { display: none; }
  .channel-body { max-height: 460px; padding: 14px; gap: 10px; }
  .feed-post { max-width: 100%; padding: 10px 12px; }

  .cta-section .btn-lg { width: 100%; justify-content: center; }

  .footer-links { flex-direction: column; gap: 26px; }
  .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
  .back-to-top { bottom: 16px; left: 16px; width: 40px; height: 40px; }
}

/* very small phones */
@media (max-width: 380px) {
  .hero-copy h1 { font-size: 1.6rem; }
  .btn { padding: 12px 18px; font-size: 0.9rem; }
  .term-body { font-size: 0.72rem; }
}
