/* The change record (site/snippets/blocks/changerecord.php, the Technical
   SEO and schema page's "What do you have when the project ends?"). The
   section's text beside a sample change record: a real table (Page, What
   changed, Before, After) in a white frame, its caption a "Sample" label and
   the record's name. Linked by the block itself (peanut_page_css), once per
   page. Every selector names a changerecord class. Tokens only. No script,
   no motion: nothing is hidden or moves.

   From 64rem: the text left, the record right (5 to 7). Below: the text,
   then the record. Phones (under 48rem): one card a change, each value
   under its column's name (a label span in each cell, aria-hidden; the
   header row is kept for screen readers). The After column is mint (the
   compare block's chosen column); on phones Before is a dashed paper box
   and After a mint one. */

@layer blocks {
  .changerecord__head {
    max-width: 44rem;
    margin-block-end: var(--space-4);
  }

  .changerecord__title {
    margin: 0;
  }

  .changerecord__intro {
    margin: var(--space-3) 0 0;
  }

  .changerecord__grid {
    display: grid;
    gap: var(--space-4);
    align-items: start;
  }

  @media (min-width: 64rem) {
    .changerecord__grid {
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: var(--space-5);
    }

    .changerecord--text .changerecord__grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  .changerecord__text {
    max-width: var(--measure);
  }

  .changerecord__text > :first-child {
    margin-block-start: 0;
  }

  .changerecord__text > :last-child {
    margin-block-end: 0;
  }

  /* ---------- the record ---------- */
  .changerecord__record {
    min-width: 0;
    padding: var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
  }

  .changerecord__table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
    line-height: 1.45;
  }

  /* the caption stays a table caption (a flex caption drops into the first column) */
  .changerecord__caption {
    padding-block-end: var(--space-2);
    caption-side: top;
    text-align: start;
  }

  .changerecord__sample {
    display: inline-block;
    margin-inline-end: 0.75rem;
    padding: 0.0625rem 0.5rem;
    vertical-align: 0.25rem;
    background: var(--color-butter);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-transform: uppercase;
  }

  .changerecord__name {
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-weight: var(--weight-heading);
    line-height: var(--leading-heading);
  }

  .changerecord__col {
    padding: 0.5rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: var(--tracking-caps);
    line-height: 1.6;
    text-align: start;
    text-transform: uppercase;
    vertical-align: bottom;
  }

  .changerecord__col--0 {
    padding-inline-start: 0;
  }

  .changerecord__page,
  .changerecord__cell {
    padding: 0.625rem;
    border-block-start: var(--border);
    font-weight: 400;
    text-align: start;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  /* an address breaks only when it cannot fit, so the column takes its width first */
  .changerecord__page {
    padding-inline-start: 0;
    font-weight: 600;
    overflow-wrap: break-word;
  }

  /* the After column in mint, as the compare block's chosen column */
  .changerecord__col--3 {
    background: var(--color-brand);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .changerecord__cell--after {
    background: var(--color-brand);
    font-weight: 500;
  }

  .changerecord__row:last-child .changerecord__cell--after {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  }

  .changerecord__label {
    display: none;
  }

  .changerecord__note {
    margin: var(--space-2) 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
  }

  /* ---------- phones: one card a change ---------- */
  @media (max-width: 47.99rem) {
    .changerecord__record {
      padding: var(--space-2);
    }

    .changerecord__thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }

    .changerecord__table,
    .changerecord__table tbody,
    .changerecord__row,
    .changerecord__page,
    .changerecord__cell {
      display: block;
    }

    .changerecord__caption {
      display: block;
    }

    .changerecord__row {
      padding-block: var(--space-2);
      border-block-start: var(--border);
    }

    .changerecord__page,
    .changerecord__cell {
      padding: 0 0 0.5rem;
      border: 0;
    }

    .changerecord__row > :last-child {
      padding-block-end: 0;
    }

    .changerecord__cell--before,
    .changerecord__cell--after {
      padding: 0.375rem 0.625rem;
      border-radius: 0.5rem;
    }

    .changerecord__cell--before {
      margin-block-end: 0.25rem;
      background: var(--color-paper);
      border: 1px dashed var(--color-line);
    }

    .changerecord__cell--after,
    .changerecord__row:last-child .changerecord__cell--after {
      border: var(--border);
      border-radius: 0.5rem;
    }

    .changerecord__label {
      display: block;
      font-size: 0.6875rem;
      font-weight: 600;
      letter-spacing: var(--tracking-caps);
      line-height: 1.6;
      text-transform: uppercase;
    }
  }

  @media print {
    .changerecord__row {
      break-inside: avoid;
    }
  }
}
