:root {
  color-scheme: light;
  font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --brand: #1f5b84;
  --brand-soft: #eef4f9;
  --ink: #10263a;
  --ink-soft: #54748e;
  --ink-mute: #88a;
  --border: #d8e4ef;
  --bg: #f7f9fb;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
.back-link::before { content: "←"; }
html[dir="ltr"] .back-link::before { content: "←"; }
html[dir="rtl"] .back-link::before { content: "→"; }
.back-link:hover { color: var(--brand); }

/* Language switcher — locked to LTR so the [Arabic | English] button order
   stays fixed regardless of page direction. */
.lang-bar {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.lang-btn {
  appearance: none;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.lang-btn:hover { border-color: var(--brand); color: var(--brand); }
.lang-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Document header */
.doc-header {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}
.doc-header h1 {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.meta-item {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
}

/* Document body card */
.doc-body {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  min-height: 240px;
}

/* State containers */
.state-loading,
.state-error,
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 12px;
  color: var(--ink-soft);
  font-size: 15px;
  gap: 14px;
}
.state-error .error-msg { color: var(--danger); margin: 0; }
.btn-secondary {
  appearance: none;
  background: #fff;
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--brand-soft); }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

[hidden] { display: none !important; }

/* Markdown content typography */
.state-content { color: var(--ink); }
.state-content > :first-child { margin-top: 0; }
.state-content > :last-child { margin-bottom: 0; }

.state-content h1,
.state-content h2,
.state-content h3,
.state-content h4 {
  color: var(--ink);
  margin: 1.6em 0 0.5em;
  line-height: 1.4;
}
.state-content h1 { font-size: 22px; font-weight: 700; }
.state-content h2 { font-size: 19px; font-weight: 700; }
.state-content h3 { font-size: 17px; font-weight: 700; }
.state-content h4 { font-size: 15px; font-weight: 700; }

.state-content p { margin: 0.9em 0; }

.state-content ul,
.state-content ol {
  margin: 0.9em 0;
  padding-inline-start: 1.5em;
}
.state-content li { margin: 0.4em 0; }

.state-content strong { font-weight: 700; }
.state-content em { font-style: italic; }

.state-content a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  word-break: break-word;
}

.state-content code {
  background: var(--brand-soft);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.state-content pre {
  background: var(--brand-soft);
  border-radius: 12px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
.state-content pre code { background: transparent; padding: 0; }

.state-content blockquote {
  margin: 1em 0;
  padding: 0.4em 1em;
  border-inline-start: 3px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 8px;
  color: var(--ink-soft);
}

.state-content hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.6em 0;
}

.state-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 1em 0;
}
.state-content th,
.state-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: start;
}
.state-content th { background: var(--brand-soft); font-weight: 700; }

/* Related links footer */
.related {
  margin-top: 28px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.related h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.related-list a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.related-list a:hover { text-decoration: underline; }

/* Delete-account specific */
.dl-callout {
  background: var(--brand-soft);
  border: 1px solid #cdddec;
  border-radius: 14px;
  padding: 16px 18px;
  margin: 16px 0;
}
.dl-callout strong { color: var(--brand); }

.dl-step {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 14px 0;
}
.dl-step h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
}
.dl-step .step-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.dl-step .step-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed #b4cfe0;
  display: inline-block;
  margin-top: 6px;
  direction: ltr;
}
.dl-step ul { margin: 8px 0; padding-inline-start: 1.4em; }
.dl-step .mailto-btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 14px;
  margin-top: 8px;
}
.dl-step .mailto-btn:hover { opacity: 0.9; }

.dl-section {
  margin-top: 22px;
}
.dl-section > h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 10px;
}
.dl-section > p { margin: 0.6em 0; }
.dl-section ul { padding-inline-start: 1.4em; }
.dl-section li { margin: 0.4em 0; }
