/* =========================================================
   Cloak — Legal pages: privacy policy + terms (builds on style.css,
   follows the dark / light theme tokens)
   ========================================================= */

.legal {
  --lg-surf: var(--surf);
  --lg-tint: var(--bg2);
  --lg-ink: var(--fg);
  --lg-ink-2: var(--fg2);
  --lg-muted: var(--fg3);
  --lg-line: var(--line);
  --lg-accent: var(--gold);
  --lg-on-accent: var(--on-gold);
  --lg-mark: var(--gold);
  --lg-font: var(--font);
}

/* ---------- Page head ---------- */
.legal-hero { padding-block: clamp(40px, 6vw, 72px) clamp(24px, 3vw, 36px); }

.legal-title {
  margin-top: 14px;
  font: 700 clamp(34px, 5vw, 52px)/1.2 var(--lg-font);
  letter-spacing: -.01em;
}

.legal-meta {
  margin-top: 14px;
  max-width: 640px;
  font: 400 15px/1.9 var(--lg-font);
  color: var(--lg-muted);
}

/* ---------- Language tabs (radio + :has, no JS needed) ---------- */
.lang-switch {
  display: inline-flex;
  gap: 4px;
  margin-top: 26px;
  padding: 4px;
  border-radius: 999px;
  background: var(--lg-surf);
  border: 1px solid var(--lg-line);
}
.lang-switch input { position: absolute; opacity: 0; pointer-events: none; }
.lang-switch label {
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  font: 600 14px/1 var(--lg-font);
  color: var(--lg-ink-2);
  transition: background-color .25s, color .25s;
}
.lang-switch label:hover { color: var(--lg-accent); }
.lang-switch input:checked + label { background: var(--lg-accent); color: var(--lg-on-accent); }
.lang-switch input:focus-visible + label { outline: 2px solid var(--lg-mark); outline-offset: 2px; }

/* browsers without :has() simply show both languages */
.legal:has(#lang-en:checked) #policy-ar,
.legal:not(:has(#lang-en:checked)) #policy-en { display: none; }

/* ---------- Layout ---------- */
.legal-body { padding-bottom: clamp(56px, 8vw, 100px); }

.policy {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  animation: policy-in .5s var(--ease-out);
}

/* ---------- Table of contents ---------- */
.toc {
  position: sticky;
  top: 100px;
  padding: 18px;
  border-radius: 18px;
  background: var(--lg-surf);
  border: 1px solid var(--lg-line);
}
.toc-head {
  display: block;
  margin: 2px 10px 10px;
  font: 600 12px/1 var(--lg-font);
  letter-spacing: .06em;
  color: var(--lg-muted);
}
.toc ol { display: flex; flex-direction: column; gap: 2px; counter-reset: toc; }
.toc a {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font: 500 14px/1.45 var(--lg-font);
  color: var(--lg-ink-2);
  transition: background-color .2s, color .2s, translate .25s var(--ease-out);
}
.toc a::before {
  counter-increment: toc;
  content: counter(toc);
  min-width: 1.3em;
  color: var(--lg-muted);
  font-variant-numeric: tabular-nums;
}
.toc a:hover { background: var(--lg-tint); color: var(--lg-accent); }
.policy:lang(ar) .toc a:hover { translate: -3px 0; }
.policy:lang(en) .toc a:hover { translate: 3px 0; }

/* ---------- Document ---------- */
.doc { counter-reset: sec; min-width: 0; }

.doc > section {
  padding-bottom: 30px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--lg-line);
  scroll-margin-top: 100px;
}
.doc > section:last-child { margin-bottom: 0; border-bottom: 0; }

.doc > section > h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 700 clamp(21px, 2.4vw, 26px)/1.4 var(--lg-font);
  color: var(--lg-ink);
}
.doc > section > h2::before {
  counter-increment: sec;
  content: counter(sec);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--lg-tint);
  color: var(--lg-accent);
  font: 700 15px/1 var(--lg-font);
  transition: transform .45s var(--ease-spring);
}
.doc > section:hover > h2::before { transform: rotate(-8deg) scale(1.08); }

.doc h3 {
  margin-top: 24px;
  font: 600 17px/1.5 var(--lg-font);
  color: var(--lg-ink);
}

.doc p,
.doc li {
  font: 400 15.5px/1.95 var(--lg-font);
  color: var(--lg-ink-2);
  text-wrap: pretty;
}
.doc p { margin-top: 12px; }
.doc strong { font-weight: 600; color: var(--lg-ink); }
.doc a { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.doc ul { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.doc ul li { position: relative; padding-inline-start: 22px; }
.doc ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: 3px;
  top: .82em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--lg-mark);
  rotate: 45deg;
}

/* "at a glance" box */
.summary {
  margin-bottom: 36px;
  padding: 24px 26px;
  border-radius: 20px;
  background: var(--lg-tint);
  border: 1px solid var(--lg-line);
}
.summary-title { font: 700 18px/1.4 var(--lg-font); color: var(--lg-accent); }
.summary ul li::before { background: var(--lg-accent); }

/* account-deletion box */
.callout {
  margin-top: 16px;
  padding: 6px 24px 22px;
  border-radius: 18px;
  background: var(--lg-surf);
  border: 1.5px solid var(--lg-accent);
}
.callout h3 { margin-top: 18px; }

.steps-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; counter-reset: step; }
.steps-list li { display: flex; align-items: baseline; gap: 12px; }
.steps-list li::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lg-accent);
  color: var(--lg-on-accent);
  font: 600 13px/1 var(--lg-font);
  translate: 0 -1px;
}

/* contact details */
.contact-list { display: grid; gap: 1px; margin-top: 16px; border-radius: 16px; overflow: hidden; background: var(--lg-line); border: 1px solid var(--lg-line); }
.contact-list > div { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 14px 18px; background: var(--lg-surf); }
.contact-list dt { min-width: 130px; font: 500 14px/1.6 var(--lg-font); color: var(--lg-muted); }
.contact-list dd { font: 600 15px/1.6 var(--lg-font); color: var(--lg-ink); }

/* details still to be filled in before publishing */
.fill {
  padding: 0 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  border-bottom: 1.5px dashed var(--lg-mark);
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.footer-nav a[aria-current="page"] { color: var(--gold); }

@keyframes policy-in { from { opacity: 0; translate: 0 12px; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .policy { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
}

@media (max-width: 480px) {
  .callout { padding-inline: 18px; }
  .contact-list dt { min-width: 0; width: 100%; }
}
