/* ==========================================================================
   Safar — Terms of Service
   Production stylesheet (static, no build required)
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.7;
  color: #1a1a1a;
  background-color: #f6f7f9;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Arabic typography fallback */
html[lang="ar"] body {
  font-family: "Noto Naskh Arabic", "Amiri", "Geeza Pro", "Tahoma", sans-serif;
  font-size: 17px;
  line-height: 1.9;
}

/* ---------- Header / Language Switcher ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0f172a;
  text-decoration: none;
}

.brand-accent {
  color: #2563eb;
}

.lang-switcher {
  display: inline-flex;
  background-color: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  gap: 2px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.18s ease;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lang-btn:hover {
  color: #0f172a;
  background-color: #e2e8f0;
}

.lang-btn.active {
  background-color: #ffffff;
  color: #2563eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.lang-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ---------- Main document ---------- */
.document {
  max-width: 880px;
  margin: 40px auto;
  background-color: #ffffff;
  padding: 56px 64px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.document-header {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.document h1 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.document-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  font-style: italic;
}

.document-intro {
  font-size: 15px;
  color: #334155;
  margin: 0 0 32px 0;
  padding: 16px 20px;
  background-color: #f8fafc;
  border-inline-start: 3px solid #2563eb;
  border-radius: 4px;
}

.document h2 {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  margin: 40px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  line-height: 1.4;
}

.document h2:first-of-type {
  margin-top: 0;
}

.document p {
  margin: 12px 0;
  text-align: justify;
  color: #1e293b;
}

.document ul {
  margin: 12px 0;
  padding-inline-start: 24px;
}

.document li {
  margin: 6px 0;
  color: #1e293b;
}

.document strong {
  font-weight: 700;
  color: #0f172a;
}

.clause {
  margin: 10px 0;
}

.clause-num {
  font-weight: 700;
  color: #0f172a;
  margin-inline-end: 4px;
}

.caps {
  text-transform: uppercase;
  font-size: 13.5px;
  letter-spacing: 0.3px;
}

.placeholder {
  display: inline-block;
  padding: 1px 8px;
  background-color: #fef3c7;
  border: 1px dashed #d97706;
  border-radius: 4px;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  font-size: 13px;
  color: #92400e;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 880px;
  margin: 0 auto 40px auto;
  padding: 24px 64px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* ---------- RTL Support (Arabic) ---------- */
html[dir="rtl"] .document p,
html[dir="rtl"] .document li {
  text-align: right;
}

html[dir="rtl"] .document {
  text-align: right;
}

html[dir="rtl"] .lang-switcher {
  direction: ltr; /* keep RU / EN / AR order consistent */
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .header-inner {
    padding: 12px 16px;
  }

  .brand {
    font-size: 17px;
  }

  .lang-btn {
    padding: 5px 10px;
    font-size: 13px;
  }

  .document {
    margin: 16px;
    padding: 28px 22px;
    border-radius: 8px;
  }

  .document h1 {
    font-size: 22px;
  }

  .document h2 {
    font-size: 17px;
    margin-top: 28px;
  }

  .document p,
  .document li {
    text-align: start;
  }

  .site-footer {
    padding: 16px 22px;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 15px;
  }

  .document {
    padding: 22px 18px;
  }

  .document h1 {
    font-size: 20px;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .site-footer {
    display: none;
  }

  body {
    background: #fff;
  }

  .document {
    box-shadow: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
  }
}
