/* Vazirmatn SIL OFL 1.1 — self-hosted Regular + SemiBold only (see src/public/fonts/OFL.txt) */
@font-face {
  font-family: Vazirmatn;
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/vazirmatn-regular.woff2') format('woff2');
}

@font-face {
  font-family: Vazirmatn;
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url('/fonts/vazirmatn-regular.woff2') format('woff2');
}

@font-face {
  font-family: Vazirmatn;
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url('/fonts/vazirmatn-semibold.woff2') format('woff2');
}

@font-face {
  font-family: Vazirmatn;
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/vazirmatn-semibold.woff2') format('woff2');
}

@font-face {
  font-family: 'Vazirmatn Fallback';
  src:
    local('Liberation Sans'), local('DejaVu Sans'), local('Arial'),
    local('Tahoma'), local('Helvetica');
  /* width: Tahoma ~3px wider on 14px nav labels */
  size-adjust: 99.5%;
  /* Vazirmatn Regular OS/2 typo: 2100 / -1100 / 0 on upem 2048 */
  ascent-override: 102.54%;
  descent-override: 53.71%;
  line-gap-override: 0%;
}

/* Finnotech branding — API reference layout */
:root {
  --font-family: Vazirmatn, 'Vazirmatn Fallback', Tahoma, sans-serif;
  --font-ui: Vazirmatn, 'Vazirmatn Fallback', Tahoma, sans-serif;
  --font-prose: Vazirmatn, 'Vazirmatn Fallback', Tahoma, sans-serif;
  --color-primary: #5b21b6;
  --color-primary-dark: #4c1d95;
  --color-primary-darker: #3b0764;
  --color-primary-tint: #ede9fe;
  --search-bar-height: 56px;
  --search-bar-height-mobile: 97px;
  --elements-topnav-h: 60px;
  --elements-sidebar-w: 300px;
  --elements-sidebar-gutter: 6px;
  --op-title-h: 43px;
  --op-url-h: 45px;
  --op-url-h-mobile: 51px;
  --op-url-h-phone: 57px;
  --op-pdf-w: 124px;
  --op-gap-title-url: 20px;
  --op-gap-url-desc: 32px;
  --op-curl-w: 40%;
  --op-curl-max-w: 500px;
  --op-curl-h: 349px;
  --op-col-gap: 64px;
  --op-content-pad-x: 96px;
  --op-content-pad-x-mobile: 24px;
  --op-content-pad-y: 64px;
}

html {
  direction: ltr;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-family) !important;
}

#docs-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.docs-topbar {
  font-family: var(--font-family);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: var(--search-bar-height);
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  box-sizing: border-box;
  direction: rtl;
  z-index: 100;
  line-height: 1.2;
}

.docs-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  height: 32px;
  min-height: 32px;
}

.docs-nav__brand {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.docs-nav__brand img {
  display: block;
  width: 32px;
  height: 32px;
}

.docs-nav__link {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  box-sizing: border-box;
  flex-shrink: 0;
  height: 32px;
  padding: 5px 12px 0;
  border-radius: 8px;
  color: #4b5563;
  text-decoration: none;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
}

/* CLS desktop: fallback 106×22 / 99×22 → Vazirmatn 103×22 / 96×22 */
.docs-nav__link--guide {
  width: 106px;
}

.docs-nav__link--services {
  width: 86px;
}

.docs-nav__link--api {
  width: 99px;
}

.docs-nav__link:hover {
  color: var(--color-primary);
  background: var(--color-primary-tint);
}

.docs-nav__link.is-active {
  color: #fff;
  background: var(--color-primary);
}

.docs-nav__link.is-active:hover {
  color: #fff;
  background: var(--color-primary-dark);
}

@media (max-width: 900px) {
  .docs-topbar:has(.api-search),
  header.docs-topbar:has(.api-search) {
    height: var(--search-bar-height-mobile);
    min-height: var(--search-bar-height-mobile);
    max-height: var(--search-bar-height-mobile);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    padding: 8px 12px;
    gap: 8px;
  }

  .docs-topbar:not(:has(.api-search)),
  header.docs-topbar:not(:has(.api-search)) {
    height: var(--search-bar-height);
    min-height: var(--search-bar-height);
    max-height: var(--search-bar-height);
  }

  .docs-nav {
    width: 100%;
    min-width: 0;
    height: 32px;
    min-height: 32px;
    flex-wrap: nowrap;
  }

  .docs-nav__link {
    padding: 6px 8px 0;
    font-size: 13px;
    line-height: 20px;
  }
  /* CLS: fallback 86×20 / 92×20 → Vazirmatn 83×20 / 89×20 */
  .docs-nav__link--guide {
    width: 86px;
  }
  .docs-nav__link--services {
    width: 76px;
  }
  .docs-nav__link--api {
    width: 92px;
  }

  .docs-topbar .api-search,
  header.docs-topbar .api-search {
    flex: none;
    width: 100%;
    min-width: 0;
  }

  .api-search__inner {
    max-width: none;
  }

  .api-search__results {
    max-height: min(360px, 50vh);
  }
}

.api-search {
  position: relative;
  z-index: 100;
  flex: 1;
  min-width: 0;
  height: auto;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.api-search__inner {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-width: 0;
  margin: 0 auto;
}

.api-search__input {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 40px !important;
  padding: 0 14px 0 40px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  font-family: var(--font-family) !important;
  font-size: 16px !important;
  color: #111827 !important;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat 12px center !important;
  outline: none !important;
  box-sizing: border-box !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  direction: ltr !important;
  text-align: left !important;
}

.api-search__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}

.api-search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.api-search-item {
  display: flex;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-family);
}

