/* ═══════════════════════════════════════════════════════════════════════════════
   prose.css — long-form typography for the legal and support pages.
   Linked ONLY by those pages, never by the landing page.
   ═══════════════════════════════════════════════════════════════════════════════ */

.doc {
  padding-block: var(--s4) var(--s7);
}

/* Privacy and terms run wider than the narrow container, to fit the contents
   column beside the text. */
.doc-container { max-width: 1120px; }

/* The page title on a yellow panel — the same ground as the home hero. */
.doc-head {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: clamp(var(--s5), 5vw, 64px);
  margin-block-end: var(--s5);
  border-radius: 40px;
  background: var(--accent);
  color: var(--accent-on);
}
.doc-head h1 {
  font-size: clamp(36px, 6vw, 68px);
  font-weight: var(--fw-black);
  line-height: 1;
  letter-spacing: -.04em;
  max-width: 16ch;
}
[lang="ar"] .doc-head h1 { line-height: var(--lh-tight); letter-spacing: 0; }

/* The mark, large and cropped, in the panel's far corner. */
.doc-head::after {
  content: "";
  position: absolute;
  inset-block-start: -60px;
  inset-inline-end: -60px;
  inline-size: 240px;
  block-size: 240px;
  background: url("/assets/img/mark.svg") center / contain no-repeat;
  opacity: .9;
  rotate: calc(14deg * var(--dir));
  pointer-events: none;
}
.doc-head > * { position: relative; z-index: 1; }

.doc-dates {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}
.doc-dates span {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent-on) 10%, transparent);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}
.doc-dates time { unicode-bidi: isolate; }

.doc-lead {
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-medium);
  color: color-mix(in srgb, var(--accent-on) 80%, transparent);
  max-width: 58ch;
}

@media (max-width: 640px) {
  .doc-head { border-radius: 30px; }
  .doc-head::after { inline-size: 150px; block-size: 150px; inset-block-start: -40px; inset-inline-end: -40px; }
}

/* Visible until config.legal.reviewed is true — better than quietly publishing
   an unreviewed policy. */
.doc-notice {
  display: flex;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: var(--fs-body-sm);
  margin-block-end: var(--s5);
}
.doc-notice .doc-notice-icon { flex: none; font-size: 18px; line-height: 1.4; }

/* ── Contents + text ──────────────────────────────────────────────────────── */
.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
}

@media (min-width: 1000px) {
  .doc-layout {
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
  .doc-layout .doc-toc {
    position: sticky;
    inset-block-start: calc(var(--nav-height) + var(--s3));
    max-block-size: calc(100vh - var(--nav-height) - var(--s5));
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-block-end: 0;
  }
  .doc-layout .doc-toc ol { grid-template-columns: minmax(0, 1fr); }
  .doc-layout .prose-section:first-child { padding-block-start: var(--s2); }
}

.doc-toc {
  padding: var(--s4);
  border-radius: 28px;
  background: var(--card);
  border: 1px solid var(--hairline);
  margin-block-end: var(--s4);
}
.doc-toc h2 {
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-faint-strong);
  margin-block-end: var(--s3);
}
[lang="ar"] .doc-toc h2 { text-transform: none; letter-spacing: 0; font-size: var(--fs-body-sm); }

