.bookify-legal {
  --legal-orange: #ff551a;
  --legal-border: rgba(255, 255, 255, 0.09);
  min-height: 100vh;
  overflow-x: clip;
  background: #0d0d0d;
  color: #fff;
  font-family: Montserrat, "Helvetica Neue", Arial, sans-serif;
}

.legal-hero {
  position: relative;
  padding: 88px max(20px, calc((100% - 1110px) / 2)) 72px;
  overflow: hidden;
  border-bottom: 1px solid var(--legal-border);
}

.legal-hero::after {
  position: absolute;
  width: 420px;
  height: 420px;
  right: -120px;
  top: -210px;
  border-radius: 50%;
  background: rgba(255, 85, 26, 0.13);
  filter: blur(90px);
  content: "";
  pointer-events: none;
}

.legal-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legal-eyebrow::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--legal-orange);
  content: "";
}

.legal-hero h1 {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.legal-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 760px);
  justify-content: center;
  gap: 48px;
  width: min(1110px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 112px;
}

.legal-nav {
  position: sticky;
  top: 104px;
  display: flex;
  flex-direction: column;
  align-self: start;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--legal-border);
  border-radius: 14px;
  background: #111;
}

.legal-nav a {
  padding: 12px 14px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: color 160ms, background 160ms;
}

.legal-nav a:hover,
.legal-nav a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.legal-nav a.active {
  color: #fff;
  background: var(--legal-orange);
}

.legal-document {
  min-width: 0;
  padding: clamp(26px, 4vw, 52px);
  border: 1px solid var(--legal-border);
  border-radius: 18px;
  background: #111;
}

.legal-document .tab-content { padding: 0; }
.legal-document .tab-content > h1:first-child { display: none; }

.legal-document h2,
.legal-document h3 {
  color: #fff;
  letter-spacing: -0.02em;
}

.legal-document h2 {
  margin: 42px 0 14px;
  padding-top: 34px;
  border-top: 1px solid var(--legal-border);
  font-size: 24px;
  line-height: 1.25;
}

.legal-document h2:first-of-type { margin-top: 28px; }

.legal-document h3 {
  margin: 26px 0 10px;
  font-size: 18px;
  line-height: 1.4;
}

.legal-document p,
.legal-document li,
.legal-document td,
.legal-document th {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
  line-height: 1.8;
}

.legal-document p { margin: 0 0 18px; }
.legal-document strong { color: rgba(255, 255, 255, 0.9); }
.legal-document ul,
.legal-document ol { margin: 14px 0 22px; padding-left: 24px; }
.legal-document li + li { margin-top: 9px; }

.legal-document a {
  color: #ff7b4d;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}

.legal-document table {
  display: block;
  width: 100%;
  margin: 22px 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.legal-document th,
.legal-document td { padding: 12px; border: 1px solid var(--legal-border); }

.legal-footer {
  width: min(1110px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 26px;
  border-top: 1px solid var(--legal-border);
}

.legal-footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 48px;
}

.legal-footer-brand img { width: auto; height: 26px; }
.legal-footer-brand p { max-width: 310px; margin: 16px 0 0; color: rgba(255, 255, 255, 0.55); font-size: 13px; line-height: 1.6; }
.legal-footer-links { display: flex; flex-direction: column; gap: 10px; }
.legal-footer-links strong { margin-bottom: 4px; color: #fff; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.legal-footer-links a { color: rgba(255, 255, 255, 0.58); font-size: 13px; text-decoration: none; }
.legal-footer-links a:hover { color: #fff; }
.legal-footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--legal-border); color: rgba(255, 255, 255, 0.42); font-size: 11px; }

/* Arabic / RTL --------------------------------------------------------- */
/* newbookify's SST Arabic @font-face loads globally once activeLocale is
   'ar', but its --bk-font-sans override only reaches .bookify-reference-*
   (the marketing pages' convention) - .bookify-legal hardcodes its own
   font-family and needs the same override applied directly. */
html[dir="rtl"] .bookify-legal { font-family: "SST Arabic", "Montserrat", "Helvetica Neue", Arial, sans-serif !important; }

/* ul/ol indentation is physical (padding-left), so under RTL the numbers/
   bullets need to sit on the right instead, matching where the text starts. */
html[dir="rtl"] .legal-document ul,
html[dir="rtl"] .legal-document ol { padding-left: 0; padding-right: 24px; }

@media (max-width: 767px) {
  .legal-hero { padding: 56px 20px 44px; }
  .legal-hero h1 { font-size: 38px; }
  .legal-layout { display: block; width: 100%; padding: 28px 20px 72px; }
  .legal-nav { position: static; flex-direction: row; margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
  .legal-nav::-webkit-scrollbar { display: none; }
  .legal-nav a { flex: 0 0 auto; white-space: nowrap; }
  .legal-document { padding: 24px 20px; border-radius: 14px; }
  .legal-document h2 { margin-top: 34px; padding-top: 28px; font-size: 21px; }
  .legal-document h3 { font-size: 17px; }
  .legal-document p,
  .legal-document li,
  .legal-document td,
  .legal-document th { font-size: 14px; line-height: 1.75; }
  .legal-footer { width: calc(100% - 40px); padding-top: 38px; }
  .legal-footer-inner { grid-template-columns: 1fr 1fr; gap: 32px 24px; }
  .legal-footer-brand { grid-column: 1 / -1; }
}
