/* ==========================================================================
   پیام‌یار — راهنمای کاربری | Static tutorial site styles
   Neo-brutalist look matched to the app's own brand palette.
   ========================================================================== */

:root {
  --paper: #F1EADB;
  --surface: #FFFFFF;
  --surface2: #FBF6EB;
  --ink: #17150E;
  --ink-soft: #6E685A;
  --line: #17150E;
  --teal: #0F9C8B;
  --teal-deep: #0B7064;
  --teal-ink: #FFFFFF;
  --teal-soft: #C7F0E9;
  --teal-soft-ink: #063A33;
  --yellow: #FFCB2D;
  --yellow-soft: #FFEEB0;
  --yellow-soft-ink: #6A5200;
  --coral: #FF6A52;
  --coral-soft: #FFDED6;
  --coral-soft-ink: #7A1C0C;
  --green: #16A34A;
  --green-soft: #C9F2D7;
  --green-soft-ink: #0A4D24;
  --blue: #2D8FDB;
  --blue-soft: #CFE6FA;
  --blue-soft-ink: #0B3D69;
  --violet: #6E59E0;
  --violet-soft: #DBD3FB;
  --violet-soft-ink: #2C1C73;

  --shadow: 4px 4px 0 var(--line);
  --shadow-sm: 3px 3px 0 var(--line);
  --shadow-lg: 6px 6px 0 var(--line);
  --radius: 16px;
  --radius-sm: 11px;
  --border: 2.5px solid var(--line);
  --maxw: 1180px;

  --mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

:root[data-theme="dark"] {
  --paper: #131109;
  --surface: #211E15;
  --surface2: #1A1810;
  --ink: #F4EEDD;
  --ink-soft: #A39B85;
  --line: #000000;
  --teal: #2BD1BC;
  --teal-deep: #1AA591;
  --teal-ink: #04231F;
  --teal-soft: #0C3F39;
  --teal-soft-ink: #9DEFE2;
  --yellow: #FFD23F;
  --yellow-soft: #3D3208;
  --yellow-soft-ink: #FFE08A;
  --coral: #FF7D67;
  --coral-soft: #4A1C12;
  --coral-soft-ink: #FFC4B7;
  --green: #36C46C;
  --green-soft: #11401F;
  --green-soft-ink: #9BE9B4;
  --blue: #4FA8EC;
  --blue-soft: #103352;
  --blue-soft-ink: #AFD6F7;
  --violet: #9A88F0;
  --violet-soft: #241852;
  --violet-soft-ink: #CFC4FA;
  --shadow: 4px 4px 0 #000;
  --shadow-sm: 3px 3px 0 #000;
  --shadow-lg: 6px 6px 0 #000;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131109;
    --surface: #211E15;
    --surface2: #1A1810;
    --ink: #F4EEDD;
    --ink-soft: #A39B85;
    --line: #000000;
    --teal: #2BD1BC;
    --teal-deep: #1AA591;
    --teal-ink: #04231F;
    --teal-soft: #0C3F39;
    --teal-soft-ink: #9DEFE2;
    --yellow: #FFD23F;
    --yellow-soft: #3D3208;
    --yellow-soft-ink: #FFE08A;
    --coral: #FF7D67;
    --coral-soft: #4A1C12;
    --coral-soft-ink: #FFC4B7;
    --green: #36C46C;
    --green-soft: #11401F;
    --green-soft-ink: #9BE9B4;
    --blue: #4FA8EC;
    --blue-soft: #103352;
    --blue-soft-ink: #AFD6F7;
    --violet: #9A88F0;
    --violet-soft: #241852;
    --violet-soft-ink: #CFC4FA;
    --shadow: 4px 4px 0 #000;
    --shadow-sm: 3px 3px 0 #000;
    --shadow-lg: 6px 6px 0 #000;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  margin: 0;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, "Iran Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.85;
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: var(--teal-deep); text-decoration: none; font-weight: 700; }
:root[data-theme="dark"] a,
@media (prefers-color-scheme: dark) { a { color: var(--teal); } }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }

