/* ============================================================
   LEGAL & PUBLIC UTILITY PAGES
   ------------------------------------------------------------
   privacy.html · terms.html · about.html · 404.html · offline.html

   READS FROM
     foundation.css   tokens, container, container-narrow, eyebrow
     components.css   buttons, icons, watermark tokens

   MODULE MAP
     01 · Legal page shell
     02 · Legal head
     03 · Legal layout
     04 · Legal ToC sidebar
     05 · Legal body typography
     06 · Legal summary box
     07 · Legal items list
     08 · Legal never list
     09 · Legal callout box
     10 · Legal data table
     11 · Legal actions grid
     12 · Legal contact block
     13 · Legal foot
     14 · Not found
     15 · Responsive
     16 · Reduced motion
     17 · Print
     18 · About page

   STATE
     .legal-toc-list a[aria-current="true"]   scroll-spy
     .notfound-fallback                       404.js hook

   ============================================================
   THEME
   ============================================================
   Headings read --heading / --heading-soft so they flip.
   Light-blue accents carry html[data-theme="dark"] overrides.

   RTL
     Logical properties throughout; decorative rings mirror via
     html[dir="rtl"].

   ARABIC
     letter-spacing: 0 on every uppercase-Latin class.
   ============================================================ */


/* ============================================================
   01 · LEGAL PAGE SHELL
   ------------------------------------------------------------
   FIX: mobile bottom padding clears the fixed 54px bottom nav
   + the iOS safe-area inset. Without this, the closing footer
   row and the last content card were sitting under the nav.
   ============================================================ */

.legal-page {
  background: var(--surface);
  padding-block: var(--space-12);
}

@media (max-width: 850px) {
  .legal-page {
    padding-block:
      var(--space-8)
      calc(54px + env(safe-area-inset-bottom, 0px) + var(--space-10));
  }
}


/* ============================================================
   02 · LEGAL HEAD
   ============================================================ */

.legal-head {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-soft);
}

.legal-head .eyebrow {
  display: block;
  margin-bottom: var(--space-3);
}

.legal-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.035em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

html[lang="ar"] .legal-title {
  letter-spacing: 0;
  line-height: 1.3;
}

.legal-lead {
  max-width: 720px;
  margin: var(--space-5) 0 0;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.75;
}

.legal-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.legal-meta svg,
.legal-meta iconify-icon {
  width: 14px;
  height: 14px;
  color: var(--text-light);
}

@media (max-width: 640px) {
  .legal-head { margin-bottom: var(--space-6); }
  .legal-lead { font-size: var(--fs-sm); }
}


/* ============================================================
   03 · LEGAL LAYOUT
   ============================================================ */

.legal-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--space-10);
  align-items: start;
  min-width: 0;
}

@media (max-width: 1024px) {
  .legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }
}


/* ============================================================
   04 · LEGAL TOC
   ------------------------------------------------------------
   Desktop: sticky sidebar with scroll-spy.
   Mobile:  pill rows that WRAP. No horizontal scroll, so
            nothing gets clipped at the right edge.

   FIX: previous mobile behaviour was overflow-x: auto on a
   flex row — the last chip always appeared cut off. Wrapping
   removes that entirely.
   ============================================================ */

.legal-toc {
  position: sticky;
  top: calc(var(--topbar-h, 0px) + var(--space-5));
  align-self: start;
  max-height: calc(100vh - var(--topbar-h, 0px) - var(--space-10));
  max-height: calc(100dvh - var(--topbar-h, 0px) - var(--space-10));
  overflow-y: auto;
  padding: var(--space-5);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
  min-width: 0;
}

.legal-toc::-webkit-scrollbar { width: 6px; }
.legal-toc::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--radius-pill);
}
.legal-toc:hover::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

