/* =========================================================
   Bareeq Tawasul — Legal Pages (Dark SaaS Neon)
   Depends on: css/tokens.css
   Scope: about / privacy / terms / refund
   - RTL + A11y + Responsive + Print
   - Page-local green wash (tuned + mobile-friendly)
   - NO global hacks
   ========================================================= */

*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{
  font-family: var(--font, 'Tajawal', system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  margin:0;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.7;
}

/* ===== Page-wide green wash (tuned) ===== */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-1;
  background:
    radial-gradient(1200px 720px at 12% 18%, rgba(13,213,58,.14), transparent 66%),
    radial-gradient(1100px 680px at 88% 26%, rgba(92,255,106,.10), transparent 68%),
    radial-gradient(1000px 620px at 50% 88%, rgba(13,213,58,.08), transparent 72%),
    linear-gradient(180deg, #07101A 0%, #0B1220 45%, #07101A 100%);
}

/* Mobile: reduce green strength further */
@media (max-width: 520px){
  body::before{
    background:
      radial-gradient(900px 520px at 18% 16%, rgba(13,213,58,.09), transparent 70%),
      radial-gradient(900px 520px at 82% 28%, rgba(92,255,106,.07), transparent 72%),
      linear-gradient(180deg, #07101A 0%, #0B1220 45%, #07101A 100%);
  }
}

a{color:inherit;text-decoration:none}
.link{color: rgba(92,255,106,.95); font-weight: 900}
.link:hover,.toc a:hover{text-decoration:underline}
img{max-width:100%;height:auto;display:block}
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ===== Local tokens for legal UI (derived from global tokens) ===== */
:root{
  --maxw-legal: 1000px;

  --hero-bg: linear-gradient(180deg, rgba(16,28,54,.78), rgba(14,23,43,.70));
  --hero-fg: var(--fg);

  /* Soft surfaces: subtle green hint */
  --soft: rgba(255,255,255,.03);

  --chip: rgba(92,255,106,.10);
  --chip-stroke: rgba(92,255,106,.18);

  --legal-line: rgba(255,255,255,.10);
  --legal-line-2: rgba(255,255,255,.07);

  --shadow-legal: 0 14px 40px rgba(0,0,0,.45);
}

/* Focus (A11y) */
:focus-visible{
  outline: 2px solid rgba(92,255,106,.55);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ===== Topbar ===== */
.topbar{
  position:sticky;top:0;z-index:1000;
  background: rgba(11,18,32,.66);
  color: var(--fg);
  border-bottom:1px solid rgba(255,255,255,.06);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  backdrop-filter: blur(12px) saturate(140%);
}
.topbar__in{
  max-width: var(--maxw-legal);
  margin:0 auto;
  display:flex;align-items:center;gap:12px;
  padding:10px 16px;
}
.topbar__brand{display:flex;align-items:center;gap:10px;margin-inline-start:auto}
.topbar__brand img{
  width:26px;height:26px;border-radius:10px;object-fit:cover;
  box-shadow: 0 0 0 1px rgba(92,255,106,.14), 0 18px 60px rgba(13,213,58,.10);
}
.topbar__brand b{font-weight:900;font-size:18px;letter-spacing:.2px}

/* ===== Hero ===== */
.hero{
  background: var(--hero-bg);
  color: var(--hero-fg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: relative;
  overflow: hidden;
}
.hero::before{
  content:"";
  position:absolute;
  inset:-35%;
  pointer-events:none;
  background:
    radial-gradient(1100px 620px at 18% 25%, rgba(13,213,58,.18), transparent 62%),
    radial-gradient(900px 520px at 82% 60%, rgba(92,255,106,.12), transparent 62%),
    radial-gradient(720px 520px at 90% 20%, rgba(13,213,58,.08), transparent 60%);
  opacity:1;
}
.hero__in{
  max-width: var(--maxw-legal);
  margin:0 auto;
  padding:22px 16px;
  display:grid;
  gap:12px;
  position: relative;
}
.hero__title{
  font-weight:900;
  font-size:clamp(22px,3.6vw,34px);
  line-height:1.25;
  margin:0;
}
.hero__meta{display:flex;flex-wrap:wrap;gap:10px;opacity:.92}
.badge{
  background: var(--chip);
  border: 1px solid var(--chip-stroke);
  border-radius:999px;
  padding:6px 10px;
  font-size:13px;
  font-weight: 900;
  color: rgba(245,247,250,.92);
}

/* Cross-nav بين الصفحات القانونية */
.legal-nav{
  display:flex;
  gap:8px;
  justify-content:center;
  margin:10px 0;
}
.btn-legal{
  display:inline-flex;align-items:center;gap:6px;
  padding:8px 12px;
  border:1px solid var(--legal-line);
  border-radius:999px;
  background: var(--soft);
  color: var(--fg);
  font-weight:900;
}
.btn-legal:hover{filter:brightness(1.06)}
.btn-legal[aria-current="page"]{
  border-color: rgba(92,255,106,.22);
  box-shadow: 0 0 0 1px rgba(92,255,106,.14) inset;
}

/* ===== Content ===== */
.container{max-width: var(--maxw-legal); margin-inline:auto; padding:24px 16px}

.toc{
  background: var(--soft);
  border: 1px solid var(--legal-line);
  border-radius: var(--radius, 14px);
  padding:14px;
}
.toc h2{margin:0 0 8px;font-size:16px;font-weight:900}
.toc a{
  display:block;
  padding:8px 0;
  color: rgba(92,255,106,.90);
  font-weight:900;
}
.toc a:hover{color: rgba(245,247,250,.92)}

.section{
  background: rgba(255,255,255,.03);
  border: 1px solid var(--legal-line);
  border-radius: var(--radius, 14px);
  padding:18px;
  margin:14px 0;
  scroll-margin-top: 84px; /* لتفادي الهيدر اللزق */
}
.section h2{font-size:20px;font-weight:900;margin:0 0 8px}
.section h3{font-size:16px;font-weight:900;margin:10px 0 6px}
.section p{margin: 8px 0; color: rgba(245,247,250,.86)}
.list{margin:6px 0 0; padding-inline-start:18px}
.list li{margin:6px 0; color: rgba(245,247,250,.84)}

.note{
  background: rgba(255,255,255,.02);
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 14px;
  padding:12px;
  margin-top:10px;
  color: rgba(245,247,250,.86);
}

.callout{
  border-inline-start:4px solid rgba(92,255,106,.85);
  padding:10px 12px;
  border-radius:14px;
  background: rgba(92,255,106,.08);
  border: 1px solid rgba(92,255,106,.14);
}
.muted{color: var(--muted)}

/* Grid */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media (max-width:780px){.grid-2{grid-template-columns:1fr}}

/* Active section (TOC + Section) */
.section.is-active{
  box-shadow: var(--shadow-legal);
  border-color: rgba(92,255,106,.18);
}
.toc a.is-active{position:relative}
.toc a.is-active::before{
  content:"";
  position:absolute;
  inset-inline-start:-8px;
  top:50%;
  transform:translateY(-50%);
  width:6px;height:6px;border-radius:999px;
  background: rgba(92,255,106,.95);
}
/* إبراز الهدف عند الوصول مباشرة بـ #hash */
:target{box-shadow: var(--shadow-legal); border-color: rgba(92,255,106,.18)}

/* Long words & bidi safety */
.section p,.section li{word-wrap:break-word;overflow-wrap:break-word}

/* ===== Footer ===== */
.footer{
  background: rgba(0,0,0,.18);
  color: rgba(245,247,250,.92);
  margin-top:20px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.footer__in{max-width: var(--maxw-legal); margin:0 auto; padding:18px 16px; display:grid; gap:10px}
.f_copy{
  border-top:1px solid rgba(255,255,255,.06);
  margin-top:8px;
  padding-top:8px;
  color: rgba(245,247,250,.60);
  font-size:13px;
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:8px;
}

/* ===== Mobile polish ===== */
@media (max-width: 520px){
  .hero__in{ padding:18px 12px; }
  .container{ padding:18px 12px; }

  .legal-nav{
    justify-content:flex-start;
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 12px;
    gap: 10px;
  }
  .legal-nav::-webkit-scrollbar{ display:none; }

  .btn-legal{
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .toc{ padding:12px; }
  .toc a{ padding:10px 0; }

  .section{
    padding:14px;
    border-radius: 16px;
  }
}

/* Print: صفحة قانونية نظيفة */
@media print{
  :root{color-scheme:light}
  body{background:#fff;color:#000}
  .topbar,.legal-nav,.footer{display:none}
  .section,.toc{border:0;box-shadow:none;background:transparent}
  a[href^="http"]::after{content:" (" attr(href) ")"; font-weight:400; font-size:90%}
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce){
  *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}