/* Inline token / code pill */
:not(pre) > code {
  background: var(--surface2);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  unicode-bidi: plaintext;
  display: inline-block;
  white-space: nowrap;
  color: var(--teal-soft-ink);
}
:root[data-theme="dark"] :not(pre) > code { color: var(--teal-soft-ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 19px;
}
.brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--teal);
  flex: 0 0 auto;
}
.brand small { display: block; font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }
.header-spacer { flex: 1; }

.icon-btn {
  width: 42px;
  height: 42px;
  border: var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: transform .08s ease;
  font-size: 20px;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }

/* ---------- Layout ---------- */
.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 34px;
  align-items: start;
}

/* Sidebar / TOC */
.sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding: 18px 0 40px;
}
.toc-title {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  font-weight: 800;
  margin: 0 6px 10px;
  text-transform: uppercase;
}
.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 1px 0; }
.toc a {
  display: block;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14.5px;
  border: 2px solid transparent;
  line-height: 1.4;
}
.toc a:hover { background: var(--surface2); text-decoration: none; color: var(--ink); }
.toc a.active {
  background: var(--teal-soft);
  color: var(--teal-soft-ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

/* Main content */
.content { min-width: 0; padding-bottom: 80px; }

/* ---------- Hero ---------- */
.hero {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background:
    radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--teal) 22%, var(--surface)) 0%, var(--surface) 55%);
  padding: 40px 34px;
  margin: 34px 0 40px;
}
.hero h1 { font-size: 34px; margin: 6px 0 12px; line-height: 1.35; font-weight: 800; }
.hero p { font-size: 18px; color: var(--ink-soft); margin: 0 0 22px; max-width: 640px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .logo-lg {
  width: 76px; height: 76px; border-radius: 18px; border: var(--border);
  box-shadow: var(--shadow); background: var(--teal); margin-bottom: 14px;
}

/* ---------- Sections ---------- */
section { scroll-margin-top: 84px; margin-bottom: 30px; }
.section-card {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 30px 30px 26px;
  margin-bottom: 34px;
}
.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 8px;
  border: var(--border);
  border-radius: 9px;
  background: var(--yellow-soft);
  color: var(--yellow-soft-ink);
  font-weight: 800;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  margin-left: 12px;
}
h2 { font-size: 25px; margin: 0 0 6px; font-weight: 800; display: flex; align-items: center; }
h3 { font-size: 19.5px; margin: 26px 0 8px; font-weight: 800; }
h4 { font-size: 16.5px; margin: 18px 0 6px; font-weight: 800; }
.lead { color: var(--ink-soft); font-size: 17px; margin: 2px 0 18px; }
p { margin: 0 0 14px; }
ul, ol { margin: 0 0 16px; padding-inline-start: 22px; }
li { margin: 6px 0; }

/* ---------- Figure / phone screenshot ---------- */
.figure-row {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
  margin: 20px 0;
}
.figure-row.reverse { grid-template-columns: 1fr 300px; }
.phone {
  border: 3px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  background: var(--line);
  padding: 6px;
}
.phone img { border-radius: 20px; width: 100%; }
figcaption {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 10px;
  font-weight: 600;
}
.figure-text { min-width: 0; }

@media (max-width: 720px) {
  .figure-row, .figure-row.reverse { grid-template-columns: 1fr; }
  .phone { max-width: 300px; margin: 0 auto; }
}

/* ---------- Callouts ---------- */
.callout {
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 14px 16px;
  margin: 18px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.callout .ico { flex: 0 0 auto; font-size: 20px; line-height: 1.5; }
.callout p:last-child { margin-bottom: 0; }
.callout .c-title { font-weight: 800; display: block; margin-bottom: 3px; }
.callout.teal   { background: var(--teal-soft);   color: var(--teal-soft-ink); }
.callout.yellow { background: var(--yellow-soft); color: var(--yellow-soft-ink); }
.callout.blue   { background: var(--blue-soft);   color: var(--blue-soft-ink); }
.callout.coral  { background: var(--coral-soft);  color: var(--coral-soft-ink); }
.callout.green  { background: var(--green-soft);  color: var(--green-soft-ink); }
.callout.violet { background: var(--violet-soft); color: var(--violet-soft-ink); }
.callout a { color: inherit; text-decoration: underline; }

/* "For pro users" box */
.pro-box {
  border: 2.5px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  padding: 14px 18px;
  margin: 18px 0;
}
.pro-box > .c-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; margin-bottom: 6px; }
.pro-box .tag {
  font-size: 11.5px; background: var(--violet-soft); color: var(--violet-soft-ink);
  border: 1.5px solid var(--line); border-radius: 20px; padding: 1px 9px; font-weight: 800;
}

