.legal-shell {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0;
}

.legal-header {
  position: relative;
  display: grid;
  /* The second track only reserves room for the full-height square on the right. */
  grid-template-columns: minmax(0, 1fr) 14rem;
  grid-template-rows: auto auto;
  column-gap: 2rem;
  align-items: start;
  padding: 2rem;
  /* Same vertical metrics as the sub-page headers (app.css .mark-header): identical top padding,
   * a first row the height of the study mark, then a two-line intro. */
  padding-top: clamp(0.75rem, 1.5vw, 1.5rem);
  background: #363636;
  color: #ffffff;
}

@media (min-width: 1101px) {
  .legal-header {
    padding-top: clamp(0.5rem, 1.1vw, 1.1rem);
  }
}

/* "Back to Study" as a square the full height of the header, flush with its top, right and
 * bottom edges, in the hero's area yellow with the same hover darkening (as on the sub-pages). */
.legal-header .back-button {
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  height: 100%;
  aspect-ratio: 1;
  margin: 0;
  padding: 1.25rem;
  border: 0;
  background: #f1ce71;
  color: #000000;
  font-size: clamp(1rem, 1.15vw, 1.2rem);
  font-weight: 700;
  line-height: 1.22;
  text-align: center;
  white-space: normal;
  transition: background 160ms ease;
}

.legal-header .back-button:hover,
.legal-header .back-button:focus-visible {
  background: #d7ad3f;
  color: #000000;
  transform: none;
}

.legal-header .back-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -6px;
}

.legal-header h1 {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: flex-end;
  min-height: clamp(3.1625rem, 5.75vw, 5.4625rem);
  margin: 0;
  /* Scaled with the hero (K, 2026-09-12): the vw coefficient and the cap are both 15% below the
   * `clamp(2.25rem, 4vw, 4rem)` they replace, so a subpage title keeps exactly the size relation
   * to the home page's that it had before. Without this the subpage headings would have ended up
   * LARGER than the hero they sit under - the hero's cap came down to 3.375rem and this one was
   * 4rem. The 2.25rem floor is untouched, so nothing below a 1059px viewport changes.
   *
   * `text-wrap: balance` matches the app header's, so a legal title that does wrap on a phone
   * breaks evenly rather than stranding a word. `min-height` above is deliberately NOT scaled:
   * the title is bottom-aligned inside it, so the bar keeps its height and the baseline does not
   * move - only the space above the smaller text grows. */
  font-size: clamp(2.25rem, 3.4vw, 3.4rem);
  line-height: 1;
  text-wrap: balance;
  letter-spacing: 0;
}

.legal-header p {
  grid-column: 1;
  grid-row: 2;
  max-width: 48rem;
  margin: 1.25rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
}

.legal-content {
  padding: 2rem;
  background: #ffffff;
}

.legal-update-date {
  margin: 2rem 0 0;
  border-left: 0;
  padding: 1rem 1.25rem;
  background: #fff8d9;
  color: #293e35;
}

.legal-section + .legal-section {
  margin-top: 2rem;
  border-top: 1px solid #d8ddd9;
  padding-top: 2rem;
}

.legal-section h2 {
  margin: 0 0 0.75rem;
  color: #000000;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.legal-section p,
.legal-section li {
  line-height: 1.65;
}

.legal-section ul {
  padding-left: 1.4rem;
}

.legal-section a {
  color: #006c3a;
  text-underline-offset: 0.18em;
}

.legal-contact {
  font-style: normal;
  line-height: 1.65;
}



/* Narrow screens: a full-width yellow bar below the text instead of the flush square. */
@media (max-width: 720px) {
  .legal-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .legal-header .back-button {
    position: static;
    grid-column: 1;
    grid-row: 3;
    height: auto;
    aspect-ratio: auto;
    margin-top: 1.5rem;
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 640px) {
  .legal-header,
  .legal-content,
  .legal-footer {
    padding: 1.5rem;
  }
}

/* Footer meets the content directly, as on every other page. */
.legal-shell .site-footer {
  margin-top: 0;
}
