/* The legal pages (public/legal/page.html, ADR 0100): a document to read.
   One column below 992px: the title, any notice, "On this page" as a
   bordered box, the text, Earlier versions. From 992px the contents list
   moves into a 15rem column beside the text and stays in view while the
   text scrolls (sticky, below the navbar's clearance from
   scroll_clearance.js), scrolling on its own when it's taller than the
   window; it holds only links, so the keyboard reaches all of it. The text
   column is capped near 75 characters a line. Greys meet 4.5:1 on white
   (#5c6672 is 5.8:1, #424245 10:1). */

.legal-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 2.5rem;
  max-width: 44rem;
}

.legal-page__title {
  margin-bottom: 0.5rem;
}

.legal-page__meta {
  margin-bottom: 2rem;
  color: #5c6672;
}

/* A notice above the text: an earlier, scheduled or draft version, or an
   update on its way. The words say which; the icon and the edge are
   decoration. */
.legal-notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  border: 1px solid #adb5bd;
  border-left: 0.375rem solid #0067b8;
  border-radius: 0.5rem;
  background: #f5f7fa;
}

.legal-notice--draft {
  border-left-color: #8a5a00;
  background: #fff8e6;
}

.legal-notice__icon {
  flex: none;
  font-size: 1.25rem;
  line-height: 1.5;
}

.legal-notice__text {
  margin-bottom: 0;
}

.legal-contents {
  margin-bottom: 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
}

.legal-contents__title {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

.legal-contents__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each link a comfortable target (WCAG 2.5.8): a 1.35 line plus 0.3rem
   above and below. Grey until hovered, then the site's link colour and an
   underline; the list's heading says what they are. */
.legal-contents__list a {
  display: block;
  padding: 0.3rem 0;
  color: #424245;
  line-height: 1.35;
  text-decoration: none;
}

.legal-contents__list a:hover,
.legal-contents__list a:focus-visible {
  color: var(--site-link-hover-color, #005a9e);
  text-decoration: underline;
}

.legal-text {
  font-size: 1.0625rem;
  line-height: 1.7;
}

.legal-text h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid #dee2e6;
  font-size: 1.5rem;
}

.legal-text h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: 1.1875rem;
}

.legal-text :is(ul, ol) {
  padding-left: 1.5rem;
}

.legal-text li + li {
  margin-top: 0.4rem;
}

.legal-text a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* An address or a long link wraps rather than pushing the page sideways
   at 320px (WCAG 1.4.10). */
.legal-text,
.legal-history {
  overflow-wrap: anywhere;
}

.legal-history {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid #dee2e6;
}

.legal-history__title {
  font-size: 1.25rem;
}

.legal-history__list {
  padding-left: 1.5rem;
}

.legal-history__list li + li {
  margin-top: 0.5rem;
}

.legal-history__list [aria-current="page"] {
  font-weight: 600;
}

.legal-history__summary {
  display: block;
  color: #5c6672;
}

@media (min-width: 992px) {
  .legal-page {
    grid-template-columns: 15rem minmax(0, 44rem);
    column-gap: 3.5rem;
    max-width: none;
  }

  .legal-page > * {
    grid-column: 2;
  }

  .legal-contents {
    position: sticky;
    top: calc(var(--scroll-clear-top, 5.25rem) + 0.5rem);
    grid-column: 1;
    grid-row: 1 / span 4;
    align-self: start;
    max-height: calc(100vh - var(--scroll-clear-top, 5.25rem) - 1.5rem);
    margin-bottom: 0;
    padding: 0 0.5rem 0 0;
    overflow-y: auto;
    border: 0;
    border-radius: 0;
  }
}

@media print {
  .legal-page {
    display: block;
  }

  .legal-contents {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* The Legal page (public/legal/index.html): the legal pages as a list of
   bordered rows, each a heading link, what it covers and its effective day.
   The whole title is the link, a comfortable target (WCAG 2.5.8). Greys
   meet 4.5:1 on white (#5c6672 is 5.8:1). */
.legal-index {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}

.legal-index__item {
  margin-bottom: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
}

.legal-index__title {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.legal-index__title a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.legal-index__text {
  margin-bottom: 0.5rem;
}

.legal-index__meta {
  margin-bottom: 0;
  color: #5c6672;
}

.legal-index__update {
  display: block;
  margin-top: 0.25rem;
}

.legal-index__help {
  overflow-wrap: anywhere;
}