/* ---------- Steps ---------- */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 18px 0; }
.steps > li {
  position: relative;
  padding-inline-start: 52px;
  margin: 0 0 16px;
  min-height: 36px;
}
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 36px; height: 36px;
  border: var(--border);
  border-radius: 10px;
  background: var(--teal);
  color: var(--teal-ink);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  font-size: 16px;
}
.steps > li .s-title { font-weight: 800; display: block; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: var(--border); border-radius: 20px;
  padding: 5px 13px; font-weight: 700; font-size: 13.5px;
  box-shadow: var(--shadow-sm); background: var(--surface);
}
.badge.teal { background: var(--teal-soft); color: var(--teal-soft-ink); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow-soft-ink); }
.badge.green { background: var(--green-soft); color: var(--green-soft-ink); }
.badge.blue { background: var(--blue-soft); color: var(--blue-soft-ink); }
.badge.violet { background: var(--violet-soft); color: var(--violet-soft-ink); }
.chip {
  display: inline-block; border: 2px solid var(--line); border-radius: 20px;
  padding: 2px 11px; font-weight: 700; font-size: 13px; margin: 2px;
  background: var(--surface2);
}
.chip.on { background: var(--teal); color: var(--teal-ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 18px 0; border: var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 460px; }
th, td { padding: 11px 14px; text-align: right; border-bottom: 2px solid var(--line); }
thead th { background: var(--teal-soft); color: var(--teal-soft-ink); font-weight: 800; font-size: 14.5px; }
tbody tr:last-child td { border-bottom: none; }
td .mono, th .mono { unicode-bidi: plaintext; display: inline-block; }
.tick { color: var(--green); font-weight: 800; }
.cross { color: var(--coral); font-weight: 800; }

/* Variable reference table code cells */
td code { white-space: nowrap; }

/* ---------- Concept diagram ---------- */
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 22px 0;
  justify-content: center;
}
.flow-step {
  flex: 1 1 130px;
  min-width: 130px;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  background: var(--surface2);
  padding: 14px 12px;
  text-align: center;
}
.flow-step .fico {
  width: 46px; height: 46px; margin: 0 auto 9px;
  border: var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: var(--shadow-sm);
}
.flow-step .ft { font-weight: 800; font-size: 15px; }
.flow-step .fs { font-size: 12.5px; color: var(--ink-soft); }
.flow-arrow { align-self: center; font-size: 26px; color: var(--teal); font-weight: 800; }
@media (max-width: 620px) {
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}

