/**
* Legal pages stylesheet (Terms and Conditions / Specific Terms)
* Scoped to .legal-page — does not affect any other page on the site.
*/

.legal-page {
  --legal-measure: 68ch;
  --legal-gutter: 4.25rem;
  --legal-rule: color-mix(in srgb, var(--default-color), transparent 88%);
  --legal-muted: color-mix(in srgb, var(--default-color), transparent 35%);
  /* Matches the scroll-margin-top that main.css sets on .section for the sticky header */
  --legal-header-offset: 90px;
}

/* main.css sets `overflow: clip` on .section. That clips the hover anchors and,
   depending on the browser, can also disable position:sticky on the contents
   sidebar. Neutralised here so it only affects the legal pages. */
.legal-page .section {
  overflow: visible;
}

/*--------------------------------------------------------------
# Reading progress
--------------------------------------------------------------*/
.legal-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 1030;
  background: transparent;
  pointer-events: none;
}

.legal-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent-color);
  transition: width .08s linear;
}

/*--------------------------------------------------------------
# Layout
--------------------------------------------------------------*/
.legal-layout {
  padding-block: 10px 40px;
}

.legal-body {
  max-width: var(--legal-measure);
}

/*--------------------------------------------------------------
# Table of contents
--------------------------------------------------------------*/
.legal-toc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface-color);
  color: var(--heading-color);
  border: 1px solid var(--legal-rule);
  border-radius: 6px;
  font-family: var(--nav-font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
}

.legal-toc-toggle:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.legal-toc-toggle .bi {
  font-size: 18px;
  transition: transform .2s ease;
}

.legal-toc-toggle[aria-expanded="true"] .bi {
  transform: rotate(180deg);
}

.legal-toc__title {
  display: none;
  font-family: var(--nav-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--legal-muted);
  margin-bottom: 14px;
}

.legal-toc nav {
  border-left: 1px solid var(--legal-rule);
}

.legal-toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--default-color);
  font-size: 14px;
  line-height: 1.45;
  text-decoration: none;
  transition: color .15s ease, border-color .15s ease;
}

.legal-toc a span {
  color: var(--legal-muted);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

.legal-toc a:hover {
  color: var(--accent-color);
}

.legal-toc a.active {
  color: var(--accent-color);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

.legal-toc a.active span {
  color: var(--accent-color);
}

/* Desktop: sticky sidebar, always open regardless of collapse state */
@media (min-width: 1200px) {
  .legal-toc {
    position: sticky;
    top: var(--legal-header-offset);
    max-height: calc(100vh - var(--legal-header-offset) - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .legal-toc__title {
    display: block;
  }

  .legal-toc-toggle {
    display: none;
  }

  .legal-toc .collapse:not(.show) {
    display: block;
  }

  .legal-toc .collapsing {
    height: auto !important;
    transition: none;
  }
}

/*--------------------------------------------------------------
# Document typography
--------------------------------------------------------------*/
.legal-body .legal-lede {
  font-size: 17px;
  line-height: 1.8;
  text-align: justify;
  color: var(--default-color);
  margin-bottom: 18px;
}

.legal-divider {
  font-family: var(--nav-font);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--legal-muted);
  padding-top: 34px;
  margin-bottom: -6px;
  border-top: 1px solid var(--legal-rule);
}

.legal-section {
  padding-top: 34px;
  scroll-margin-top: var(--legal-header-offset);
}

.legal-section > h2 {
  position: relative;
  font-family: var(--heading-font);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--heading-color);
  padding-left: var(--legal-gutter);
  margin-bottom: 18px;
}

.legal-section > h2 .legal-no {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--legal-gutter) - 1rem);
  color: var(--accent-color);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Clauses: number sits in its own gutter so the text block stays flush */
.legal-clause {
  position: relative;
  padding-left: var(--legal-gutter);
  margin-bottom: 16px;
  font-size: 16px;
  line-height: 1.78;
  text-align: justify;
  scroll-margin-top: var(--legal-header-offset);
}

/* The clause number is itself the deep link, so the handle never sits outside
   the clause box and stays reachable on touch devices that have no hover. */
a.legal-no {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--legal-gutter) - 1rem);
  color: var(--legal-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.95;
  text-decoration: none;
  transition: color .15s ease;
}