.legal-toc-title {
  margin: 0 0 var(--space-3);
  color: var(--text-light);
  font-size: 10px;
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .legal-toc-title {
  letter-spacing: 0;
}

.legal-toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.legal-toc-list a {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  text-decoration: none;
  border-inline-start: 2px solid transparent;
  transition:
    color            var(--dur-fast) var(--ease),
    border-color     var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.legal-toc-list a:hover {
  color: var(--blue-600);
  border-inline-start-color: var(--blue-600);
  background: var(--surface);
}

html[data-theme="dark"] .legal-toc-list a:hover {
  color: var(--blue-400);
  border-inline-start-color: var(--blue-400);
}

.legal-toc-list a[aria-current="true"] {
  color: var(--heading);
  border-inline-start-color: var(--heading);
  background: var(--surface);
  font-weight: var(--fw-bold);
}

.legal-toc-list a:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* ---------- MOBILE / TABLET — WRAPPING PILLS ---------- */

@media (max-width: 1024px) {
  .legal-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: var(--space-4);
  }

  .legal-toc-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
    overflow: visible;
  }

  .legal-toc-list li {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .legal-toc-list a {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    border-inline-start: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-xs);
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .legal-toc-list a:hover,
  .legal-toc-list a[aria-current="true"] {
    background: var(--blue-50);
    border-color: var(--blue-100);
    border-inline-start-color: var(--blue-100);
    color: var(--blue-700);
  }

  html[data-theme="dark"] .legal-toc-list a:hover,
  html[data-theme="dark"] .legal-toc-list a[aria-current="true"] {
    background: rgba(96, 165, 250, 0.10);
    border-color: rgba(96, 165, 250, 0.22);
    color: var(--blue-100);
  }
}


/* ============================================================
   05 · LEGAL BODY TYPOGRAPHY
   ------------------------------------------------------------
   FIX: overflow-wrap: anywhere on every text node so long
   URLs, emails and unbreakable strings never blow out the
   column and cause a horizontal scroll.
   ============================================================ */

.legal-body {
  min-width: 0;
  max-width: 780px;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.legal-body h2 {
  margin: var(--space-10) 0 var(--space-4);
  color: var(--heading);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.025em;
  line-height: 1.25;
  scroll-margin-top: calc(var(--topbar-h, 0px) + var(--space-5));
  overflow-wrap: anywhere;
}

.legal-body h2:first-child { margin-top: 0; }

.legal-body h3 {
  margin: var(--space-6) 0 var(--space-3);
  color: var(--heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  line-height: 1.35;
  scroll-margin-top: calc(var(--topbar-h, 0px) + var(--space-5));
  overflow-wrap: anywhere;
}

.legal-body p {
  margin: 0 0 var(--space-4);
  color: var(--text-soft);
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.legal-body ul,
.legal-body ol {
  margin: 0 0 var(--space-5);
  padding-inline-start: var(--space-6);
  line-height: 1.8;
}

.legal-body ul { list-style: disc; }
.legal-body ol { list-style: decimal; }

.legal-body li {
  margin-bottom: var(--space-2);
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.legal-body li::marker { color: var(--blue-600); }

html[data-theme="dark"] .legal-body li::marker {
  color: var(--blue-400);
}

.legal-body a {
  color: var(--blue-600);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .legal-body a { color: var(--blue-400); }
.legal-body a:hover { color: var(--blue-700); }
html[data-theme="dark"] .legal-body a:hover { color: var(--blue-100); }

.legal-body strong {
  color: var(--heading);
  font-weight: var(--fw-bold);
}

.legal-body code {
  padding: 2px 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  color: var(--heading-soft);
  font-family: var(--font-mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.legal-body img,
.legal-body video,
.legal-body iframe {
  max-width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  .legal-body {
    font-size: var(--fs-sm);
    line-height: 1.8;
  }
  .legal-body h2 { font-size: var(--fs-xl); }
  .legal-body h3 { font-size: var(--fs-base); }
}


/* ============================================================
   06 · LEGAL SUMMARY BOX
   ============================================================ */

.legal-summary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-lg);
}

html[data-theme="dark"] .legal-summary {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
}

html[dir="rtl"] .legal-summary::before {
  inset-inline-end: auto;
  inset-inline-start: -90px;
}

.legal-summary > * { position: relative; z-index: 1; }

.legal-summary-title {
  margin: 0 0 var(--space-3);
  color: var(--blue-700);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

html[data-theme="dark"] .legal-summary-title {
  color: var(--blue-100);
}

.legal-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-summary-list li {
  position: relative;
  padding-inline-start: var(--space-6);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.legal-summary-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  background: var(--blue-600);
  border-radius: var(--radius-circle);
}

html[data-theme="dark"] .legal-summary-list li::before {
  background: var(--blue-400);
}

@media (max-width: 640px) {
  .legal-summary {
    padding: var(--space-5);
    margin-bottom: var(--space-6);
  }
}


/* ============================================================
   07 · LEGAL ITEMS LIST
   ============================================================ */

.legal-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}

.legal-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  min-width: 0;
}

.legal-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--blue-600);
}

html[data-theme="dark"] .legal-item-icon {
  color: var(--blue-400);
  border-color: rgba(96, 165, 250, 0.22);
}

.legal-item-icon svg { width: 20px; height: 20px; }

.legal-item-body { min-width: 0; }

.legal-item-title {
  margin: 0 0 var(--space-2);
  color: var(--heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  line-height: 1.3;
}

.legal-item-text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
  overflow-wrap: anywhere;
}


/* ============================================================
   08 · LEGAL NEVER LIST
   ============================================================ */

.legal-never {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: var(--space-5) 0;
  padding: var(--space-6);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-lg);
}

.legal-never-title {
  margin: 0 0 var(--space-3);
  color: var(--danger);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.legal-never-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-never-item {
  position: relative;
  padding-inline-start: var(--space-6);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.legal-never-item::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 9px;
  width: 12px;
  height: 2px;
  background: var(--danger);
  border-radius: 1px;
}

@media (max-width: 640px) {
  .legal-never { padding: var(--space-5); }
}


/* ============================================================
   09 · LEGAL CALLOUT BOX
   ============================================================ */

.legal-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-4);
  margin: var(--space-5) 0;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid;
}

.legal-callout svg,
.legal-callout iconify-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin-top: 2px;
}

