/* ============================================================
   Shared guide stylesheet — used by every page in guides/
   Pairs with ../colors_and_type.css.
   ============================================================ */

* { box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
html, body { margin: 0; background: var(--bg-1); color: var(--fg-1); font-family: var(--font-sans); }
a { color: var(--buraq-primary); text-decoration: none; }
.container { max-width: 980px; margin: 0 auto; padding: 0 32px; }

/* ----- Top bar ----- */
.top {
  border-bottom: 1px solid var(--border-1);
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 30;
}
.top-inner {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  max-width: 980px; margin: 0 auto;
}
.top-inner img { height: 26px; }
.top-crumb {
  color: var(--fg-3); font-size: 13.5px; font-weight: 500;
  display: flex; gap: 8px; align-items: center;
}
.top-crumb .sep { opacity: 0.4; }
.top-crumb .here { color: var(--fg-1); font-weight: 600; }
.top-cta {
  margin-inline-start: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 9999px;
  background: var(--buraq-primary); color: #fff;
  font-weight: 600; font-size: 13.5px;
}
[dir="rtl"] .top-cta svg { transform: scaleX(-1); }

/* ----- Hero ----- */
.hero {
  padding: 80px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero-glow {
  position: absolute; inset: -50% 30% auto -10%;
  width: 60%; height: 700px;
  background: radial-gradient(closest-side, rgba(52,61,230,0.10), transparent 70%);
  pointer-events: none;
}
[dir="rtl"] .hero-glow { inset: -50% -10% auto 30%; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 9999px;
  background: var(--buraq-primary-50); color: var(--buraq-primary-700);
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
[dir="rtl"] .hero-eyebrow { letter-spacing: 0.04em; text-transform: none; font-size: 13px; }
.hero h1 {
  font-size: 56px; line-height: 1.05; font-weight: 700;
  letter-spacing: -0.02em; margin: 18px 0 14px;
  text-wrap: balance;
}
[dir="rtl"] .hero h1 { font-size: 60px; line-height: 1.1; letter-spacing: normal; }
.hero p.lede {
  font-size: 19px; line-height: 30px; color: var(--fg-2);
  max-width: 680px; margin: 0;
  text-wrap: pretty;
}
[dir="rtl"] .hero p.lede { font-size: 20px; line-height: 34px; max-width: 740px; }
.hero-meta {
  display: flex; gap: 24px; margin-top: 32px;
  color: var(--fg-3); font-size: 13.5px;
}
.hero-meta .item { display: flex; align-items: center; gap: 8px; }
.hero-meta b { color: var(--fg-1); font-weight: 600; }

/* ----- Outline rail ----- */
.outline {
  border: 1px solid var(--border-1);
  border-radius: 16px;
  padding: 22px 24px;
  margin: 24px 0 64px;
  background: var(--bg-2);
}
.outline h4 {
  margin: 0 0 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-3);
}
[dir="rtl"] .outline h4 { font-size: 12.5px; letter-spacing: 0.08em; text-transform: none; }
.outline ol {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px;
  counter-reset: step;
}
.outline li {
  counter-increment: step;
  font-size: 14.5px; font-weight: 500; color: var(--fg-2);
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
}
.outline li::before {
  content: counter(step, decimal-leading-zero);
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 7px; background: #fff; border: 1px solid var(--border-1);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  color: var(--buraq-primary);
}
.outline a { color: inherit; }
.outline a:hover { color: var(--fg-1); }

/* ----- Step ----- */
.step {
  padding: 56px 0;
  border-top: 1px solid var(--border-1);
  scroll-margin-top: 80px;
}
.step:first-of-type { border-top: 0; padding-top: 0; }
.step-head {
  display: flex; gap: 20px;
  margin-bottom: 28px;
  align-items: flex-start;
}
.step-num {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--buraq-gradient);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
  box-shadow: 0 8px 20px rgba(52,61,230,0.28);
  font-feature-settings: "tnum";
}
.step-head h2 {
  font-size: 32px; line-height: 1.15; font-weight: 700;
  letter-spacing: -0.015em; margin: 0 0 8px;
}
[dir="rtl"] .step-head h2 { font-size: 34px; line-height: 1.2; letter-spacing: normal; }
.step-head .step-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--buraq-primary);
  margin-bottom: 6px;
}
[dir="rtl"] .step-head .step-eyebrow { font-size: 13px; letter-spacing: 0.06em; text-transform: none; }
.step-body {
  color: var(--fg-2); font-size: 16.5px; line-height: 28px;
  max-width: 680px;
}
[dir="rtl"] .step-body { font-size: 17px; line-height: 32px; max-width: 740px; }
.step-body p { margin: 0 0 14px; }
.step-body p:last-child { margin-bottom: 0; }
.step-body code, .var {
  font-family: var(--font-mono); font-size: 13.5px;
  background: var(--ink-50);
  border: 1px solid var(--border-1);
  padding: 1px 7px; border-radius: 6px;
  color: var(--fg-1);
  direction: ltr; unicode-bidi: isolate;
  display: inline-block;
}
.step-body .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 9999px;
  background: var(--buraq-primary-50); color: var(--buraq-primary-700);
  font-size: 13px; font-weight: 600;
}
[dir="rtl"] .step-body .pill { font-size: 14px; }
.step-body ul { padding-inline-start: 20px; line-height: 30px; }
[dir="rtl"] .step-body ul { padding-inline-start: 22px; line-height: 32px; }