a.legal-no:hover,
a.legal-no:focus-visible {
  color: var(--accent-color);
  text-decoration: underline;
}

.legal-clause--sub {
  --legal-gutter: 5.75rem;
}

.legal-clause ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.legal-clause ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  text-align: left;
}

.legal-clause ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .82em;
  width: 6px;
  height: 1px;
  background: var(--legal-muted);
}

.legal-clause:target > .legal-no,
.legal-section:target > h2 .legal-no {
  color: var(--accent-color);
  font-weight: 700;
}

/*--------------------------------------------------------------
# Address block (Notices)
--------------------------------------------------------------*/
.legal-address {
  padding-left: var(--legal-gutter);
  margin-bottom: 16px;
}

.legal-address dl {
  margin: 0 0 18px;
  padding: 16px 20px;
  background: color-mix(in srgb, var(--accent-color), transparent 96%);
  border-left: 2px solid var(--accent-color);
  border-radius: 0 4px 4px 0;
  font-size: 15px;
  line-height: 1.7;
}

.legal-address dt {
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 4px;
}

.legal-address dd {
  margin: 0;
}

/*--------------------------------------------------------------
# Callout to the companion document
--------------------------------------------------------------*/
.legal-callout {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 28px 0 4px;
  padding: 22px 24px;
  background: var(--surface-color);
  border: 1px solid var(--legal-rule);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.legal-callout:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--default-color), transparent 92%);
}

.legal-callout__body {
  flex: 1;
}

.legal-callout__eyebrow {
  display: block;
  font-family: var(--nav-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--legal-muted);
  margin-bottom: 5px;
}

.legal-callout__title {
  display: block;
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 4px;
}

.legal-callout__desc {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: var(--default-color);
}

.legal-callout__go {
  flex-shrink: 0;
  font-size: 24px;
  color: var(--accent-color);
  transition: transform .2s ease;
}

.legal-callout:hover .legal-callout__go {
  transform: translateX(4px);
}

/*--------------------------------------------------------------
# Responsive
--------------------------------------------------------------*/
@media (max-width: 1199px) {
  .legal-body {
    max-width: none;
  }
}

@media (max-width: 767px) {
  .legal-page {
    --legal-gutter: 3.1rem;
  }

  .legal-clause--sub {
    --legal-gutter: 4.3rem;
  }

  .legal-section > h2 {
    font-size: 19px;
  }

  .legal-clause,
  .legal-body .legal-lede {
    font-size: 15px;
    text-align: left;
  }

  .legal-callout {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 575px) {
  .legal-page {
    --legal-gutter: 2.7rem;
  }

  .legal-clause--sub {
    --legal-gutter: 3.7rem;
  }

  .legal-address {
    padding-left: 0;
  }
}

/*--------------------------------------------------------------
# Print — clause 2.4 asks Users to keep a copy of these Terms
--------------------------------------------------------------*/
@media print {
  .header,
  .footer,
  .legal-toc,
  .legal-progress,
  .legal-callout__go,
  .scroll-top,
  #preloader {
    display: none !important;
  }

  .legal-page {
    --legal-gutter: 3.4rem;
  }

  body,
  .legal-clause,
  .legal-body .legal-lede {
    color: #000;
    font-size: 10.5pt;
    line-height: 1.55;
  }

  .page-title {
    padding: 0 0 12pt;
    background: none !important;
  }

  .legal-body {
    max-width: none;
  }

  .legal-section {
    padding-top: 16pt;
    break-inside: avoid;
  }

  .legal-section > h2 {
    font-size: 12.5pt;
    break-after: avoid;
  }

  .legal-clause {
    margin-bottom: 8pt;
    break-inside: avoid;
  }

  .legal-callout,
  .legal-address dl {
    break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  /* AOS leaves elements at opacity:0 when JS has not run before printing */
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
  }
}