.legal-callout-body { min-width: 0; }

.legal-callout-title {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  line-height: 1.3;
}

.legal-callout p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: inherit;
  overflow-wrap: anywhere;
}

.legal-callout-info {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: var(--info);
}

.legal-callout-important {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning);
}

.legal-callout-warning {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

html[data-theme="dark"] .legal-callout-info {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-100);
}

html[data-theme="dark"] .legal-callout-important {
  background: rgba(251, 191, 36, 0.10);
  border-color: rgba(251, 191, 36, 0.24);
  color: #fbbf24;
}

html[data-theme="dark"] .legal-callout-warning {
  background: rgba(248, 113, 113, 0.10);
  border-color: rgba(248, 113, 113, 0.24);
  color: #fca5a5;
}


/* ============================================================
   10 · LEGAL DATA TABLE
   ------------------------------------------------------------
   FIX: overflow-wrap + a self-contained .table-wrap fallback
   in case data.css isn't on the page.
   ============================================================ */

.legal-body .table-wrap,
.table-wrap:has(.legal-data-table) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.legal-data-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-4) 0 var(--space-6);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.legal-data-table th,
.legal-data-table td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-soft);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.legal-data-table th {
  background: var(--surface-soft);
  color: var(--heading);
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

html[lang="ar"] .legal-data-table th {
  letter-spacing: 0;
}

.legal-data-table td {
  color: var(--text-soft);
  line-height: 1.65;
}

.legal-data-table tbody tr:nth-child(even) td {
  background: var(--surface-sunken);
}

html[data-theme="dark"] .legal-data-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

@media (max-width: 640px) {
  .legal-data-table th,
  .legal-data-table td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-xs);
    white-space: normal;
  }
}


/* ============================================================
   11 · LEGAL ACTIONS GRID
   ============================================================ */

.legal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.legal-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}

.legal-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  color: var(--blue-600);
}

html[data-theme="dark"] .legal-action-icon {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.legal-action-icon svg { width: 18px; height: 18px; }

.legal-action-body { min-width: 0; }

.legal-action-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-extrabold);
  line-height: 1.3;
  margin-bottom: 2px;
}

.legal-action-text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.55;
  overflow-wrap: anywhere;
}


/* ============================================================
   12 · LEGAL CONTACT BLOCK
   ============================================================ */