/* ----- Screenshot frame ----- */
.shot {
  margin-top: 28px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-1);
  background: #fff;
  box-shadow: 0 24px 60px rgba(15,20,48,0.12);
}
.shot + .shot { margin-top: 18px; }
.shot-chrome {
  height: 36px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-1);
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  direction: ltr;
}
.shot-dots { display: flex; gap: 6px; }
.shot-dots span { width: 11px; height: 11px; border-radius: 50%; }
.shot-url {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--fg-3);
  background: #fff;
  border: 1px solid var(--border-1); border-radius: 6px;
  padding: 4px 14px;
  flex: 1; max-width: 420px;
  text-align: center;
}
.shot img { display: block; width: 100%; height: auto; }
.shot-caption {
  padding: 10px 16px;
  font-size: 13px; color: var(--fg-3);
  border-top: 1px solid var(--border-1);
  background: var(--bg-2);
}

/* ----- Callouts ----- */
.callout {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--buraq-primary-50);
  border: 1px solid var(--buraq-primary-100);
  color: var(--ink-800);
  font-size: 14.5px; line-height: 24px;
  display: flex; gap: 12px;
}
[dir="rtl"] .callout { font-size: 15px; line-height: 28px; }
.callout .ic {
  flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 8px;
  background: var(--buraq-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.callout b { color: var(--buraq-primary-800); }
.callout.warn {
  background: #FFFBEB;
  border-color: #FCD34D;
  color: #78350F;
}
.callout.warn .ic { background: #F59E0B; }
.callout.warn b { color: #78350F; }

/* ----- Final dark card ----- */
.done-card {
  margin: 80px 0;
  background: var(--ink-950);
  color: #fff;
  border-radius: 28px;
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  box-shadow: 0 30px 80px rgba(15,20,48,0.25);
  overflow: hidden;
  position: relative;
}
.done-card::before {
  content: "";
  position: absolute;
  inset: auto -10% -50% auto;
  width: 60%; height: 600px;
  background: radial-gradient(closest-side, rgba(115,87,255,0.45), transparent 70%);
  pointer-events: none;
}
[dir="rtl"] .done-card::before { inset: auto auto -50% -10%; }
.done-card h3 {
  font-size: 32px; line-height: 1.15; font-weight: 700;
  letter-spacing: -0.015em; margin: 0 0 10px;
  position: relative; z-index: 1;
}
[dir="rtl"] .done-card h3 { font-size: 34px; line-height: 1.2; letter-spacing: normal; margin-bottom: 12px; }
.done-card p { color: var(--ink-300); margin: 0; font-size: 16px; line-height: 26px; max-width: 540px; position: relative; z-index: 1; }
[dir="rtl"] .done-card p { font-size: 17px; line-height: 30px; max-width: 560px; }
.done-card .actions { display: flex; gap: 10px; position: relative; z-index: 1; }
.done-card .b {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 9999px;
  font-weight: 600; font-size: 14.5px;
  text-decoration: none;
}
.done-card .b.primary { background: #fff; color: var(--buraq-primary); }
.done-card .b.ghost { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.16); }

/* ----- Footer ----- */
.footer {
  border-top: 1px solid var(--border-1);
  padding: 32px 0;
  color: var(--fg-3);
  font-size: 13px;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.footer-inner img { height: 24px; opacity: 0.7; }

/* ----- Reading progress ----- */
.progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; background: transparent;
  z-index: 40;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #343DE6, #7357FF, #34AEFF);
  width: 0;
  transition: width 80ms linear;
}

/* ----- Print / PDF ----- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff; }
  .top, .progress, .top-cta, .done-card .actions, .footer { display: none !important; }
  .hero { padding: 0 0 24px; }
  .hero h1 { font-size: 42px; line-height: 1.1; }
  .hero p.lede { font-size: 15px; line-height: 24px; }
  .hero-glow { display: none; }
  .outline { margin: 16px 0 32px; padding: 16px 18px; }
  .outline ol { grid-template-columns: 1fr 1fr; gap: 4px 24px; }

  /* Steps are far taller than a page — let them flow, and only keep
     small atomic units together. Forcing break-inside:avoid on a
     full step pushes the whole block to a new page (blank gaps) and
     overflows, which reads as "misplaced". */
  .step { break-inside: auto; page-break-inside: auto; padding: 22px 0; }
  .step-head { break-inside: avoid; break-after: avoid-page; }
  .step-head h2 { font-size: 26px; }
  .step-body { font-size: 14px; line-height: 24px; }

  /* Keep a sub-step heading with the paragraph/figure that follows it */
  .substep-label, .substep h3 { break-after: avoid-page; }
  .substep { break-inside: auto; }

  /* Atomic units that must never be split across a page */
  .shot, .callout, .arch, .arch-card, .code, .checklist li,
  .field-table tr, .trouble tr, .wa {
    break-inside: avoid; page-break-inside: avoid;
  }

  /* Cap screenshot height so a tall full-width image can't blow past
     one page (which clips/misplaces everything after it) */
  .shot { box-shadow: 0 1px 4px rgba(0,0,0,0.1); margin-top: 16px; }
  .shot-chrome { height: 28px; }
  .shot img { max-height: 196mm; width: auto; max-width: 100%; margin: 0 auto; object-fit: contain; }

  .done-card { background: var(--ink-950) !important; color: #fff !important; box-shadow: none; padding: 32px; margin: 32px 0 0; break-inside: avoid; }
  .done-card h3, .done-card p { color: #fff !important; }
  .done-card p { color: var(--ink-300) !important; }
  .done-card::before { display: none; }
  a { color: inherit; text-decoration: none; }
  .container { max-width: 100%; padding: 0 6mm; }
}

@media (max-width: 720px) {
  .hero h1 { font-size: 38px !important; }
  .step-head { flex-direction: column; gap: 14px; }
  .step-num { width: 44px; height: 44px; font-size: 18px; }
  .step-head h2 { font-size: 26px !important; }
  .outline ol { grid-template-columns: 1fr; }
  .done-card { grid-template-columns: 1fr; padding: 28px; }
}

/* =================================================================
   Node catalog — used by "Build an inbound bot" guides
   ================================================================= */

/* Category header */
.cat {
  display: flex; align-items: baseline; gap: 16px;
  padding: 64px 0 24px;
  border-top: 1px solid var(--border-1);
  scroll-margin-top: 80px;
}
.cat:first-of-type { border-top: 0; padding-top: 32px; }
.cat h2 {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.01em; margin: 0;
}
[dir="rtl"] .cat h2 { letter-spacing: normal; }
.cat .meta {
  color: var(--fg-3); font-size: 14px;
}

/* Node card */
.node {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  background: #fff;
  border: 1px solid var(--border-1);
  border-radius: 18px;
  padding: 24px 28px;
  margin: 0 0 16px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.node-chip { margin-bottom: 12px; }
.node-chip img, .node-chip svg { display: block; height: 32px; width: auto; max-width: 220px; }
.node h3 {
  font-size: 19px; font-weight: 700; margin: 4px 0 6px;
  letter-spacing: -0.005em;
}
[dir="rtl"] .node h3 { font-size: 20px; letter-spacing: normal; }
.node p {
  font-size: 14.5px; line-height: 23px; color: var(--fg-2);
  margin: 0 0 10px;
}
[dir="rtl"] .node p { font-size: 15.5px; line-height: 27px; }
.node p:last-child { margin-bottom: 0; }
.node .badge-silent {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 9999px;
  background: var(--ink-50); color: var(--fg-3);
  font-size: 12px; font-weight: 600;
}

/* WhatsApp mockup (lives in the right column of a .node card) */
.wa {
  background: #ECE5DD;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-1);
  display: flex; flex-direction: column;
  min-height: 100%;
}
.wa-head {
  background: #075E54; color: #fff;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600;
  direction: ltr;
}
.wa-head .ava {
  width: 26px; height: 26px; border-radius: 50%;
  background: #25D366;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.wa-head .meta { display: flex; flex-direction: column; line-height: 1.1; }
.wa-head .sub { font-size: 10.5px; opacity: 0.75; font-weight: 500; }
.wa-body {
  flex: 1;
  padding: 12px;
  display: flex; flex-direction: column; gap: 7px;
  background-image:
    radial-gradient(rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 16px 16px;
}
.wa-bubble {
  max-width: 86%;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 17px;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  white-space: pre-line;
}
.wa-bubble.bot {
  background: #fff;
  align-self: flex-start;
  border-top-left-radius: 0;
}
.wa-bubble.me {
  background: #DCF8C6;
  align-self: flex-end;
  border-top-right-radius: 0;
}
.wa-bubble .time {
  display: block;
  font-size: 10px; color: rgba(0,0,0,0.45);
  text-align: end;
  margin-top: 3px;
}
.wa-bubble.bot .name {
  display: block;
  font-size: 10.5px;
  color: #5A2DB8;
  font-weight: 700;
  margin-bottom: 2px;
}
.wa-bubble .media {
  display: block;
  margin: -3px -5px 6px;
  height: 70px; border-radius: 5px;
  background: linear-gradient(135deg, #B6BCFA, #8B92F4);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.wa-bubble .doc {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.04);
  padding: 6px 8px; border-radius: 4px;
  margin-bottom: 4px;
  font-size: 11.5px;
}
.wa-bubble .doc svg { flex-shrink: 0; opacity: 0.6; }

/* Quick-reply buttons (Reply Button node) */
.wa-quick {
  display: flex; gap: 4px;
  margin-top: -3px;
  margin-bottom: 2px;
}
.wa-quick .qbtn {
  flex: 1;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12px; font-weight: 600;
  color: #075E54;
  text-align: center;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.1);
}
.wa-quick.stacked { flex-direction: column; }

/* CTA single button under a bubble */
.wa-cta {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  padding: 7px 10px;
  margin-top: -2px;
  font-size: 12px; font-weight: 600;
  color: #34B7F1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.1);
}

/* List "View options" launcher */
.wa-list-btn {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  padding: 7px 10px;
  margin-top: -2px;
  font-size: 12px; font-weight: 600;
  color: #075E54;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.1);
}

/* List drawer */
.wa-list-drawer {
  background: #fff;
  border-radius: 8px;
  padding: 8px 0;
  border: 1px solid rgba(0,0,0,0.08);
  font-size: 12px;
  margin-top: 6px;
}
.wa-list-drawer .sec {
  padding: 4px 12px;
  font-size: 9.5px; font-weight: 700;
  color: #5A2DB8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wa-list-drawer .row {
  padding: 5px 12px;
  font-size: 12px; color: #333;
  border-top: 1px solid rgba(0,0,0,0.04);
}

/* Numbered options list (Options node) */
.wa-options ol {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 12.5px;
}
.wa-options ol li { padding: 1px 0; }

/* "Silent / backend" indicator on the right column */
.silent-card {
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
  min-height: 100%;
}
.silent-card .glyph {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--ink-100); color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
}
.silent-card b { color: var(--fg-2); font-weight: 600; font-size: 13.5px; }

/* Inline typing indicator (used in Delay mockup) */
.wa-typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 7px;
  border-top-left-radius: 0;
  padding: 6px 10px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
  display: inline-flex; gap: 4px;
}
.wa-typing span {
  width: 5px; height: 5px; border-radius: 50%;
  background: #999;
  animation: wa-bob 1.2s infinite;
}
.wa-typing span:nth-child(2) { animation-delay: 0.15s; }
.wa-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wa-bob {
  0%,80%,100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Node card stacks on narrow screens */
@media (max-width: 820px) {
  .node { grid-template-columns: 1fr; gap: 20px; }
}

/* Print tweaks for catalog */
@media print {
  .cat { padding: 28px 0 14px; border-top: 1px solid var(--border-2); }
  .cat:first-of-type { padding-top: 16px; }
  .cat h2 { font-size: 22px; }
  .node { padding: 16px 18px; margin-bottom: 12px; grid-template-columns: 1fr 280px; gap: 20px; }
  .node h3 { font-size: 16px; }
  .node p { font-size: 12.5px; line-height: 20px; }
  .wa-body { background-image: none; }
}

/* =================================================================
   Architecture diagram — used by "Build an AI Agent" overview
   ================================================================= */
.arch {
  background: linear-gradient(180deg, #FAFBFF 0%, #F4F5FA 100%);
  border: 1px solid var(--border-1);
  border-radius: 24px;
  padding: 28px 24px;
  margin: 28px 0 48px;
}
.arch-row {
  display: grid;
  gap: 16px;
  align-items: stretch;
}
.arch-row.two { grid-template-columns: 1fr 1fr; }
.arch-row.one { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
.arch-card {
  background: #fff;
  border: 1px solid var(--border-1);
  border-radius: 14px;
  padding: 18px 18px;
  display: flex; gap: 14px; align-items: flex-start;
  box-shadow: 0 2px 6px rgba(15,20,48,0.04);
}
.arch-card.brand {
  background: var(--ink-950);
  color: #fff;
  border: none;
  box-shadow: 0 12px 28px rgba(15,20,48,0.20);
}
.arch-card.brand p { color: var(--ink-300); }
.arch-card.wa-end {
  background: var(--whatsapp-ink);
  color: #fff;
  border: none;
}
.arch-card.wa-end p { color: rgba(255,255,255,0.8); }
.arch-card .glyph {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--buraq-primary-50); color: var(--buraq-primary);
  display: flex; align-items: center; justify-content: center;
}
.arch-card.brand .glyph { background: rgba(255,255,255,0.1); color: var(--buraq-accent); }
.arch-card.wa-end .glyph { background: var(--whatsapp); color: #fff; }
.arch-card h4 { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; }
.arch-card p { margin: 0; font-size: 13px; line-height: 19px; color: var(--fg-3); }
.arch-arrow {
  height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-300);
}
.arch-arrow svg { display: block; }
.arch-merge {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 28px;
  position: relative;
}
.arch-merge::before, .arch-merge::after {
  content: ""; position: absolute; top: 0; bottom: 50%;
  width: 1.5px; background: var(--ink-200);
}
.arch-merge::before { left: 25%; }
.arch-merge::after  { right: 25%; }
.arch-merge .joiner {
  position: absolute; top: 50%; left: 25%; right: 25%; height: 1.5px;
  background: var(--ink-200);
}
.arch-merge .down {
  position: absolute; top: 50%; left: 50%; bottom: 0; width: 1.5px;
  background: var(--ink-200); transform: translateX(-50%);
}

[dir="rtl"] .arch-card { text-align: right; }

/* ================ AI Agent guide — sub-steps + tables ================ */
.substep {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-1);
}
.substep:first-of-type { border-top: 0; padding-top: 12px; margin-top: 16px; }
.substep-label {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--buraq-primary);
  margin-bottom: 8px;
}
[dir="rtl"] .substep-label { letter-spacing: 0.04em; text-transform: none; font-size: 13px; }
.substep-label .n {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--buraq-primary-50);
  padding: 1px 7px; border-radius: 5px;
}
.substep h3 {
  margin: 0 0 10px;
  font-size: 22px; line-height: 1.25; font-weight: 700;
  letter-spacing: -0.01em;
}
[dir="rtl"] .substep h3 { font-size: 23px; letter-spacing: normal; }

/* Field reference table */
.field-table {
  margin-top: 18px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-1);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
}
.field-table th, .field-table td {
  text-align: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  vertical-align: top;
  line-height: 22px;
}
.field-table tr:last-child td { border-bottom: 0; }
.field-table th {
  background: var(--bg-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
[dir="rtl"] .field-table th { letter-spacing: 0.04em; text-transform: none; font-size: 12.5px; }
.field-table td:first-child {
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
}
.field-table td:last-child { color: var(--fg-2); }

/* Code block (used for the function snippet) */
.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 22px;
  background: var(--ink-950);
  color: #E6E8F0;
  padding: 18px 20px;
  border-radius: 12px;
  margin-top: 18px;
  overflow-x: auto;
  white-space: pre;
}
.code .kw { color: #C9A3FF; }
.code .str { color: #ADE6A8; }
.code .com { color: #6B7591; font-style: italic; }
.code .fn { color: #80C7FF; }

/* Checklist */
.checklist {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.checklist li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border-1);
  border-radius: 12px;
  font-size: 15px; line-height: 24px;
}
.checklist .box {
  flex-shrink: 0; width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  margin-top: 1px;
}

/* Troubleshooting */
.trouble {
  margin-top: 18px;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border: 1px solid var(--border-1);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13.5px;
}
.trouble th, .trouble td {
  text-align: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
  vertical-align: top;
  line-height: 21px;
}
.trouble tr:last-child td { border-bottom: 0; }
.trouble th {
  background: var(--bg-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
[dir="rtl"] .trouble th { letter-spacing: 0.04em; text-transform: none; font-size: 12px; }
.trouble td:first-child { color: var(--fg-1); font-weight: 500; }
.trouble td:last-child { color: var(--fg-2); }

/* Print tuning for AI Agent guide */
@media print {
  .arch { padding: 16px; margin: 14px 0 22px; }
  .arch-card { padding: 12px; }
  .arch-card h4 { font-size: 13px; }
  .arch-card p { font-size: 11.5px; line-height: 17px; }
  .substep { margin-top: 20px; padding-top: 14px; }
  .substep h3 { font-size: 18px; }
  .field-table, .trouble { font-size: 11.5px; }
  .field-table th, .field-table td, .trouble th, .trouble td { padding: 6px 10px; line-height: 17px; }
  .code { font-size: 10.5px; line-height: 18px; padding: 10px 12px; }
  .checklist li { padding: 6px 10px; font-size: 12.5px; line-height: 19px; }
}
