/* Vision Tools — legal pages.
   Same paper-editorial system as the app: warm paper, warm ink, Amiri display,
   Tajawal body, hairlines instead of boxes. */

:root {
  --paper: #f4efe7;
  --paper-deep: #ede6da;
  --sheet: #fbf9f5;
  --ink: #191512;
  --ink-muted: #5f564c;
  --ink-faint: #8c8175;
  --rule: #dcd2c2;
  --accent: #0f6b60;
  --accent-soft: #dceae5;
  --measure: 68ch;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  padding: 0 20px 96px;
  overflow-x: hidden;
}

/* paper grain — the same tactile fingerprint the app has */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.14;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

.wrap { max-width: var(--measure); margin: 0 auto; }

/* ---------------------------------------------------------------- header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand img { width: 40px; height: 40px; border-radius: 50%; }
.brand b { font-family: 'Amiri', serif; font-size: 21px; font-weight: 700; line-height: 1.1; }
.brand span { display: block; font-size: 12px; color: var(--ink-faint); }

.lang {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lang:hover { border-color: var(--ink); color: var(--ink); }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- type */
h1 {
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: clamp(30px, 6vw, 42px);
  line-height: 1.25;
  text-wrap: balance;
}
h2 {
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: clamp(20px, 3.6vw, 25px);
  line-height: 1.35;
  margin: 48px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
h3 { font-size: 16px; font-weight: 700; margin: 24px 0 6px; }
p, li { color: var(--ink-muted); }
p { margin-bottom: 14px; }
ul, ol { margin: 0 0 16px; padding-inline-start: 22px; }
li { margin-bottom: 8px; }
strong { color: var(--ink); font-weight: 700; }
a { color: var(--accent); text-underline-offset: 3px; }

.lede { font-size: 17px; margin: 16px 0 8px; }
.meta { font-size: 13px; color: var(--ink-faint); margin-bottom: 8px; }

/* Bare numerals stay LTR inside Arabic or they reorder into nonsense.
   NOTE: do not include <time> here — an Arabic date contains an Arabic month
   name, and forcing LTR on it reverses the words. */
.num, .ltr { direction: ltr; display: inline-block; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- blocks */
.callout {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 20px 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: #0b4f46; }

.note {
  border-inline-start: 3px solid var(--rule);
  padding-inline-start: 16px;
  margin: 20px 0;
  font-size: 15px;
}

table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 15px; }
th, td { text-align: start; padding: 12px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; color: var(--ink); font-size: 13px; }
td { color: var(--ink-muted); }
.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 32px; }
.card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 22px;
}
.card:hover { border-color: var(--ink); }
.card b { font-family: 'Amiri', serif; font-size: 20px; display: block; margin-bottom: 6px; }
.card span { font-size: 14px; color: var(--ink-muted); }

/* ---------------------------------------------------------------- footer */
footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-faint);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: space-between;
}
footer a { color: var(--ink-muted); }

/* ---------------------------------------------------------------- i18n */
[data-lang] { display: none; }
html[lang='ar'] [data-lang='ar'] { display: revert; }
html[lang='en'] [data-lang='en'] { display: revert; }

/* Arabic is cursive: letter-spacing and uppercase break the letter joins. */
html[lang='ar'] * { letter-spacing: normal !important; text-transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
