/* Footer legal / status-badge alignment
 *
 * Reusable pattern for KitPak-Building (and the kit-builder, which should
 * copy this file rather than invent a second layout).
 *
 * Markup: each list item that has a page link and a status badge
 * (.draft-flag or .planned-flag) gets class="legal-row". The badge is a
 * sibling of the link, not inside it:
 *
 *   <li class="legal-row">
 *     <a href="privacy.html">Privacy</a>
 *     <span class="draft-flag">Draft pending</span>
 *   </li>
 *
 * Wide view: two-column grid. The link is on the left; every badge sits in
 * a shared right-hand column, so they all start at the same x and line up
 * with the first line of the link. The link (and any cookie-settings
 * button in the same list) has a 44px-high target.
 *
 * At 390px and below: the badge moves under the link and stays left-aligned.
 */

.footer-nav:has(> .legal-row) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  column-gap: 0.75rem;
  row-gap: 0.2rem;
  align-items: start;
}

.footer-nav > li.legal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10.5rem;
  grid-column: 1 / -1;
  column-gap: 0.75rem;
  align-items: start;
  margin: 0;
  min-height: 44px;
}

/* Shared badge column so every badge starts at the same x, even when
   the badge labels have different widths (e.g. "Draft pending" vs
   "Approved draft"). */
@supports (grid-template-columns: subgrid) {
  .footer-nav > li.legal-row {
    grid-template-columns: subgrid;
  }
}

.footer-nav > li:not(.legal-row) {
  grid-column: 1 / -1;
  margin: 0;
}

.legal-row > a,
.footer-nav > li:not(.legal-row) > a,
.footer-nav > li:not(.legal-row) > button {
  display: flex;
  align-items: flex-start;
  min-height: 44px;
  width: 100%;
  margin: 0;
}

.legal-row > a {
  grid-column: 1;
  justify-self: stretch;
}

.legal-row > .draft-flag,
.legal-row > .planned-flag {
  grid-column: 2;
  justify-self: start;
  align-self: start;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 390px) {
  .footer-nav:has(> .legal-row) {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-nav > li.legal-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.15rem;
  }

  .legal-row > .draft-flag,
  .legal-row > .planned-flag {
    grid-column: 1;
    justify-self: start;
    align-self: start;
    margin: 0;
  }
}