.doc-toc ol {
  display: grid;
  gap: 2px var(--s3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  counter-reset: toc;
}
@media (max-width: 640px) {
  .doc-toc ol { grid-template-columns: minmax(0, 1fr); }
}
.doc-toc li { counter-increment: toc; }
.doc-toc a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: var(--fs-body-sm);
  line-height: 1.4;
  color: var(--text-faint-strong);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.doc-toc a::before {
  content: counter(toc);
  flex: none;
  display: inline-grid;
  place-items: center;
  inline-size: 22px;
  block-size: 22px;
  border-radius: var(--r-pill);
  background: var(--bg-lift);
  color: var(--ink);
  font-size: 11px;
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  transform: translateY(-1px);
}
[lang="ar"] .doc-toc a::before { content: counter(toc, arabic-indic); }
.doc-toc a:hover { color: var(--ink); background: var(--bg-lift); }
/* site.js sets .is-current on the link for the section in view. */
.doc-toc a.is-current { color: var(--ink); font-weight: var(--fw-bold); background: var(--accent-soft); }
.doc-toc a.is-current::before { background: var(--accent); color: var(--accent-on); }

/* ── Body ─────────────────────────────────────────────────────────────────────
   Measure: 68ch reads well in Latin; Arabic sets wider per character, so it gets
   a narrower measure to land on a similar line length. */
.prose {
  max-width: 68ch;
}
[lang="ar"] .prose { max-width: 60ch; }

.prose-section {
  padding-block-start: var(--s6);
  counter-increment: clause;
  /* Anchor targets must clear the sticky nav pill. */
  scroll-margin-block-start: calc(var(--nav-height) + var(--s3));
}

.prose-section > h2 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: var(--fs-heading-lg);
  font-weight: var(--fw-black);
  line-height: var(--lh-snug);
  letter-spacing: -.01em;
  margin-block-end: var(--s3);
}
[lang="ar"] .prose-section > h2 { letter-spacing: 0; }
/* Numbered clauses, so a support email can say "see clause 6". */
.prose-section > h2::before {
  content: counter(clause);
  flex: none;
  display: inline-grid;
  place-items: center;
  inline-size: 38px;
  block-size: 38px;
  margin-block-start: -1px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-on);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  rotate: calc(-4deg * var(--dir));
}
[lang="ar"] .prose-section > h2::before { content: counter(clause, arabic-indic); margin-block-start: 2px; }
/* For headings outside the numbered .doc-body run. */
.prose-section.no-number { counter-increment: none; }
.prose-section.no-number > h2::before { content: none; }

.prose-body { counter-reset: none; }

.prose p {
  margin-block-end: var(--s3);
  color: var(--text-faint-strong);
}
.prose p:last-child { margin-block-end: 0; }

.prose strong, .prose b { color: var(--ink); }

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.prose a:hover { text-decoration-color: var(--ink); }

.prose ul {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-block-end: var(--s4);
}
.prose ul li {
  position: relative;
  padding-inline-start: var(--s4);
  color: var(--text-faint-strong);
}
/* The mark's diamond as the bullet. Logical inset, so it sits on the correct
   side in Arabic. */
.prose ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: 3px;
  inset-block-start: .6em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  rotate: 45deg;
}

.prose h3 {
  font-size: var(--fs-title-lg);
  font-weight: var(--fw-semibold);
  margin-block: var(--s4) var(--s2);
}

/* Numbered clause list bodies get a legal-document look. */
.doc-body { counter-reset: clause; }

/* ── Tables ───────────────────────────────────────────────────────────────────
   Wide tables scroll inside their own box; the page never scrolls sideways. */
.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  margin-block: var(--s5);
  background: var(--card);
  box-shadow: var(--shadow-toast);
}

.doc-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: var(--fs-body-sm);
}

.doc-table caption {
  padding: var(--s4);
  text-align: start;
  font-size: var(--fs-title-lg);
  font-weight: var(--fw-black);
  color: var(--ink);
}

.doc-table th,
.doc-table td {
  padding: var(--s3) var(--s4);
  text-align: start;
  vertical-align: top;
  border-block-start: 1px solid var(--hairline);
}

.doc-table thead th {
  font-weight: var(--fw-bold);
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint-strong);
  background: var(--bg-lift);
}
[lang="ar"] .doc-table thead th { text-transform: none; letter-spacing: 0; font-size: var(--fs-body-sm); }

.doc-table tbody tr { transition: background-color var(--t-fast); }
.doc-table tbody tr:hover { background: var(--card-2); }
.doc-table td:first-child { font-weight: var(--fw-semibold); color: var(--ink); width: 42%; }
.doc-table td:last-child { color: var(--text-faint-strong); }

/* ── Contact cards on the support page ────────────────────────────────────────── */
.contact-grid {
  display: grid;
  gap: var(--s3);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-block: var(--s4) var(--s5);
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s4);
  border-radius: var(--r5);
  background: var(--card);
  border: 1px solid var(--hairline);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--e-spring);
}
.contact-card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-toast);
  transform: translateY(-2px);
}
.contact-card .contact-email {
  font-weight: var(--fw-bold);
  /* Email addresses are LTR even in Arabic text. */
  direction: ltr;
  unicode-bidi: isolate;
  word-break: break-word;
}

/* Back-to-top / back-home link at the end of a document. */
.doc-foot {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-block-start: var(--s7);
  padding-block-start: var(--s4);
  border-block-start: 1px solid var(--hairline);
}
