/**
 * @file
 * Section component.
 */

.section {
  padding: var(--jh-section-padding);
}

/* Grey bands run to the edges of the window; the content keeps its width.
   The shadow paints the background sideways without adding to the page
   width, and the clip-path keeps it from spilling above or below. */
.section--grey {
  background: var(--jh-tint);
  box-shadow: 0 0 0 100vmax var(--jh-tint);
  clip-path: inset(0 -100vmax);
}

.section__heading {
  margin: 0 0 1rem;
  font-size: 2.125rem;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.section__text {
  max-width: 45rem;
}

.section__header {
  margin-bottom: 1.5rem;
}

.section__header .links-row {
  margin-top: 0.5rem;
}

.section__items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

.section__items:empty {
  display: none;
}

.section__items--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section__items--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section__items--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
.section__items--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; }

.section__footnote {
  margin-top: 1.25rem;
}

.section__footnote > :last-child,
.section__text > :last-child {
  margin-bottom: 0;
}

/* Centred: calls to action. */
.section--center {
  text-align: center;
}

.section--center .section__text {
  max-width: 38.75rem;
  margin: 0 auto;
}

.section--center .section__header {
  margin-bottom: 0;
}

.section--center .section__header .links-row {
  margin-top: 1.5rem;
}

.section--center .section__footnote {
  margin-top: 1rem;
}

/* Split: text beside the items. */
.section--split,
.section--split-reverse {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem;
  align-items: center;
}

.section--split .section__header,
.section--split-reverse .section__header {
  margin-bottom: 0;
}

.section--split-reverse .section__header {
  order: 2;
}

/* Menu: items beside the section menu. */
.section--menu .section__body {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

/* Strip: compact highlights in a row, divided by rules. */
.section--strip {
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
}

.section--strip .section__items {
  gap: 0;
}

.section--strip .section__items > * + * {
  border-left: 1px solid var(--jh-rule-light);
}

.section--strip .card {
  justify-content: center;
  align-items: center;
  min-height: 76px;
  padding: 0.5rem 1rem;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: center;
}

.section--strip .card__heading {
  margin: 0;
  font-size: 1.25rem;
}

.section--strip .card .text-formatted p {
  margin: 0;
  color: var(--jh-slate);
  font-size: 0.9375rem;
}

.section--strip .media-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
}

.section--strip .media-item img {
  width: auto;
  height: 72px;
}

@media (max-width: 820px) {
  .section__heading {
    font-size: 1.75rem;
  }

  .section__items--cols-2,
  .section__items--cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .section__items--cols-4,
  .section__items--cols-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section--split,
  .section--split-reverse,
  .section--menu .section__body {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }

  .section--split-reverse .section__header {
    order: 0;
  }

  .section--strip .section__items > * + * {
    border-left: 0;
  }
}

@media (max-width: 480px) {
  .section__items--cols-4,
  .section__items--cols-5 {
    grid-template-columns: minmax(0, 1fr);
  }
}