.api-search-item:last-child {
  border-bottom: 0;
}

.api-search-item:hover,
.api-search-item.is-active {
  background: var(--color-primary-tint);
}

.api-search-item__method {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #ede9fe;
  color: var(--color-primary-dark);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-family: ui-monospace, monospace;
  line-height: 1.4;
  align-self: flex-start;
}

.api-search-item__kind {
  font-family: var(--font-family);
  min-width: 48px;
}

.api-search-item__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.api-search-item__title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.api-search-item__path {
  font-size: 12px;
  color: #6b7280;
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-search-item__meta {
  direction: rtl;
  text-align: right;
  font-family: var(--font-family);
}

.api-search-empty {
  padding: 12px;
  font-size: 13px;
  color: #6b7280;
}

#docs-content {
  position: relative;
  flex: 1;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: layout;
}

.docs-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  direction: ltr;
  background: #fff;
}

.docs-placeholder__sidebar,
.docs-placeholder__aside {
  flex-shrink: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.docs-placeholder__topnav {
  display: none;
}

.docs-placeholder__sidebar {
  width: var(--elements-sidebar-w);
  padding: 32px 0 0;
  border-inline-end: 1px solid #e5e7eb;
  background: #f5f6f8;
}

.docs-placeholder__gutter {
  flex: 0 0 var(--elements-sidebar-gutter);
  width: var(--elements-sidebar-gutter);
}

.docs-placeholder__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  margin: 0 16px 32px;
}

.docs-placeholder__logo {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #e5e7eb;
}

.docs-placeholder__toc {
  display: flex;
  flex-direction: column;
}

.docs-placeholder__toc-item {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 32px;
  padding: 0 16px;
}

.docs-placeholder__aside {
  display: none;
}

.docs-placeholder__stage {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.docs-placeholder__poster {
  flex: 1;
  min-height: 0;
  padding: var(--op-content-pad-y) var(--op-content-pad-x);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.docs-placeholder__title {
  height: var(--op-title-h);
  min-height: var(--op-title-h);
  max-height: var(--op-title-h);
  margin: 0 0 var(--op-gap-title-url);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.docs-placeholder__heading {
  margin: 0;
  width: 100%;
  height: var(--op-title-h);
  max-height: var(--op-title-h);
  font-size: 24px;
  font-weight: 600;
  line-height: var(--op-title-h);
  color: #111827;
  direction: rtl;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-placeholder__url-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 var(--op-gap-url-desc);
  box-sizing: border-box;
}

.docs-placeholder__url {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--op-url-h);
  min-height: var(--op-url-h);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  padding: 8px 40px 8px 10px;
  border: 0;
  border-radius: 5px;
  background: #f8fafc;
}

.docs-placeholder__pdf {
  flex: 0 0 var(--op-pdf-w);
  width: var(--op-pdf-w);
  height: var(--op-url-h);
  min-height: var(--op-url-h);
  box-sizing: border-box;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  background: #ede9fe;
}

.docs-placeholder__url-method {
  flex: 0 0 52px;
  height: 28px;
  border-radius: 5px;
  background: #ede9fe;
}

.docs-placeholder__url-method.is-filled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: #4c1d95;
  line-height: 1;
}

.docs-placeholder__url-path {
  flex: 1;
  height: 14px;
  border-radius: 6px;
}

.docs-placeholder__url-path-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-family: ui-monospace, monospace;
  color: #334155;
  direction: ltr;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-placeholder__url-path-text--empty {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 37%, #e5e7eb 63%);
  background-size: 400% 100%;
  animation: docs-shimmer 1.4s ease infinite;
}

.docs-placeholder__lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: #353a40;
  direction: rtl;
}

