/* ==========================================================================
   Afrah Landing — legal pages (terms.html, privacy.html)
   --------------------------------------------------------------------------
   A reading layout, not a marketing one: one narrow column, generous line
   height, and no animation. These pages are linked from both app store
   listings and from the app's own consent screen, so they are read on a phone
   by somebody who is deciding whether to agree to them.

   Tokens come from styles.css, which is loaded first.
   ========================================================================== */

.legal-page {
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
}

.legal-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.legal-home {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  gap: 10px;
  text-decoration: none;
}

.legal-home img {
  margin-block: -22px;
}

.legal-main {
  margin: 0 auto;
  max-width: var(--maxw-narrow);
  padding: 32px 20px 64px;
}

.legal-main h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.3;
  margin: 0 0 8px;
}

.legal-meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.9;
  margin: 0 0 28px;
}

.legal-toc {
  background: var(--primary-50);
  border-radius: var(--radius);
  margin-bottom: 36px;
  padding: 18px 22px;
}

.legal-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.legal-toc li + li {
  margin-top: 8px;
}

.legal-toc a {
  color: var(--primary-dark);
  text-decoration: none;
}

.legal-toc a:hover,
.legal-toc a:focus-visible {
  text-decoration: underline;
}

.legal-main section {
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding-top: 28px;
  /* Anchors from the table of contents land under the sticky-free header
     with room to breathe rather than flush against the top edge. */
  scroll-margin-top: 24px;
}

.legal-main section:first-of-type {
  border-top: 0;
}

.legal-main h2 {
  font-size: 1.35rem;
  line-height: 1.5;
  margin: 0 0 18px;
}

.legal-main h3 {
  color: var(--primary-dark);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 26px 0 10px;
}

.legal-main p {
  font-size: 1rem;
  /* Long Arabic legal clauses: the extra leading is what makes them readable
     on a narrow screen. */
  line-height: 2;
  margin: 0 0 12px;
  text-align: start;
}

.legal-footer {
  border-top: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.9;
  margin-top: 48px;
  padding-top: 24px;
}

.legal-footer a {
  color: var(--primary-dark);
}

@media (max-width: 600px) {
  .legal-main {
    padding: 24px 16px 48px;
  }

  .legal-main p {
    font-size: 0.97rem;
  }
}
