/* Legal pages (privacy.html, terms.html).
   Kept OUT of style.css (the community page) and landing.css (the marketing
   page): those two are tuned for one screen each and change often, and a legal
   document that silently restyles because a marketing tweak shipped is the
   worst kind of regression. Stable names, stable file, its own cache key. */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #080808;
  --surface: #101010;
  --line: #232323;
  --line-soft: #1a1a1a;
  --ink: #f4f4f4;
  --ink-2: #c9c9c9;
  --ink-3: #8b8b8b;
  --red: #e51b23;
  --pad: 24px;
  --max: 780px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.lnav {
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: #080808f2;
  backdrop-filter: blur(10px);
  z-index: 5;
}
.lnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--nav-h);
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
}
/* Same red tile as the landing nav — icon.png is already white-on-red. */
.mark img { width: 26px; height: 26px; border-radius: 7px; display: block; }

.lnav-links { display: flex; gap: 20px; font-size: 14px; }
.lnav-links a { color: var(--ink-3); text-decoration: none; }
.lnav-links a:hover { color: var(--ink); }
.lnav-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ── Hamburger + drop menu ───────────────────────────────────────────────────
   The same component as the landing page's, and it must look and behave the
   same — but the rules are DUPLICATED here rather than shared, for the reason
   at the top of this file: a marketing tweak must not be able to restyle a
   legal document. The behaviour is not duplicated; all six pages load the one
   /menu.js. If you change the markup contract, change both sheets.

   --nav-h is the one number the two copies disagree on: this nav is 64px, the
   landing nav 76px. Everything below is expressed against it. */

:root { --nav-h: 64px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.burger {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 10px;
  transition: background .25s ease;
}
.burger:hover { background: #ffffff0d; }
.burger span {
  display: block;
  width: 20px;
  height: 1.8px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .3s ease, opacity .18s ease;
}
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

.menu {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--nav-h);
  z-index: 6;
  background: #0a0a0a;
  border-bottom: 1px solid transparent;
  max-height: 0;
  overflow: hidden;
  transition: max-height .34s ease, border-color .34s ease;
}
.menu.open {
  /* vh first as the fallback; dvh wins where supported, so the panel
     stops at the real visible height on a phone with a dynamic URL bar. */
  max-height: calc(100vh - var(--nav-h));
  max-height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
  border-bottom-color: var(--line);
}
.menu-list {
  display: flex;
  flex-direction: column;
  padding-block: 2px 26px;
}
.menu-list a {
  display: block;
  padding: 18px 2px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
  transition: color .2s ease, padding-left .2s ease;
}
.menu-list a:hover { color: var(--red); padding-left: 6px; }
.menu-list a[aria-current="page"] { color: var(--red); }

.menu-scrim {
  position: fixed;
  inset: var(--nav-h) 0 0;
  z-index: 5;
  background: #000000a6;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.menu-scrim.open { opacity: 1; visibility: visible; }

/* No `.m-jump` rule here, unlike landing.css: this nav's rail holds only the
   two document links, so the landing-section rows in the menu duplicate
   nothing and stay visible at every width. */

@media (prefers-reduced-motion: reduce) {
  .burger span, .menu, .menu-scrim { transition-duration: .001ms; }
}

/* ── Document ────────────────────────────────────────────────────────────── */

.legal { padding-block: 48px 96px; }

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--red);
}

.legal h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1.08;
  letter-spacing: -.035em;
  font-weight: 800;
  color: var(--ink);
}

.dates {
  margin: 0 0 28px;
  font-size: 13.5px;
  color: var(--ink-3);
}
.dates strong { color: var(--ink-2); font-weight: 600; }

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0 0 28px;
}

.legal h2 {
  margin: 52px 0 14px;
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -.025em;
  font-weight: 750;
  color: var(--ink);
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
  /* Anchored headings must clear the sticky nav when jumped to from the TOC. */
  scroll-margin-top: 76px;
}

.legal h3 {
  margin: 30px 0 8px;
  font-size: 17px;
  letter-spacing: -.01em;
  font-weight: 700;
  color: var(--ink);
}

.legal p { margin: 0 0 15px; }
.legal strong { color: var(--ink); font-weight: 650; }

.legal a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: #e51b2399;
  text-underline-offset: 3px;
}
.legal a:hover { color: var(--red); }

.legal ul, .legal ol { margin: 0 0 15px; padding-left: 22px; }
.legal li { margin-bottom: 9px; }

.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: #1b1b1b;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ── Callout ─────────────────────────────────────────────────────────────── */

.callout {
  margin: 0 0 28px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 10px;
}
.callout p:last-child { margin-bottom: 0; }
.callout.warn { background: #1a0c0d; border-color: #43191c; border-left-color: var(--red); }

/* ── Contents ────────────────────────────────────────────────────────────── */

.toc {
  margin: 0 0 12px;
  padding: 20px 24px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.toc-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 28px;
  font-size: 14.5px;
}
.toc li { margin-bottom: 7px; break-inside: avoid; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--red); text-decoration: underline; }

/* ── Tables ──────────────────────────────────────────────────────────────── */

/* Wrapped in their own scroller: a three-column table is the one thing here
   that cannot reflow below ~420px, and the page body must never scroll
   sideways. */