.docs-lcp-pin {
  position: relative;
  z-index: 3;
  background: #fff;
}

.docs-placeholder__split {
  display: flex;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
}

.docs-placeholder__desc {
  flex: 1;
  min-width: 0;
  min-height: var(--op-curl-h);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-placeholder__curl {
  flex: 0 0 auto;
  width: var(--op-curl-w);
  max-width: var(--op-curl-max-w);
  height: var(--op-curl-h);
  min-height: var(--op-curl-h);
  margin-inline-start: var(--op-col-gap);
  box-sizing: border-box;
  padding: 16px;
  border-radius: 5px;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-placeholder__bar {
  display: block;
  height: 12px;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 37%, #e5e7eb 63%);
  background-size: 400% 100%;
  animation: docs-shimmer 1.4s ease infinite;
}

.docs-placeholder__bar--lg {
  height: 18px;
  width: 70%;
}

.docs-placeholder__bar--title {
  height: 36px;
  width: 322px;
  max-width: 70%;
}

.docs-placeholder__bar--brand {
  height: 28px;
  width: 72%;
}

.docs-placeholder__bar--sm {
  width: 55%;
}

.docs-placeholder__bar--btn {
  height: 36px;
  width: 120px;
  margin-top: 8px;
}

@keyframes docs-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .docs-placeholder__bar {
    animation: none;
    background: #e5e7eb;
  }
}

@media (max-width: 980px) {
  .docs-placeholder {
    flex-direction: column;
  }

  .docs-placeholder__topnav {
    display: flex;
    align-items: center;
    width: 100%;
    height: var(--elements-topnav-h);
    min-height: var(--elements-topnav-h);
    flex-shrink: 0;
    padding: 0 16px;
    box-sizing: border-box;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
  }

  .docs-placeholder__nav-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 5px;
    background: #e5e7eb;
  }

  .docs-placeholder__nav-title {
    flex: 1;
    height: 24px;
    margin: 0 16px;
    border-radius: 6px;
    background: #e5e7eb;
  }

  .docs-placeholder__sidebar,
  .docs-placeholder__gutter,
  .docs-placeholder__aside,
  .docs-placeholder__curl {
    display: none;
  }

  .docs-placeholder__poster {
    padding: 4px var(--op-content-pad-x-mobile) var(--op-content-pad-y);
  }

  .docs-placeholder__split {
    flex-direction: column;
  }

  .docs-placeholder__desc {
    min-height: 0;
    flex: 1;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .docs-placeholder__url,
  .docs-placeholder__pdf {
    height: var(--op-url-h-mobile);
    min-height: var(--op-url-h-mobile);
  }

  .docs-placeholder__url {
    padding: 10px 8px 10px 10px;
    border-radius: 12px;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 500px) {
  .docs-placeholder__url,
  .docs-placeholder__pdf {
    height: var(--op-url-h-phone);
    min-height: var(--op-url-h-phone);
  }
}

.docs-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #6b7280;
  background: #fafafa;
}

.docs-loading[hidden] {
  display: none;
}

.docs-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: docs-spin 0.8s linear infinite;
}

.docs-loading__text {
  margin: 0;
  font-size: 14px;
}

.docs-loading.is-error .docs-loading__spinner {
  display: none;
}

.docs-loading.is-error .docs-loading__text {
  color: #b91c1c;
}

@keyframes docs-spin {
  to {
    transform: rotate(360deg);
  }
}

body {
  margin: 0;
  font-family: var(--font-family) !important;
  direction: ltr;
  max-width: 100%;
  overflow-x: clip;
}

html {
  direction: ltr;
}

.seo-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.seo-fallback a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.seo-fallback a:hover {
  color: var(--color-primary-dark);
}

elements-api,
elements-api:not(:defined) {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  visibility: hidden;
  z-index: 2;
}

elements-api.is-ready {
  visibility: visible;
}

#docs-content:has(elements-api.is-ready) .docs-placeholder {
  pointer-events: none;
  background: transparent;
}

#docs-content:has(elements-api.is-ready) .docs-placeholder__sidebar,
#docs-content:has(elements-api.is-ready) .docs-placeholder__topnav,
#docs-content:has(elements-api.is-ready) .docs-placeholder__gutter,
#docs-content:has(elements-api.is-ready) .docs-placeholder__curl {
  visibility: hidden;
}

#docs-content:has(elements-api.is-ready) .docs-placeholder__poster,
#docs-content:has(elements-api.is-ready) .docs-placeholder__stage,
#docs-content:has(elements-api.is-ready) .docs-placeholder__split,
#docs-content:has(elements-api.is-ready) .docs-placeholder__desc {
  background: transparent;
}
