/* Legal page-only styles. The hero itself is the shared .cph-hero* block in
   shared.css; only what that block can't do for this page lives here. */

/* "COMPLIANCE" at the hero's fixed 54px is wider than a phone screen, and a
   centred grid item is as wide as its longest word — so the whole hero block
   (subtext included) grew past the viewport and was clipped at both edges
   (the hero hides its own overflow, so it never showed up as a scrollbar).
   Scale the title down on narrow screens so the longest word fits. */
@media (max-width: 560px) {
  /* shared.css's `.cph-hero__inner { padding: 56px 0 }` at this width also
     zeroes .container's side gutter, so the text ran edge to edge. Put the
     gutter back for this page's hero. */
  .legal-hero .cph-hero__inner {
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }
  .legal-hero .cph-hero__title {
    font-size: clamp(28px, 9.4vw, 54px);
    line-height: 1.15;
  }
}

/* ===== Documents: left pane + selected document =====
   Layout: a bordered pane of links on the left
   (one third of the width), the document on the right (two thirds). Uses the
   FAQ's light-section type and colours so it reads as part of the same site. */
.legal { background: #fff; }
.legal__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 24px;
  align-items: start;
  padding-block: 56px 96px;
}

/* The pane stays in view while a long document scrolls past. `top` clears the
   sticky site nav (75px) with some air. */
.legal-nav {
  position: sticky;
  top: 99px;
  padding: 24px;
  border: 1px solid rgba(45, 42, 53, .15);
  border-radius: var(--radius);
  background: #fff;
}
.legal-nav__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Second and later groups in the pane, e.g. an "Agreements" heading. */
.legal-nav__heading {
  margin: 32px 0 12px;
  font-family: "Cairo", "Cairo Fallback", var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  line-height: 30px;
  color: rgb(45, 42, 53);
}
.legal-nav__link {
  display: block;
  padding: 7px 0;
  font-family: "Cairo", "Cairo Fallback", sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  color: rgb(27, 27, 31);
  transition: color .18s;
}
.legal-nav__link:hover { color: var(--brand-orange); }
.legal-nav__link.is-active {
  color: var(--brand-orange);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.legal-nav__link:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
  border-radius: 4px;
}

.legal-doc__title {
  margin: 0 0 8px;
  font-family: "Cairo", "Cairo Fallback", var(--font-heading);
  font-size: 34px;
  font-weight: 600;
  line-height: 42px;
  color: rgb(45, 42, 53);
}
.legal-doc__revised {
  margin: 0 0 32px;
  font-family: "Manrope", "Manrope Fallback", var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
  color: rgb(122, 122, 122);
}
.legal-doc__body { counter-reset: legal-section; }
/* "1. OVERVIEW"-style numbered headings; numbered by CSS so adding or
   reordering a section never needs renumbering by hand. */
.legal-doc__heading {
  margin: 36px 0 12px;
  font-family: "Cairo", "Cairo Fallback", var(--font-heading);
  font-size: 21px;
  font-weight: 600;
  line-height: 28px;
  text-transform: uppercase;
  color: rgb(27, 27, 31);
  counter-increment: legal-section;
  /* Section headings carry ids so they can be linked directly
     (/legal/terms-and-conditions/#section-7-acceptable-use); this keeps a
     heading clear of the sticky site nav (75px) when the browser scrolls to it. */
  scroll-margin-top: 99px;
}
.legal-doc__heading::before { content: counter(legal-section) ". "; }
.legal-doc__body > .legal-doc__heading:first-child { margin-top: 0; }
.legal-doc__body p,
.legal-doc__body li {
  font-family: "Manrope", "Manrope Fallback", var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 26px;
  color: rgb(66, 66, 73);
  /* Manrope draws the letters "(c)" as a copyright sign through a contextual
     ligature, which turned the list marker "(c)" into "©" in the Terms. Legal
     text has to show exactly what was written, so ligatures are off here. */
  font-variant-ligatures: none;
}
.legal-doc__body p { margin: 0 0 16px; }
.legal-doc__body ul,
.legal-doc__body ol { margin: 0 0 16px; padding-left: 24px; }
.legal-doc__body a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.legal-doc__body a:hover { color: var(--brand-orange); }
/* Keep a phone number on one line instead of splitting it across two. */
.legal-doc__body a[href^="tel:"] { white-space: nowrap; }

/* Tables (the Service Level Agreement's service credit levels): the pane's own
   hairline border and corner radius, same type as the clauses. The wrapper lets
   a table scroll sideways inside itself rather than push the page wider, though
   a two-column table like this one fits a 360px phone without needing to. */
.legal-doc__table-wrap { margin: 0 0 16px; overflow-x: auto; }
.legal-doc__body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(45, 42, 53, .15);
  border-radius: var(--radius);
  overflow: hidden;
}
.legal-doc__body th,
.legal-doc__body td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  font-family: "Manrope", "Manrope Fallback", var(--font-body);
  font-size: 16px;
  line-height: 24px;
  color: rgb(66, 66, 73);
  font-variant-ligatures: none;
  border-top: 1px solid rgba(45, 42, 53, .15);
}
.legal-doc__body thead th {
  border-top: 0;
  font-weight: 700;
  color: rgb(27, 27, 31);
  background: rgba(45, 42, 53, .05);
}
.legal-doc__body th + th,
.legal-doc__body td + td { border-left: 1px solid rgba(45, 42, 53, .15); }

@media (max-width: 900px) {
  /* Stacked: the pane sits above the document, full width, and stops sticking. */
  .legal__inner { grid-template-columns: minmax(0, 1fr); padding-block: 40px 72px; }
  .legal-nav { position: static; padding: 16px 20px; }
}
@media (max-width: 560px) {
  /* Phone: the nine-link column pushed the document a full screen down. It becomes
     a single swipeable row of pill "tabs" (current document highlighted, scrolled
     into view by js/main.js), bleeding to the screen edges so it's obviously
     scrollable, with a soft fade at the right edge. Links, order and markup are
     unchanged. */
  .legal__inner { padding-block: 24px 64px; gap: 20px; }
  .legal-nav {
    margin-inline: calc(var(--gutter) * -1);
    padding: 0;
    border: 0;
    border-radius: 0;
  }
  .legal-nav__list {
    flex-direction: row;
    gap: 8px;
    padding: 2px var(--gutter);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .legal-nav__list::-webkit-scrollbar { display: none; }
  .legal-nav__list { cursor: grab; }
  .legal-nav__list.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; } /* snapping fights a live drag */
  .legal-nav__list li { flex: 0 0 auto; scroll-snap-align: start; }
  .legal-nav__link {
    padding: 10px 16px; /* ~44px tall tap target */
    border: 1px solid rgba(45, 42, 53, .18);
    border-radius: 999px;
    font-size: 14px;
    line-height: 22px;
    font-weight: 600;
    white-space: nowrap;
    background: #fff;
  }
  .legal-nav__link.is-active {
    text-decoration: none;
    color: #a84f08; /* darker orange: passes 4.5:1 on the tint below */
    border-color: var(--brand-orange);
    background: rgba(245, 126, 32, .12);
  }
  .legal-doc__title { font-size: 28px; line-height: 36px; }
  .legal-doc__heading { font-size: 18px; line-height: 25px; }
  .legal-doc__body th,
  .legal-doc__body td { padding: 10px 12px; font-size: 15px; line-height: 22px; }
}