.legal-contact {
  margin: var(--space-5) 0;
  padding: var(--space-6);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.legal-contact-title {
  margin: 0 0 var(--space-3);
  color: var(--heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
}

.legal-contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.legal-contact-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.legal-contact-list svg {
  color: var(--blue-600);
  flex: 0 0 18px;
}

html[data-theme="dark"] .legal-contact-list svg { color: var(--blue-400); }

.legal-contact-list a {
  color: var(--blue-600);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .legal-contact-list a { color: var(--blue-400); }

.legal-contact-list a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 640px) {
  .legal-contact { padding: var(--space-5); }
}


/* ============================================================
   13 · LEGAL FOOT
   ============================================================ */

.legal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border-soft);
}

.legal-foot .btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

@media (max-width: 480px) {
  .legal-foot {
    flex-direction: column;
    align-items: stretch;
  }
  .legal-foot .btn { width: 100%; justify-content: center; }
}


/* ============================================================
   14 · NOT FOUND  (404.html + offline.html)
   ============================================================ */

.notfound {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding-block: var(--space-16);
  text-align: center;
}

html[dir="rtl"] .notfound::before {
  inset-inline-end: auto;
  inset-inline-start: -280px;
}

html[dir="rtl"] .notfound::after {
  inset-inline-start: auto;
  inset-inline-end: -240px;
}

.notfound-inner {
  position: relative;
  z-index: 1;
  width: min(var(--container-narrow), calc(100% - 40px));
}

.notfound-code {
  display: block;
  margin-bottom: var(--space-4);
  color: var(--blue-600);
  font-size: clamp(72px, 14vw, 140px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

html[lang="ar"] .notfound-code { letter-spacing: 0; }
html[data-theme="dark"] .notfound-code { color: var(--blue-400); }

.notfound-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.notfound-body {
  max-width: 520px;
  margin: var(--space-4) auto 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: 1.7;
}

.notfound-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-3);
  margin-top: var(--space-8);
  text-align: start;
}