.legal table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 14.5px;
}
.legal thead th {
  text-align: left;
  font-weight: 650;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  white-space: nowrap;
}
.legal tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  min-width: 150px;
}
.legal tbody tr:last-child td { border-bottom: 0; }

/* ── Button ─────────────────────────────────────────────────────────────── */

.legal .btn {
  display: inline-block;
  margin: 4px 0 22px;
  padding: 13px 22px;
  background: var(--red);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  border-radius: 10px;
  text-decoration: none;
}
.legal .btn:hover { background: #c9161d; color: #fff; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.lfoot {
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--ink-3);
}
.lfoot .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding-block: 24px 40px;
}
.lfoot a { color: var(--ink-3); text-decoration: none; }
.lfoot a:hover { color: var(--ink); }

/* ── FAQ (faq.html) ──────────────────────────────────────────────────────────
   Native <details>, not a scripted accordion: it opens without JavaScript, it
   is keyboard- and screen-reader-correct for free, and Ctrl+F inside an open
   answer still works. The filter box on top is the only scripted part, and the
   page is complete without it. */

.faq-filter {
  position: relative;
  margin: 0 0 8px;
}
.faq-filter input {
  width: 100%;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 14px 16px 14px 42px;
  outline: none;
}
.faq-filter input::placeholder { color: var(--ink-3); }
.faq-filter input:focus { border-color: #3d3d3d; }
.faq-filter svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.legal .faq-count {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  min-height: 1.4em;
}

.q {
  border-bottom: 1px solid var(--line-soft);
}
.q > summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 40px 18px 0;
  position: relative;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -.012em;
  color: var(--ink);
}
.q > summary::-webkit-details-marker { display: none; }
.q > summary:hover { color: var(--red); }
/* The +/× glyph. Drawn in CSS so there is no icon font and no inline SVG
   repeated thirty times down the page. */
.q > summary::after,
.q > summary::before {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 13px;
  height: 1.6px;
  background: var(--ink-3);
  border-radius: 2px;
  transition: transform .25s ease, background .25s ease;
}
.q > summary::before { transform: translateY(-50%) rotate(90deg); }
.q > summary::after { transform: translateY(-50%); }
.q[open] > summary { color: var(--red); }
.q[open] > summary::before { transform: translateY(-50%) rotate(0deg); background: var(--red); }
.q[open] > summary::after { background: var(--red); }

.q .a { padding: 0 8px 20px 0; }
.q .a p { margin: 0 0 12px; }
.q .a p:last-child,
.q .a ul:last-child { margin-bottom: 0; }
.q .a ul { margin: 0 0 12px; padding-left: 20px; }
.q .a li { margin-bottom: 6px; }

/* Hidden by the filter. A separate attribute from `hidden` so the script never
   fights whatever the browser does with <details>. Applies to the questions, to
   a heading whose whole section filtered out, and to the contents list (which
   would otherwise link to sections that are no longer on screen). */
.q[data-off],
.faq-group[data-off],
.toc[data-off] { display: none; }

/* ── Contact form (contact.html) ─────────────────────────────────────────────
   Deliberately the same shape as Get Help inside the app
   (lib/features/support/get_help_screen.dart): a category pill, a subject, a
   message. It builds the SAME `[Qafila][CODE]` subject and `Type:` body, so a
   request filed from the website lands in the same inbox bucket as one filed
   from the app. Keep the two in step. */

.form-block { margin: 0 0 22px; }

.label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.pill:hover { border-color: #3d3d3d; color: var(--ink); }
.pill svg { width: 15px; height: 15px; flex: none; }
.pill[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.input,
.textarea {
  width: 100%;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s ease;
}
.textarea { min-height: 170px; resize: vertical; }
.input::placeholder,
.textarea::placeholder { color: var(--ink-3); }
.input:focus,
.textarea:focus { border-color: #3d3d3d; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 26px;
}
/* Same look as .legal .btn, which is an <a>; a <button> resets differently. */
.send {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 24px;
  background: var(--red);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
  border-radius: 10px;
  transition: background .2s ease;
}
.send:hover { background: #c9161d; }
.send svg { width: 17px; height: 17px; }

.legal .form-note {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-3);
}
.legal .form-note a { color: var(--ink-2); }

/* Inline validation: a nudge under the form rather than an alert() — a dialog
   would be the one thing on this page that a keyboard user cannot dismiss to
   fix what it is complaining about. */
.legal .form-msg {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--red);
  min-height: 1.4em;
}
.legal .form-msg.ok { color: var(--ink-2); }
/* Reserve the line only once there is something on it, so the resting
   form doesn't carry 38px of dead space under the send button. */
.legal .form-msg:empty { margin: 0; min-height: 0; }

@media (max-width: 640px) {
  :root { --pad: 18px; }
  .legal { padding-block: 34px 72px; }
  .legal h2 { margin-top: 40px; font-size: 21px; }
  .toc ol { columns: 1; }
  .lede { font-size: 16.5px; }
  .lnav-links { display: none; }
  .menu-list a { font-size: 18px; padding-block: 16px; }
  .q > summary { font-size: 15.5px; }
  .send { width: 100%; justify-content: center; }
}
