/* The notices (privacy, terms, bot), set as editions: the label in the margin (and on privacy
   the contents, which legal.js marks), numbered hairline headings, and lists of named
   things as ruled rows. Layout only: no legal sentence depends on it. Loaded by privacy.html,
   terms.html and bot.html, after editorial.css. */

.page--ed {
  min-block-size: 0;
  box-sizing: border-box;
}

.page--ed .legal-main {
  max-inline-size: 38rem;
}

.page--ed h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.page--ed .lede {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-style: italic;
  font-weight: 500;
  /* Moss, not the headline turn's leaf-ink: at phone size the lede isn't large text. */
  color: var(--moss);
}

.legal-date {
  font-size: 0.875rem;
  color: var(--fn-muted);
}

.legal-jump {
  margin-block-start: 1.25rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.legal-jump a,
.legal-close a {
  color: var(--moss);
  font-weight: 400;
  text-underline-offset: 0.2em;
}

/* Sections part on a numbered hairline; paragraphs inside one keep together. */
.page--ed .body {
  gap: 0.9rem;
  margin-block-start: 2rem;
}

.page--ed .body h2 {
  margin-block-start: 2.25rem;
  padding-block-start: 1.6rem;
  border-block-start: 1px solid var(--fn-line);
  font-size: 1.625rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-inline-size: none;
  scroll-margin-block-start: 6.5rem;
}

/* A heading and its way back to the contents; the link sits outside the heading so it isn't part
   of the heading's name. */
.legal-head {
  position: relative;
  margin-block-start: 2.25rem;
}

.page--ed .body .legal-head h2 {
  margin-block-start: 0;
}

/* A notice with sections inside a section, such as the two bots on /bot. */
.page--ed .body h3 {
  margin-block-start: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.3;
}

.page--ed .body h2 + h3 {
  margin-block-start: 1rem;
}

.page--ed .body h2[data-num]::before {
  content: attr(data-num);
  display: block;
  margin-block-end: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fn-clay);
}

.page--ed .body p,
.page--ed .body li {
  line-height: 1.65;
  color: var(--ink-2);
}

.page--ed .body p + p {
  margin-block-start: 0;
}

.page--ed .body ul {
  margin: 0;
  padding-inline-start: 1.1rem;
}

/* A list of named things: the name, then what it does, on hairlines. */
.page--ed .body ul.legal-rows {
  padding: 0;
  list-style: none;
  border-block-end: 1px solid var(--fn-line);
}

/* biome-ignore lint/style/noDescendingSpecificity: lays out the row; .page--ed .body li sets only its type, so the two never set the same property */
.legal-rows li {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  column-gap: 1.25rem;
  padding-block: 0.7rem;
  border-block-start: 1px solid var(--fn-line);
}

.legal-rows li strong {
  font-weight: 500;
  color: var(--moss);
}

@media (max-width: 600px) {
  .legal-rows li {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The contents: a numbered list in the margin on a wide page, a folded disclosure under the title
   on a phone. The page carries both and shows one, so nothing moves once it has painted. */
.legal-contents {
  margin-block-start: 1.5rem;
}

.legal-contents-title {
  margin: 0;
}

.legal-contents-title,
.legal-contents summary {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--moss);
}

.legal-contents summary {
  cursor: pointer;
}

.legal-contents ol {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.legal-contents a {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  padding-block: 0.3rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
}

.legal-contents a:hover {
  color: var(--moss);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* The exact complement of the phone width (max-width: 960px), fractional widths included, in a
   form Safari before 16.4 reads; range syntax would leave both copies showing there. */
@media not all and (max-width: 960px) {
  .legal-contents--phone {
    display: none;
  }
}

/* The way back from a section lands the folded contents below the floating header. */
#on-this-page {
  scroll-margin-block-start: 6.5rem;
}

@media (max-width: 960px) {
  .page--ed .legal-margin {
    margin-block-end: 1.5rem;
  }

  .page--ed .legal-margin .tiny-rule {
    display: none;
  }

  .legal-contents--margin {
    display: none;
  }

  .legal-contents {
    margin-block-start: 0.9rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--fn-line);
    border-radius: 0.5rem;
  }

  .legal-contents summary {
    display: flex;
    align-items: center;
    min-block-size: 2.75rem;
  }

  .legal-contents a {
    min-block-size: 2.75rem;
    align-items: center;
  }
}

/* The bot page's three facts for an operator. */
.legal-facts {
  margin: 0;
  display: grid;
  gap: 0.9rem;
}

.legal-facts dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fn-muted);
}

.legal-facts dd {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--moss);
  overflow-wrap: anywhere;
}

.bot-page.page--ed code {
  line-height: 1;
}

.legal-back {
  display: none;
}

@media (max-width: 960px) {
  .legal-rows li {
    grid-template-columns: minmax(0, 1fr);
  }

  .legal-rows li strong {
    font-weight: 600;
  }

  /* The date is the notice's first words; the margin's copy is for wide pages. */
  .page--ed .legal-margin .legal-date {
    display: none;
  }

  .legal-back {
    display: block;
    margin-block-start: 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--fn-muted);
    text-underline-offset: 0.2em;
    position: absolute;
    inset-block-start: 0.7rem;
    inset-inline-end: 0;
    margin: 0;
    padding-block: 0.8rem;
    padding-inline-start: 0.75rem;
  }
}

/* The bot page: its three facts as a ruled table under the deck, in the face they are typed in. */
.page--ed .legal-facts {
  margin-block-start: 1.75rem;
  gap: 0;
  border-block-end: 1px solid var(--fn-line);
}

.legal-facts div {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: baseline;
  padding-block: 0.6rem;
  border-block-start: 1px solid var(--fn-line);
}

.bot-page.page--ed code,
.legal-facts dd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  line-height: inherit;
}

@media (min-width: 961px) {
  .page--ed {
    min-block-size: calc(100svh - 9rem);
  }
}

.legal-contents a[aria-current] {
  color: var(--moss);
  font-weight: 500;
}

@media (max-width: 960px) {
  .legal-main > .legal-contents--phone {
    margin-block-start: 1.5rem;
  }
}