.notfound-link {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition:
    transform    var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

.notfound-link:hover {
  transform: translateY(-2px);
  border-color: var(--blue-100);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .notfound-link:hover {
  border-color: rgba(96, 165, 250, 0.30);
}

.notfound-link-title {
  color: var(--heading);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}

.notfound-link-desc {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.4;
}

.notfound-fallback {
  margin-top: var(--space-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.notfound-fallback .btn {
  flex: 0 0 auto;
  pointer-events: auto !important;
  cursor: pointer !important;
}

@media (max-width: 640px) {
  .notfound {
    min-height: 60vh;
    padding-block:
      var(--space-10)
      calc(54px + env(safe-area-inset-bottom, 0px) + var(--space-10));
  }

  .notfound-links { grid-template-columns: 1fr; }

  .notfound-fallback {
    flex-direction: column;
    align-items: stretch;
  }

  .notfound-fallback .btn {
    width: 100%;
    justify-content: center;
  }
}


/* ============================================================
   15 · RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .legal-title { font-size: clamp(24px, 7vw, 32px); }
}


/* ============================================================
   16 · REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .legal-toc-list a,
  .notfound-link {
    transition: none !important;
  }

  .notfound-link:hover { transform: none; }

  .legal-page,
  .legal-page * { scroll-behavior: auto; }
}


/* ============================================================
   17 · PRINT
   ============================================================ */

@media print {
  .legal-summary::before,
  .notfound::before,
  .notfound::after {
    display: none !important;
  }

  .legal-toc,
  .legal-foot { display: none !important; }

  .legal-layout { grid-template-columns: 1fr !important; }

  .legal-body {
    font-size: 11pt;
    color: #000 !important;
  }

  .legal-body h2,
  .legal-body h3,
  .legal-body strong { color: #000 !important; }

  .legal-body a {
    color: #000 !important;
    text-decoration: underline;
  }

  .legal-summary,
  .legal-never,
  .legal-callout,
  .legal-contact,
  .legal-item {
    background: transparent !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .notfound-link {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}


/* ============================================================
   18 · ABOUT PAGE  (about.html)
   ============================================================ */

.about-page {
  position: relative;
  isolation: isolate;
  background: var(--surface);
  padding-block: 0 var(--space-16);
  overflow-x: clip;
}

@media (max-width: 850px) {
  .about-page {
    padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px) + var(--space-10));
  }
}


/* ---------- 18.02 · HERO ---------- */

.about-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--brand-bg);
  color: var(--text-invert);
  padding-block: clamp(var(--space-12), 12vw, var(--space-20));
}

html[dir="rtl"] .about-hero::before {
  inset-inline-end: auto;
  inset-inline-start: -320px;
}

html[dir="rtl"] .about-hero::after {
  inset-inline-start: auto;
  inset-inline-end: -260px;
}

.about-hero-inner {
  position: relative;
  z-index: 1;
  width: min(var(--container-narrow), calc(100% - 40px));
  margin-inline: auto;
}

.about-hero-eyebrow {
  display: inline-block;
  margin-bottom: var(--space-5);
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .about-hero-eyebrow { letter-spacing: 0; }

.about-hero-title {
  margin: 0;
  color: var(--text-invert);
  font-size: clamp(30px, 5.5vw, 54px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.035em;
  line-height: 1.08;
  max-width: 22ch;
  overflow-wrap: anywhere;
}

html[lang="ar"] .about-hero-title {
  letter-spacing: 0;
  line-height: 1.28;
}

.about-hero-title-accent {
  display: block;
  margin-top: var(--space-2);
  color: rgba(255, 255, 255, 0.62);
  font-weight: var(--fw-bold);
}

.about-hero-subtitle {
  max-width: 620px;
  margin: var(--space-6) 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--fs-md);
  line-height: 1.75;
}

.about-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.about-hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255, 255, 255, 0.72);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.about-hero-meta-item svg {
  color: rgba(255, 255, 255, 0.55);
  flex: 0 0 14px;
}

@media (max-width: 640px) {
  .about-hero-inner { width: calc(100% - 28px); }
  .about-hero-subtitle { font-size: var(--fs-sm); }
  .about-hero-meta { gap: var(--space-2) var(--space-4); }
}


/* ---------- 18.03 · MANIFESTO ---------- */

.about-manifesto {
  background: var(--surface-soft);
  padding-block: clamp(var(--space-12), 10vw, var(--space-16));
  border-bottom: 1px solid var(--border-soft);
}

.about-manifesto-inner {
  width: min(var(--container-narrow), calc(100% - 40px));
  margin-inline: auto;
  text-align: center;
}

.about-manifesto-quote {
  position: relative;
  margin: 0 auto;
  padding: 0;
  color: var(--heading);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: 1.4;
  max-width: 720px;
}

html[lang="ar"] .about-manifesto-quote {
  letter-spacing: 0;
  line-height: 1.55;
}

.about-manifesto-quote::before,
.about-manifesto-quote::after {
  display: block;
  color: var(--blue-600);
  font-size: 40px;
  font-weight: var(--fw-extrabold);
  line-height: 0.5;
  opacity: 0.5;
}

html[data-theme="dark"] .about-manifesto-quote::before,
html[data-theme="dark"] .about-manifesto-quote::after {
  color: var(--blue-400);
}

.about-manifesto-quote::before {
  content: "\201C";
  margin-bottom: var(--space-3);
}

.about-manifesto-quote::after {
  content: "\201D";
  margin-top: var(--space-4);
}

.about-manifesto-body {
  max-width: 620px;
  margin: var(--space-6) auto 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: 1.75;
}

@media (max-width: 640px) {
  .about-manifesto-inner { width: calc(100% - 28px); }
  .about-manifesto-body { font-size: var(--fs-sm); }
}


/* ---------- 18.04 · SECTION SKELETON ---------- */

.about-section {
  padding-block: clamp(var(--space-10), 8vw, var(--space-16));
}

.about-section-tight {
  padding-block: clamp(var(--space-8), 6vw, var(--space-12));
}

.about-section-inner {
  width: min(var(--container-max), calc(100% - 40px));
  margin-inline: auto;
}

.about-section-head {
  max-width: 720px;
  margin-bottom: clamp(var(--space-6), 5vw, var(--space-10));
}

.about-section-eyebrow {
  display: inline-block;
  margin-bottom: var(--space-4);
  color: var(--blue-600);
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
}

html[lang="ar"] .about-section-eyebrow { letter-spacing: 0; }
html[data-theme="dark"] .about-section-eyebrow { color: var(--blue-400); }

.about-section-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(24px, 3.2vw, 36px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

html[lang="ar"] .about-section-title {
  letter-spacing: 0;
  line-height: 1.4;
}

.about-section-lead {
  max-width: 620px;
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: 1.75;
}

.about-prose {
  max-width: 720px;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.85;
}

.about-prose p { margin: 0 0 var(--space-4); }
.about-prose p:last-child { margin-bottom: 0; }

.about-prose strong {
  color: var(--heading);
  font-weight: var(--fw-bold);
}

@media (max-width: 640px) {
  .about-section-inner { width: calc(100% - 28px); }
  .about-section-lead,
  .about-prose { font-size: var(--fs-sm); }
}


/* ---------- 18.05 · AUDIENCE GRID ---------- */

.about-audience {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--space-5);
}

.about-audience-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition:
    transform    var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow   var(--dur-fast) var(--ease);
}

html[dir="rtl"] .about-audience-card::before {
  inset-inline-end: auto;
  inset-inline-start: -80px;
}

.about-audience-card > * { position: relative; z-index: 1; }

.about-audience-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue-100);
  box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .about-audience-card:hover {
  border-color: rgba(96, 165, 250, 0.30);
}

.about-audience-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-lg);
  color: var(--blue-600);
}

