/*
 * Legal document pages (Rihla: Page légale block): terms of use, terms of
 * sale, cookie policy. Builds on rihla-destination.css (tokens, shell) and
 * the brand palette in rihla-brand.css.
 */

/* The block is edge-to-edge: drop the page template's box. */
.page-template-content:has(> .rd-legal) { max-width: none; padding: 0; }

/* The layout's overflow:hidden would stop the table of contents from
   sticking; clip crops the same way without that side effect. */
.bravo_wrap:has(.rd-legal) { overflow: clip !important; }
main:has(.rd-legal) { overflow: visible !important; }

.rd-legal { padding-bottom: 88px; }
.rd-legal-shell { max-width: 1240px; }

/* ── Hero ── */
.rd-legal-hero {
  background: linear-gradient(180deg, var(--rihla-green-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--rd-dest-line);
  padding: 56px 0 0;
}
.rd-legal-kicker {
  color: var(--rihla-green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  margin: 0 0 12px !important;
  text-transform: uppercase;
}
.rd-legal-hero__title {
  color: var(--rihla-ink);
  font-family: var(--rd-dest-display);
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.15;
  margin: 0;
  max-width: 820px;
}
.rd-legal-hero__meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 16px;
}
.rd-legal-updated { color: var(--rihla-muted); font-size: 15px; }
.rd-legal-print {
  background: none;
  border: 0;
  color: var(--rihla-green);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.rd-legal-print:hover { color: var(--rihla-red); }

.rd-legal-docs {
  display: flex;
  gap: 4px 28px;
  margin-top: 32px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rd-legal-docs::-webkit-scrollbar { display: none; }
.rd-legal-docs a {
  border-bottom: 3px solid transparent;
  color: var(--rihla-muted);
  flex: none;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 0;
  transition: color .2s ease, border-color .2s ease;
}
.rd-legal-docs a:hover { color: var(--rihla-ink); }
.rd-legal-docs a[aria-current="page"] { border-color: var(--rihla-red); color: var(--rihla-ink); }

/* ── Layout ── */
.rd-legal-layout {
  align-items: start;
  display: grid;
  gap: 64px;
  grid-template-columns: 290px minmax(0, 1fr);
  padding-top: 48px;
}

/* ── Table of contents ── */
.rd-legal-toc {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  position: sticky;
  top: 116px;
}
.rd-legal-toc summary {
  color: var(--rihla-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  list-style: none;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.rd-legal-toc summary::-webkit-details-marker { display: none; }
.rd-legal-toc ol { border-left: 2px solid var(--rd-dest-line); display: grid; gap: 2px; }
.rd-legal-toc a {
  border-left: 2px solid transparent;
  color: var(--rihla-muted);
  display: block;
  font-size: 14.5px;
  line-height: 1.4;
  margin-left: -2px;
  padding: 7px 0 7px 16px;
  transition: color .2s ease, border-color .2s ease;
}
.rd-legal-toc a span { font-variant-numeric: tabular-nums; }
.rd-legal-toc a:hover { border-color: var(--rihla-red); color: var(--rihla-red); }

/* ── Document body ── */
.rd-legal-body { color: #3d4b5c; font-size: 16.5px; line-height: 1.75; max-width: 800px; min-width: 0; }
.rd-legal-body p { margin: 0 0 16px; }
.rd-legal-body a { color: var(--rihla-green); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.rd-legal-body a:hover { color: var(--rihla-red); }
.rd-legal-body strong { color: var(--rihla-ink); font-weight: 600; }

.rd-legal-intro {
  background: var(--rihla-red-wash);
  border-left: 3px solid var(--rihla-red);
  border-radius: 0 10px 10px 0;
  margin-bottom: 40px;
  padding: 22px 26px;
}
.rd-legal-intro p:last-child { margin-bottom: 0; }

.rd-legal-section { padding-bottom: 20px; scroll-margin-top: 110px; }
.rd-legal-section + .rd-legal-section { border-top: 1px solid var(--rd-dest-line); padding-top: 36px; }
.rd-legal-section h2 {
  color: var(--rihla-ink);
  font-family: var(--rd-dest-display);
  font-size: clamp(21px, 2vw, 25px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
  margin: 0 0 18px;
}
.rd-legal-section h2 span { color: var(--rihla-red); }
.rd-legal-section h3 {
  color: var(--rihla-ink);
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.4;
  margin: 26px 0 10px;
}
.rd-legal-body ul,
.rd-legal-body ol { margin: 0 0 16px; padding-left: 22px; }
.rd-legal-body ul { list-style: disc; }
.rd-legal-body ol { list-style: decimal; }
.rd-legal-body li { margin-bottom: 8px; padding-left: 4px; }
.rd-legal-body li::marker { color: var(--rihla-red); }

.rd-legal-body table {
  border-collapse: collapse;
  display: block;
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 20px;
  overflow-x: auto;
  width: 100%;
}
.rd-legal-body th,
.rd-legal-body td {
  border: 1px solid var(--rd-dest-line);
  min-width: 130px;
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
}
.rd-legal-body th { background: var(--rihla-green-soft); color: var(--rihla-ink); font-weight: 700; }
.rd-legal-body code { background: #f3f5f7; border-radius: 4px; color: var(--rihla-ink); font-size: .92em; padding: 2px 6px; }

/* ── Cookie choices ── */
.rd-legal-consent {
  align-items: center;
  border: 1px solid var(--rd-dest-line);
  border-radius: 12px;
  box-shadow: var(--rd-dest-shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  justify-content: space-between;
  margin-bottom: 40px;
  padding: 22px 26px;
}
.rd-legal-consent p { margin: 0; }
.rd-legal-consent__title {
  color: var(--rihla-ink);
  font-family: var(--rd-dest-display);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px !important;
}
.rd-legal-consent__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.rd-legal-consent__btn {
  background: #fff;
  border: 1px solid var(--rihla-ink);
  border-radius: 8px;
  color: var(--rihla-ink);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  min-height: 46px;
  padding: 0 20px;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.rd-legal-consent__btn:hover { border-color: var(--rihla-red); color: var(--rihla-red); }
.rd-legal-consent__btn--accept { background: var(--rihla-red); border-color: var(--rihla-red); color: #fff; }
.rd-legal-consent__btn--accept:hover { background: var(--rihla-red-hover); border-color: var(--rihla-red-hover); color: #fff; }

/* ── Tablet and phone: the table of contents folds above the text ── */
@media (max-width: 991px) {
  .rd-legal { padding-bottom: 56px; }
  .rd-legal-hero { padding-top: 36px; }
  .rd-legal-layout { gap: 28px; grid-template-columns: minmax(0, 1fr); padding-top: 28px; }
  .rd-legal-toc {
    border: 1px solid var(--rd-dest-line);
    border-radius: 12px;
    max-height: none;
    padding: 0 18px;
    position: static;
  }
  .rd-legal-toc summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    margin: 0;
    padding: 16px 0;
  }
  .rd-legal-toc summary::after { content: '+'; font-size: 20px; font-weight: 500; line-height: 1; }
  .rd-legal-toc details[open] summary::after { content: '−'; }
  .rd-legal-toc ol { margin-bottom: 16px; }
  .rd-legal-body { font-size: 16px; max-width: none; }
  .rd-legal-intro,
  .rd-legal-consent { padding: 18px 20px; }
  .rd-legal-consent__actions,
  .rd-legal-consent__btn { width: 100%; }
}

@media print {
  .rd-legal-docs,
  .rd-legal-toc,
  .rd-legal-print,
  .rd-legal-consent { display: none !important; }
  .rd-legal-hero { background: none; border: 0; padding: 0; }
  .rd-legal-layout { display: block; padding-top: 16px; }
  .rd-legal-body { max-width: none; }
}