/* ---------- Mock chat (BotFather) ---------- */
.mock-chat {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface2);
  padding: 16px;
  margin: 18px 0;
  max-width: 460px;
}
.mock-head {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 2px solid var(--line); padding-bottom: 10px; margin-bottom: 12px;
}
.mock-head .av {
  width: 38px; height: 38px; border-radius: 50%; border: var(--border);
  background: var(--blue-soft); color: var(--blue-soft-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.mock-head b { font-size: 15px; }
.mock-head small { color: var(--ink-soft); display: block; font-size: 12px; }
.bubble {
  border: 2px solid var(--line); border-radius: 13px;
  padding: 8px 12px; margin: 8px 0; max-width: 85%; font-size: 14px;
  box-shadow: 2px 2px 0 var(--line);
}
.bubble.them { background: var(--surface); border-top-right-radius: 3px; margin-inline-end: auto; }
.bubble.me { background: var(--teal-soft); color: var(--teal-soft-ink); border-top-left-radius: 3px; margin-inline-start: auto; }
.bubble .mono { direction: ltr; unicode-bidi: plaintext; display: inline-block; }

/* ---------- Plan comparison ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 22px 0; }
.plan {
  border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface); padding: 22px;
}
.plan.pro { background: var(--surface); }
.plan h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.plan .price { font-size: 15px; color: var(--ink-soft); margin-bottom: 12px; }
.plan ul { list-style: none; padding: 0; margin: 0; }
.plan li { padding-inline-start: 26px; position: relative; }
.plan li::before {
  content: "✓"; position: absolute; inset-inline-start: 0; color: var(--green); font-weight: 800;
}
.plan.pro li::before { color: var(--teal); }
@media (max-width: 620px) { .plans { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
details {
  border: var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); background: var(--surface);
  margin: 12px 0; padding: 4px 18px;
}
details[open] { background: var(--surface2); }
summary {
  cursor: pointer; font-weight: 800; padding: 12px 0; list-style: none;
  display: flex; align-items: center; gap: 10px; font-size: 16px;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "؟"; width: 26px; height: 26px; flex: 0 0 auto;
  border: 2px solid var(--line); border-radius: 8px; background: var(--yellow-soft);
  color: var(--yellow-soft-ink); display: flex; align-items: center; justify-content: center; font-size: 15px; }
details[open] summary::before { content: "−"; background: var(--teal-soft); color: var(--teal-soft-ink); }
details .faq-body { padding: 0 0 14px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: var(--border);
  background: var(--surface2);
  margin-top: 40px;
}
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 26px 20px;
  color: var(--ink-soft); font-size: 14px; display: flex;
  flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}

/* ---------- Mobile nav ---------- */
.menu-toggle { display: none; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex; }
  /* Right-anchored drawer (next to the ☰ button in RTL). Physical `right`
     + translateX(100%) so it hides FULLY off the right edge — no sliver
     left covering the content. */
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    height: 100vh;
    width: 280px;
    max-width: 82vw;
    max-height: none;
    background: var(--paper);
    border-inline-start: var(--border);
    box-shadow: var(--shadow-lg);
    padding: 20px 16px;
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 60;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55;
  }
}

/* Skip focus outline nicety */
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

/* Utility */
.mt0 { margin-top: 0; }
.center { text-align: center; }
.small { font-size: 13.5px; color: var(--ink-soft); }
.divider { height: 2.5px; background: var(--line); border: none; margin: 26px 0; border-radius: 2px; }

/* ==========================================================================
   Mobile refinements — the app's primary users are on phones, so the small
   screen experience is the main experience, not an afterthought.
   ========================================================================== */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.8; }
  html { scroll-padding-top: 76px; }

  .header-inner { padding: 10px 14px; gap: 8px; }
  .brand { font-size: 16px; gap: 9px; }
  .brand .logo { width: 34px; height: 34px; }
  .icon-btn { width: 40px; height: 40px; }

  .layout { padding: 0 14px; }
  .content { padding-bottom: 48px; }

  .hero { padding: 26px 20px; margin: 20px 0 26px; border-radius: 14px; }
  .hero h1 { font-size: 26px; line-height: 1.4; }
  .hero p { font-size: 16px; }
  .hero .logo-lg { width: 62px; height: 62px; }
  .hero-badges { gap: 8px; }
  .badge { font-size: 12.5px; padding: 4px 10px; }

  .section-card { padding: 20px 16px 18px; margin-bottom: 22px; border-radius: 14px; }
  h2 { font-size: 21px; }
  h3 { font-size: 18px; margin-top: 22px; }
  h4 { font-size: 15.5px; }
  .lead { font-size: 15.5px; }
  .section-num { min-width: 30px; height: 30px; font-size: 15px; margin-left: 9px; }

  /* Keep numbered steps comfortable to read and tap on narrow screens. */
  .steps > li { padding-inline-start: 46px; }
  .steps > li::before { width: 32px; height: 32px; font-size: 15px; }

  .callout { padding: 12px 13px; }
  .flow-step { min-width: 0; }

  .mock-chat { padding: 12px; }
  .bubble { max-width: 92%; font-size: 13.5px; }

  figcaption { font-size: 12px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 23px; }
  h2 { font-size: 19px; }
  .brand small { display: none; }
}

/* Comfortable tap targets and no accidental horizontal scroll of the page body. */
html, body { max-width: 100%; overflow-x: hidden; }
.toc a { min-height: 40px; display: flex; align-items: center; }
summary { min-height: 44px; }
