/**
 * Footer social media links as a honeycomb of hexagons.
 *
 * The footer block's markup is a plain list of links:
 *   <ul class="social-grid">
 *     <li><a class="hexagon" href="…" aria-label="…"><span class="fab fa-…" aria-hidden="true"></span></a></li>
 *     …
 *   </ul>
 * Rows hold three hexagons. Every odd row (the 1st, 3rd, …) is shifted half a
 * hexagon right and pushed down one row, so the whole grid sits where the old
 * markup's three invisible spacer items used to put it. The grid is then
 * turned 30 degrees.
 *
 * This replaces the #social-media-grid rules in scss/components/regions/_footer.scss,
 * which needed those spacer items.
 */
footer .social-grid {
  width: 254px;
  max-width: 254px;
  margin: 0 0 1rem;
  /* The usual list margin and indent, which the layout was built with. */
  padding: 0 0 0 40px;
  list-style: none;
  display: flow-root;
  transform: rotate(30deg);
}

footer .social-grid > li {
  list-style-type: none;
  position: relative;
  float: left;
  width: 27.8571428571%;
  padding: 0 0 32.1676014517%;
  transform: rotate(-60deg) skewY(30deg);
  overflow: hidden;
  /* Each item is a skewed box larger than its hexagon. Only the hexagon takes
     clicks. (The old rules used visibility: hidden here, which also hid the
     list items from screen readers.) */
  pointer-events: none;
}

footer .social-grid .hexagon {
  pointer-events: auto;
}

/* The middle hexagon of each row. */
footer .social-grid > li:nth-child(3n+2) {
  margin: 0 1%;
}

/* The shifted rows overlap the rows above and below them. */
footer .social-grid > li:nth-child(6n+1),
footer .social-grid > li:nth-child(6n+2),
footer .social-grid > li:nth-child(6n+3) {
  margin-top: -6.9285714285%;
  margin-bottom: -6.9285714285%;
  transform: translateX(50%) rotate(-60deg) skewY(30deg);
}

footer .social-grid > li:nth-child(6n+1) {
  margin-left: .5%;
}

/* The first row starts one row down: a row's height (32.1676%) less the
   overlap (6.9286%). */
footer .social-grid > li:nth-child(-n+3) {
  margin-top: 25.2390300232%;
}

footer .social-grid .hexagon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: skewY(-30deg) rotate(60deg);
  overflow: hidden;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

footer .social-grid .hexagon:hover,
footer .social-grid .hexagon:focus {
  background-color: #b7d1b5;
  outline: 0;
}

footer .social-grid .hexagon > * {
  color: #2e637f;
  transform: rotate(-30deg);
  font-size: 27px;
}

footer .social-grid .hexagon:hover > *,
footer .social-grid .hexagon:focus > * {
  color: #fff;
}
