/* The terms and conditions and the privacy policy. They share the landing page's nav, footer and
   palette (landing.css); this file only sets the long text: the page head, the contents beside
   the text on a wide screen, and the numbered sections. */

/* The text is as long as it is: the section grows past a screen instead of keeping to one */
main > .legal {
  height: auto;
  min-height: 0;
}

.legal__head {
  display: grid;
  gap: var(--s-4);
  max-width: 760px;
  padding-bottom: var(--s-7);
  border-bottom: 1px solid var(--line);
}

.legal__head .t-lead {
  max-width: 60ch;
}

.legal__updated {
  color: var(--muted);
}

.legal__body {
  margin-top: var(--s-7);
  align-items: start;
}

/* The contents: a list of the sections, held in view beside the text on a wide screen */
.legal__toc {
  display: grid;
  gap: var(--s-3);
}

.legal__toc > .t-label {
  color: var(--muted);
}

.legal__toc ol {
  display: grid;
  gap: var(--s-2);
  counter-reset: toc;
}

.legal__toc li {
  counter-increment: toc;
}

.legal__toc a {
  display: flex;
  gap: var(--s-2);
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}

.legal__toc a::before {
  content: counter(toc) ".";
  min-width: 3ch;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.legal__toc a:hover {
  color: var(--ink);
}

@media (min-width: 1024px) {
  .legal__toc {
    position: sticky;
    top: calc(var(--nav) + var(--s-6));
  }
}

/* On a phone and a tablet the contents sit above the text as a closed list */
@media (max-width: 1023px) {
  .legal__toc {
    padding-bottom: var(--s-6);
    border-bottom: 1px solid var(--line);
  }
}

/* The text: numbered sections, each opening on a rule */
.legal__text {
  max-width: 68ch;
  counter-reset: clause;
}

.legal__text > section {
  display: grid;
  gap: var(--s-4);
  padding-block: var(--s-6);
  border-bottom: 1px solid var(--line);
  counter-increment: clause;
  /* an anchor from the contents lands under the fixed nav */
  scroll-margin-top: calc(var(--nav) + var(--s-4));
}

.legal__text > section:first-child {
  padding-top: 0;
}

.legal__text h2 {
  display: flex;
  gap: var(--s-3);
  font-size: var(--t-h3);
  line-height: 1.2;
}

.legal__text h2::before {
  content: counter(clause);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7em;
  font-weight: 400;
  line-height: 1.75;
}

.legal__text h3 {
  margin-top: var(--s-2);
  font: 500 var(--t-body)/1.4 var(--font-text);
  letter-spacing: 0;
}

.legal__text ul {
  display: grid;
  gap: var(--s-2);
  padding-left: var(--s-5);
  list-style: disc;
}

.legal__text li::marker {
  color: var(--accent);
}

.legal__text a:not(.btn) {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.legal__text strong {
  font-weight: 600;
}

/* Who processes what, a row per service */
.legal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-small);
}

.legal__table th,
.legal__table td {
  padding: var(--s-3) var(--s-3) var(--s-3) 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.legal__table thead th {
  color: var(--muted);
  font-weight: 500;
}

.legal__table tbody th {
  font-weight: 500;
  white-space: nowrap;
}

.legal__table code {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

@media (max-width: 639px) {
  .legal__scroll {
    overflow-x: auto;
  }

  .legal__table {
    min-width: 520px;
  }
}

/* The other policy, after the last section */
.legal__next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-7);
  padding: var(--s-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

/* On a phone the button takes the box's width, and its label wraps on the narrowest screens */
@media (max-width: 639px) {
  .legal__next {
    padding: var(--s-5);
  }

  .legal__next .btn {
    width: 100%;
    height: auto;
    min-height: var(--btn-h);
    white-space: normal;
    text-align: center;
  }
}
