/* Boditrax website - Legal Centre (/legal and /legal/*)
 * Document cards on the Legal Centre hub and the "More from the Legal Centre" strip, and the typography of the
 * legal documents. The Terms & Conditions and Privacy Policy are the lawyer-supplied HTML copied word for word from
 * the previous website, so they are styled by element here rather than with utility classes on every tag.
 * Sizes, colours and spacing follow the rest of the site (text-sm / leading-relaxed body copy, plum headings). */

/* ---- Document cards ------------------------------------------------------------------------- */
.btx-legal-card:focus-visible {
  outline: 2px solid var(--brand-plum);
  outline-offset: 3px;
}
.btx-legal-card__arrow {
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
.btx-legal-card:hover .btx-legal-card__arrow,
.btx-legal-card:focus-visible .btx-legal-card__arrow {
  transform: translateX(0.375rem);
}
/* Right-to-left languages: the arrow points (and moves) the other way. */
[dir="rtl"] .btx-legal-card__arrow {
  transform: scaleX(-1);
}
[dir="rtl"] .btx-legal-card:hover .btx-legal-card__arrow,
[dir="rtl"] .btx-legal-card:focus-visible .btx-legal-card__arrow {
  transform: translateX(-0.375rem) scaleX(-1);
}
@media (prefers-reduced-motion: reduce) {
  .btx-legal-card__arrow {
    transition: none;
  }
}

/* ---- Document typography -------------------------------------------------------------------- */
.btx-legal-doc {
  font-size: var(--text-sm);
  line-height: 1.625;
}
.btx-legal-doc > :first-child {
  margin-top: 0;
}
.btx-legal-doc h2 {
  margin-top: 0;
  color: var(--brand-plum);
  font-size: var(--text-3xl);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.btx-legal-doc h3 {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--brand-plum);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.015em;
}
.btx-legal-doc h4 {
  margin-top: 1.75rem;
  color: var(--brand-plum);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
}
.btx-legal-doc p,
.btx-legal-doc li {
  color: color-mix(in oklab, currentColor 80%, transparent);
}
.btx-legal-doc p {
  margin-top: 0.75rem;
}
.btx-legal-doc h3 + p,
.btx-legal-doc h4 + p {
  margin-top: 0.875rem;
}
.btx-legal-doc ul,
.btx-legal-doc ol {
  margin-top: 0.75rem;
  padding-inline-start: 1.25rem;
}
.btx-legal-doc ul {
  list-style: disc;
}
.btx-legal-doc ol {
  list-style: decimal;
}
.btx-legal-doc li {
  margin-top: 0.5rem;
  padding-inline-start: 0.25rem;
}
.btx-legal-doc li::marker {
  color: var(--brand-plum);
}
.btx-legal-doc strong {
  color: var(--brand-plum);
  font-weight: 600;
}
.btx-legal-doc em {
  font-style: normal;
  font-weight: 600;
}

/* "Effective from ..." notice at the top of the Terms and the Privacy Policy. */
.btx-legal-doc p.btx-legal-doc__effective {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--brand-yellow);
  border-radius: 0.5rem;
  background: var(--card);
  color: inherit;
}

/* Privacy Policy "Purposes" table: scrolls sideways on small screens instead of squashing. */
.btx-legal-doc__table {
  margin-top: 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card);
}
.btx-legal-doc table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
}
.btx-legal-doc th,
.btx-legal-doc td {
  padding: 0.875rem 1rem;
  text-align: start;
  vertical-align: top;
}
.btx-legal-doc th {
  color: var(--brand-plum);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface);
}
.btx-legal-doc td {
  border-top: 1px solid var(--border);
  color: color-mix(in oklab, currentColor 80%, transparent);
}
.btx-legal-doc td:first-child {
  color: inherit;
  font-weight: 500;
}
.btx-legal-doc td ul {
  margin-top: 0;
  padding-inline-start: 1rem;
}
.btx-legal-doc td li {
  margin-top: 0.125rem;
}
.btx-legal-doc td li:first-child {
  margin-top: 0;
}

/* Shown above the Terms and the Privacy Policy when the site language is not English. */
.btx-legal-notice {
  margin-bottom: 2rem;
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  background: color-mix(in oklab, var(--brand-plum) 6%, transparent);
  color: var(--brand-plum);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ---- Hub layout: Terms and Privacy on a wide first row, the other three documents below ------ */
/* Cards are the grid items (their <li> is display: contents). */
@media (width >= 40rem) and (width < 64rem) {
  .btx-legal-cards--hub > li:last-child > a {
    grid-column: span 2;
  }
}
@media (width >= 64rem) {
  .btx-legal-cards--hub {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .btx-legal-cards--hub > li > a {
    grid-column: span 2;
  }
  .btx-legal-cards--hub > li:nth-child(-n + 2) > a {
    grid-column: span 3;
  }
}

/* ---- Terms & Privacy: document beside a sticky contents list (desktop) ----------------------- */
.btx-legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lets the wide table scroll inside its box on phones */
  gap: 3rem;
}
.btx-legal-doc h3[id] {
  scroll-margin-top: 6.5rem; /* clear the sticky header */
}
.btx-legal-doc p.btx-legal-doc__effective {
  margin-bottom: 1.75rem;
}
.btx-legal-toc {
  display: none;
}
@media (width >= 64rem) {
  .btx-legal-layout {
    grid-template-columns: minmax(0, 48rem) minmax(0, 16rem);
    justify-content: space-between;
    gap: 4rem;
  }
  .btx-legal-toc {
    display: block;
    position: sticky;
    top: 7rem;
    align-self: start;
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
  }
}
.btx-legal-toc__title {
  color: color-mix(in oklab, var(--brand-plum) 90%, transparent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.btx-legal-toc ol {
  margin-top: 1.25rem;
  border-inline-start: 1px solid var(--border);
  list-style: none;
}
.btx-legal-toc a {
  display: block;
  margin-inline-start: -1px;
  padding: 0.4375rem 0 0.4375rem 1rem;
  padding-inline: 1rem 0;
  border-inline-start: 1px solid transparent;
  font-size: 0.8125rem;
  line-height: 1.45;
  opacity: 0.65;
  transition: opacity 200ms, color 200ms, border-color 200ms;
}
.btx-legal-toc a:hover,
.btx-legal-toc a:focus-visible {
  color: var(--brand-plum);
  opacity: 1;
}
/* Section currently in view (set by wwwroot/js/boditrax.js). */
.btx-legal-toc a[aria-current="true"] {
  border-inline-start-color: var(--brand-yellow);
  color: var(--brand-plum);
  font-weight: 500;
  opacity: 1;
}
.btx-legal-doc td li {
  color: inherit; /* the cell is already muted */
}