.about-audience-icon svg { width: 24px; height: 24px; }

html[data-theme="dark"] .about-audience-icon {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.about-audience-title {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.about-audience-body {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.75;
}


/* ---------- 18.06 · PRINCIPLES ---------- */

.about-principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-5);
}

.about-principle {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.about-principle::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: var(--space-6);
  bottom: var(--space-6);
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
  opacity: 0.85;
}

html[dir="rtl"] .about-principle::before {
  inset-inline-start: auto;
  inset-inline-end: 0;
  border-radius: 2px 0 0 2px;
}

.about-principle > * { position: relative; z-index: 1; }

.about-principle-number {
  color: currentColor;
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.about-principle-title {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.about-principle-body {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.75;
}

.about-principle[data-tone="blue"]   { color: var(--blue-600); }
.about-principle[data-tone="green"]  { color: var(--success); }
.about-principle[data-tone="orange"] { color: var(--warning); }
.about-principle[data-tone="sand"]   { color: var(--badge-rating); }
.about-principle[data-tone="olive"]  { color: var(--text-soft); }

html[data-theme="dark"] .about-principle[data-tone="blue"]   { color: var(--blue-400); }
html[data-theme="dark"] .about-principle[data-tone="green"]  { color: #4ade80; }
html[data-theme="dark"] .about-principle[data-tone="orange"] { color: #fbbf24; }


/* ---------- 18.07 · BOUNDARY ---------- */

.about-boundary .about-boundary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-boundary-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  min-width: 0;
}

.about-boundary-item-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-circle);
  color: var(--text-light);
}

.about-boundary-item-marker svg { width: 16px; height: 16px; }

.about-boundary-item-body { min-width: 0; }

.about-boundary-item-title {
  margin: 0 0 var(--space-2);
  color: var(--heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  line-height: 1.3;
}

.about-boundary-item-text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
}


/* ---------- 18.08 · LOOP ---------- */

.about-loop {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--space-5);
}

.about-loop-step {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.about-loop-step-index {
  color: var(--blue-600);
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
}

html[data-theme="dark"] .about-loop-step-index { color: var(--blue-400); }

.about-loop-step-title {
  margin: 0;
  color: var(--heading);
  font-size: var(--fs-xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.about-loop-step-body {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.75;
}


/* ---------- 18.09 · COMMITMENTS ---------- */

.about-commitments {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-4);
}

.about-commitment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 0;
}

.about-commitment-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  color: var(--blue-600);
}

.about-commitment-icon svg { width: 22px; height: 22px; }

html[data-theme="dark"] .about-commitment-icon {
  background: rgba(96, 165, 250, 0.10);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--blue-400);
}

.about-commitment-body { min-width: 0; }

.about-commitment-title {
  margin: 0 0 var(--space-2);
  color: var(--heading);
  font-size: var(--fs-base);
  font-weight: var(--fw-extrabold);
  line-height: 1.3;
}

.about-commitment-text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.7;
}


/* ---------- 18.10 · SIGNATURE ---------- */

.about-signature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding-block: clamp(var(--space-10), 8vw, var(--space-16));
  text-align: center;
  width: min(var(--container-narrow), calc(100% - 40px));
  margin-inline: auto;
}

