/* ==========================================================================
   Privacy Policy page
   A plain reading layout: title and introduction, then the sections in a
   comfortable measure. Desktop: an "On this page" list stays in view on the
   left and marks the section being read (privacy-policy.js). Phones and
   tablets: the list folds into a panel above the text.
   ========================================================================== */

/* ---- Title and introduction ---- */

.legal-intro {
  padding-top: calc(var(--header-height) + var(--space-8));
}

.legal-intro__inner {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  /* The rule spans the contents list and the text below it */
  max-width: calc(15rem + var(--space-9) + 46rem);
  padding-bottom: var(--space-7);
  border-bottom: 1px solid var(--line);
}

.legal-intro__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--brand-green);
}

.legal-intro__title {
  font-size: var(--fs-2xl);
}

.legal-intro__text {
  max-width: 42rem;
  color: var(--ink-700);
}

.legal-intro__updated {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--ink-500);
}

/* ---- Layout ---- */

.legal {
  padding-top: var(--space-7);
}

.legal__layout {
  display: grid;
  gap: var(--space-6);

  @media (width >= 64rem) {
    grid-template-columns: 15rem minmax(0, 46rem);
    align-items: start;
    gap: var(--space-9);
  }
}

/* ---- "On this page" ---- */

.legal__toc {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);

  /* Desktop: always open, without a box, and stays in view */
  @media (width >= 64rem) {
    position: sticky;
    top: calc(var(--header-height) + var(--space-6));
    padding: 0;
    border: 0;
  }

  ul {
    display: grid;
    margin-top: var(--space-4);
  }

  a {
    display: block;
    padding: 0.45rem 0 0.45rem var(--space-4);
    border-left: 2px solid var(--line);
    font-size: var(--fs-sm);
    line-height: 1.4;
    color: var(--ink-500);
    text-decoration: none;
    transition:
      color var(--duration-fast) ease,
      border-color var(--duration-fast) ease;

    &:hover {
      color: var(--ink-900);
    }

    /* The section being read */
    &[aria-current] {
      border-left-color: var(--brand-green);
      font-weight: 600;
      color: var(--ink-900);
    }
  }
}

.legal__toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-500);
  list-style: none;
  cursor: pointer;

  &::-webkit-details-marker {
    display: none;
  }

  /* A chevron that turns when the panel opens */
  &::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    rotate: 45deg;
    translate: 0 -0.15rem;
    transition: rotate var(--duration-fast) ease;

    [open] > & {
      rotate: -135deg;
      translate: 0 0.15rem;
    }
  }

  /* Desktop: a plain heading, not a toggle */
  @media (width >= 64rem) {
    pointer-events: none;

    &::after {
      display: none;
    }
  }
}

/* ---- Sections ---- */

.legal__section {
  padding-block: var(--space-7);
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-height) + var(--space-4));

  &:first-child {
    padding-top: 0;
    border-top: 0;
  }

  h2 {
    margin-bottom: var(--space-4);
    font-size: var(--fs-lg);
  }

  h3 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: var(--fs-md);

    &:first-of-type {
      margin-top: 0;
    }
  }

  p {
    color: var(--ink-700);
  }

  p + p,
  ul + p {
    margin-top: var(--space-3);
  }

  ul {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: 0;
    list-style: none;
  }

  li {
    position: relative;
    padding-left: var(--space-5);
    color: var(--ink-700);

    /* A short rule as the marker */
    &::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0.8em;
      width: 0.6rem;
      height: 2px;
      border-radius: 2px;
      background: var(--brand-green);
    }
  }

  strong {
    font-weight: 600;
    color: var(--ink-900);
  }

  p a {
    color: var(--brand-green);
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }
}

/* ---- Contact ---- */

.legal__contact {
  padding-bottom: 0;
}

.legal__contact-card {
  display: grid;
  justify-items: start;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--surface-alt);

  address {
    font-style: normal;
    color: var(--ink-900);
  }
}

.legal__email {
  font-weight: 600;
  color: var(--brand-green);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
