@font-face {
  font-family: "Ravi";
  src: url("/fonts/Ravi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Ravi";
  src: url("/fonts/Ravi-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #e67e22;
  --primary-dark: #c96510;
  --accent: #8fcb6f;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-soft: #f7f7f5;
  --text: #222222;
  --muted: #6b6b6b;
  --border: #e5e5e2;
  --code-bg: #f3f3ef;
  --max-content: 760px;
  --header-height: 64px;
  --radius: 12px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Ravi", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  direction: rtl;
  text-align: right;
}

a { color: inherit; }
button, input, summary { font: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 1000;
  background: #111;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand img { width: auto; height: 29px; }
.brand span { padding-right: 10px; border-right: 1px solid var(--border); color: #4b4b4b; font-size: .94rem; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.apps-link { display: none; text-decoration: none; color: var(--muted); font-size: .92rem; }
.apps-link:hover { color: var(--primary); }

.menu-button {
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: 5px;
}
.menu-button:hover { background: var(--surface-soft); }
.menu-button span { width: 21px; height: 2px; background: #444; border-radius: 2px; display: block; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 199; background: rgba(20,20,20,.36); }
.docs-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 200;
  width: min(86vw, 340px);
  height: 100dvh;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}
.docs-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.drawer-close { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 10px; font-size: 28px; cursor: pointer; color: var(--muted); }
.drawer-close:hover { background: var(--surface-soft); }
.drawer-nav { padding: 16px 0; }
.drawer-nav a, .desktop-sidebar a { display: block; padding: 9px 11px; border-radius: 8px; text-decoration: none; color: #444; }
.drawer-nav a:hover, .desktop-sidebar a:hover { background: var(--surface-soft); }
.drawer-nav a[aria-current="page"], .desktop-sidebar a.active { background: #fff4ea; color: #a64d05; font-weight: 700; }
.nav-group-title { margin: 22px 11px 6px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.nav-group-title.muted { opacity: .65; }
.drawer-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.drawer-footer a { text-decoration: none; color: var(--primary-dark); font-weight: 700; }
body.drawer-open { overflow: hidden; }

.docs-layout { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px 64px; }
.desktop-sidebar, .page-toc { display: none; }
.doc-content { min-width: 0; max-width: var(--max-content); margin: 0 auto; }

.breadcrumb { display: flex; gap: 8px; align-items: center; margin-top: 24px; font-size: .85rem; color: var(--muted); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.doc-hero { padding: 34px 0 28px; border-bottom: 1px solid var(--border); }
.eyebrow { margin: 0 0 4px; color: var(--primary-dark); font-size: .84rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(1.9rem, 8vw, 2.8rem); line-height: 1.35; letter-spacing: -.02em; }
.lead { margin: 15px 0 0; color: #555; font-size: 1.02rem; line-height: 1.95; }
.hero-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.primary-button { min-height: 44px; display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 9px; background: var(--primary); color: #fff; text-decoration: none; font-weight: 700; }
.primary-button:hover { background: var(--primary-dark); }
.language-label { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: var(--surface); }

.mobile-toc { margin: 22px 0 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.mobile-toc summary { min-height: 48px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.mobile-toc nav { padding: 4px 14px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.mobile-toc a { padding: 6px 0; text-decoration: none; color: var(--muted); font-size: .9rem; }
.mobile-toc a:hover { color: var(--primary); }

.doc-section { padding: 34px 0 4px; }
.doc-section h2 { margin: 0 0 12px; font-size: 1.45rem; line-height: 1.5; }
.doc-section p { margin: 0 0 14px; }
.doc-section strong { font-weight: 700; }

.note-card { margin: 18px 0; padding: 15px 16px; border: 1px solid #dcebd5; border-right: 4px solid var(--accent); border-radius: var(--radius); background: #fbfef9; }
.note-card p { margin: 5px 0 0; color: #555; }

.rate-list { margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.rate-item { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.rate-item:last-child { border-bottom: 0; }
.rate-item > div { display: flex; flex-direction: column; }
.rate-range { font-weight: 700; }
.rate-caption { color: var(--muted); font-size: .82rem; }
.rate-item > strong { direction: ltr; color: var(--primary-dark); font-size: 1.18rem; }

.formula-block { margin: 14px 0; padding: 14px 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); text-align: left; overflow-x: auto; }
.formula-label { display: block; margin-bottom: 5px; color: var(--muted); font-family: Arial, sans-serif; font-size: .78rem; }
.formula-block code, .calculation-line code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .9rem; color: #242424; white-space: nowrap; }
.calculation-line { overflow-x: auto; margin: 13px 0; padding: 10px 12px; border-radius: 8px; background: var(--code-bg); text-align: left; }

.example-card { margin: 16px 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.example-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.example-heading span { color: var(--muted); font-size: .9rem; }
.example-card p { color: #555; }
.mini-result { margin: 12px 0 0; }
.mini-result > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--border); }
.mini-result dt { color: var(--muted); }
.mini-result dd { margin: 0; font-weight: 700; }

.clean-list { margin: 0; padding-right: 21px; }
.clean-list li { margin: 7px 0; padding-right: 3px; }

.sources-section { margin-top: 14px; padding-top: 34px; border-top: 1px solid var(--border); }
.source-links { display: grid; gap: 8px; margin: 14px 0; }
.source-links a { display: block; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); text-decoration: none; color: #444; }
.source-links a:hover { border-color: #d2c2b4; color: var(--primary-dark); }
.updated { color: var(--muted); font-size: .84rem; }

.doc-pagination { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--border); }
.doc-pagination a { display: inline-flex; flex-direction: column; text-decoration: none; }
.doc-pagination span { color: var(--muted); font-size: .8rem; }
.doc-pagination strong { color: var(--primary-dark); }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 24px 16px; text-align: center; color: var(--muted); font-size: .84rem; }
.site-footer p { margin: 0; }

@media (min-width: 760px) {
  .apps-link { display: inline-block; }
  .docs-layout { padding-inline: 28px; }
  .mobile-toc { display: none; }
  .lead { font-size: 1.07rem; }
  .doc-section { padding-top: 42px; }
}

@media (min-width: 1024px) {
  .menu-button { display: none; }
  .docs-layout { display: grid; grid-template-columns: 190px minmax(0, var(--max-content)) 180px; gap: 42px; align-items: start; }
  .doc-content { width: 100%; }
  .desktop-sidebar, .page-toc { display: block; position: sticky; top: calc(var(--header-height) + 26px); max-height: calc(100vh - var(--header-height) - 52px); overflow-y: auto; }
  .desktop-sidebar { padding-top: 22px; }
  .desktop-sidebar nav { font-size: .9rem; }
  .page-toc { padding-top: 32px; font-size: .84rem; }
  .page-toc > p { margin: 0 0 8px; font-weight: 700; color: #444; }
  .page-toc nav { padding-right: 11px; border-right: 1px solid var(--border); }
  .page-toc a { display: block; padding: 5px 0; text-decoration: none; color: var(--muted); transition: color .15s ease; }
  .page-toc a:hover, .page-toc a.active { color: var(--primary-dark); }
  .page-toc a.active { font-weight: 700; }
  .breadcrumb { margin-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