.about-signature-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--brand-bg);
  color: var(--text-invert);
  border-radius: var(--radius-lg);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.04em;
  line-height: 1;
  box-shadow: var(--shadow-md);
}

.about-signature-line {
  margin: 0;
  max-width: 520px;
  color: var(--heading);
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
  line-height: 1.45;
}

html[lang="ar"] .about-signature-line {
  letter-spacing: 0;
  line-height: 1.6;
}

.about-signature-name {
  margin: 0;
  color: var(--text-light);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .about-signature { width: calc(100% - 28px); }
}


/* ---------- 18.11 · CTA ---------- */

.about-cta {
  background: var(--surface-soft);
  border-top: 1px solid var(--border-soft);
  padding-block: clamp(var(--space-10), 8vw, var(--space-16));
}

.about-cta-inner {
  width: min(var(--container-max), calc(100% - 40px));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-8);
}

.about-cta-copy { min-width: 0; }

.about-cta-title {
  margin: 0;
  color: var(--heading);
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.025em;
  line-height: 1.25;
  max-width: 640px;
}

html[lang="ar"] .about-cta-title {
  letter-spacing: 0;
  line-height: 1.45;
}

.about-cta-text {
  max-width: 520px;
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-md);
  line-height: 1.7;
}

.about-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  flex: 0 0 auto;
}

.about-cta-actions .btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}

@media (max-width: 850px) {
  .about-cta-inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

@media (max-width: 480px) {
  .about-cta-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .about-cta-actions .btn {
    width: 100%;
    justify-content: center;
  }
}


/* ---------- 18.12 · ABOUT RESPONSIVE ---------- */

@media (max-width: 640px) {
  .about-principle,
  .about-audience-card,
  .about-loop-step { padding: var(--space-5); }

  .about-audience-icon {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .about-audience-icon svg { width: 20px; height: 20px; }
  .about-principle-number { font-size: var(--fs-2xl); }
  .about-loop-step-index { font-size: var(--fs-3xl); }
}


/* ---------- 18.13 · ABOUT REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  .about-audience-card { transition: none !important; }
  .about-audience-card:hover { transform: none; }
}


/* ---------- 18.14 · ABOUT PRINT ---------- */

@media print {
  .about-hero::before,
  .about-hero::after,
  .about-audience-card::before { display: none !important; }

  .about-hero {
    background: transparent !important;
    color: #000 !important;
    padding-block: var(--space-6) !important;
  }

  .about-hero-title,
  .about-hero-eyebrow,
  .about-hero-subtitle,
  .about-hero-meta-item { color: #000 !important; }

  .about-hero-title-accent { color: #333 !important; }
  .about-hero-meta { border-top-color: #ccc !important; }
  .about-cta-actions { display: none !important; }

  .about-audience-card,
  .about-principle,
  .about-loop-step,
  .about-commitment,
  .about-boundary-item {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .about-audience-card:hover { transform: none !important; }
}


/* ============================================================
   END OF LEGAL
   ------------------------------------------------------------
   This-pass fixes:

     MOBILE CUT-OFF
       · .legal-page gets a mobile bottom padding that clears
         the fixed 54px bottom nav + safe area. This is the
         exact same pattern profile.css uses on .profile-view.
       · .legal-toc on ≤1024px becomes a WRAPPING pill list
         instead of a horizontal scroller — the previous
         strip clipped its last item at the right edge.
       · .legal-body, list items, table cells, and links all
         carry overflow-wrap: anywhere so long URLs, emails
         and unbreakable strings can't blow out the column.
       · .table-wrap gets a self-contained fallback in case
         data.css isn't loaded on the legal pages.
       · Every grid using repeat(auto-fit, minmax(...)) now
         uses minmax(min(Xpx, 100%), 1fr) so on very narrow
         phones the track can shrink instead of forcing a
         horizontal scroll.

     DARK MODE
       · Every heading reads --heading / --heading-soft.
       · Every light-blue accent carries html[data-theme="dark"].
       · Table stripe in dark mode uses rgba(255,255,255,.025).

     RTL — logical properties throughout.
     ARABIC — letter-spacing: 0 on every carrying class.
   ============================================================ */
