/* ==========================================================================
   site.css — chrome shared by every page: nav, project nav, footer, lightbox
   ========================================================================== */

.page {
  background: var(--page-background, #fff);
}

/*
 * "Overlap": when a page opens on a cover block, the nav is lifted on top of
 * it instead of pushing it down. The original did this from JS; here it is a
 * class on .page.
 */
.page.overlap .navigation {
  position: relative;
  z-index: 10;
  height: var(--nav-height, 126px);
}

.page.overlap > .guts {
  margin-top: calc(var(--nav-height, 126px) * -1);
}

/* --- navigation -------------------------------------------------------- */

.navigation {
  display: block;
  background: var(--surface-color);
}

.navigation > header {
  display: flex;
  position: relative;
  z-index: 10;
  align-items: center;
  /* Mark on the left edge of the content column, nav on the right. */
  justify-content: space-between;
  max-width: var(--grid-width);
  margin: 0 auto;
  padding: 30px var(--site-margin);
}

/* --- brand mark --------------------------------------------------------- */
/*
 * Flat, black, and in the header's flow — aligned to the same content column
 * every other thing on the page is aligned to.
 *
 * It used to be pinned to the viewport's top-left corner and drawn as black
 * liquid glass: the reading bar's CTA treatment masked to the logo instead of
 * to a capsule. That read as an object floating above the page rather than as
 * part of it, and at a 48px viewport inset it landed well outside the grid. The
 * AV Restricted Content case had already overridden both back to the flat mark;
 * this is that treatment, promoted from one page to all of them.
 *
 * The h1 text is the accessible name and stays in the DOM, shifted off-screen.
 */

.navigation .logo-link {
  --logo-mark-size: 40px; /* the mark's visual height */
  /*
   * logo.svg's artwork sits inside a 64-unit viewBox but only fills 41.08 of it
   * vertically, so the file has to be drawn at 64/41.08 = 1.558x for the *mark*
   * to stand --logo-mark-size tall. The art is near-centred in its own viewBox
   * (11.38 above, 11.54 below), so scaling about the centre holds its position.
   */
  --logo-art-scale: 1.558;
  --logo-art-bleed: calc(var(--logo-mark-size) * (1 - var(--logo-art-scale)) / 2);

  display: block;
  /* Not `static`: `.logo` below is the inflated art box that lets the drawing
     overflow the hit target, and it resolves against this. */
  position: relative;
  width: var(--logo-mark-size);
  height: var(--logo-mark-size);
}

/*
 * The art box, inflated around the hit target so the drawing can overflow it.
 * `overflow: hidden` is what hides the indented text, and it is safe here
 * precisely because this box sits inside the anchor rather than around it.
 */
.navigation .logo {
  display: block;
  position: absolute;
  inset: var(--logo-art-bleed);
  background: center / contain no-repeat url("../assets/brand/logo.svg");
  /*
   * logo.svg paints itself #333. `brightness(0)` drives any input to pure
   * black, so the mark matches the header's ink and stays right if the file is
   * ever recoloured.
   */
  filter: brightness(0);
  text-indent: -500vw;
  white-space: nowrap;
  overflow: hidden;
}

.navigation nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-flow: row wrap;
  /*
   * Holds the header open to the height the original's larger mark gave it. The
   * mark is back in this row but only stands 40px, so this is still what sets
   * the row height; without it the header collapses to the link height and the
   * links jump 22px up the page.
   *
   * 66px, not 64: the original's 64px mark sat in an *inline* anchor, so its
   * line box also reserved the 2px of descender space under it. --nav-height's
   * 126px is 30 + 66 + 30, and on pages with no cover to overlap that 2px is
   * where every block below starts. Measured on the live page.
   */
  min-height: 66px;
  font-size: 1.5em;
  color: var(--nav-link-color, var(--link-color));
}

.navigation nav a {
  color: inherit;
}

.navigation nav a:not(:last-child)::after {
  content: "/";
  margin: 0 10px;
}

/*
 * A hairline that wipes in under the label on hover, and stays put on the
 * link for the page you are on. The original marked the current page by having
 * its router add an `.active` class at runtime; `aria-current="page"` is the
 * same information in the markup, so it needs no JS and screen readers get it
 * too. Gated on a real pointer — there is no hover state to reward on touch.
 */
.navigation nav a span {
  position: relative;
}

.navigation nav a span::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 500ms ease 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .navigation nav a:hover span::before {
    width: 100%;
  }
}

.navigation nav a[aria-current="page"] span::before {
  width: 100%;
  transition: none;
}

/* Hamburger, shown on small screens. */
.nav-toggle {
  display: none;
  position: absolute;
  top: 30px;
  right: var(--site-margin);
  z-index: 1001;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--nav-link-color, var(--link-color));
  cursor: pointer;
}

.nav-toggle svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
}

.navigation .overlay {
  display: none;
}

@media (max-width: 768px) {
  .navigation > header nav {
    display: none;
  }

  .navigation .logo-link {
    --logo-mark-size: 36px;
  }

  .nav-toggle {
    display: block;
  }

  .navigation .overlay {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-content: center;
    flex-flow: row wrap;
    padding: var(--site-margin);
    background: var(--overlay-background-color, #000);
    color: #fff;
    font-size: 5vw;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    overflow-y: auto;
    transition: opacity 250ms ease-out, visibility 500ms ease-out;
  }

  .navigation .overlay.open {
    opacity: 0.95;
    visibility: visible;
  }

  .navigation .overlay a {
    display: block;
    width: 100%;
    margin: 10px 0;
    color: inherit;
  }
}

/* --- project nav (prev / next) ----------------------------------------- */

.project-nav {
  box-sizing: content-box;
  max-width: var(--grid-width);
  margin: 0 auto;
  padding: 40px var(--site-margin) 20px;
  color: var(--color);
}

.project-nav::before {
  content: "";
  display: block;
  height: 1px;
  opacity: 0.3;
  background: var(--color);
}

.project-nav > .content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 35px;
}

.project-nav .action {
  position: relative;
  flex-grow: 1;
  overflow: hidden;
}

.project-nav .wrap {
  display: flex;
  align-items: flex-end;
  color: var(--color);
  cursor: pointer;
  transition: transform 0.35s ease;
}

.project-nav .action:hover .wrap {
  transform: translateY(-10px);
}

.project-nav .inner {
  overflow: hidden;
}

.project-nav label {
  display: block;
  width: 100%;
  opacity: 0.4;
  font-size: 12px;
  line-height: 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.35s ease;
}

.project-nav .action:hover label {
  opacity: 0;
  transform: translateY(10px);
}

.project-nav .title {
  font-size: 36px;
  line-height: 43px;
  font-weight: var(--title-weight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.25s ease;
}

.project-nav .action:hover .title {
  opacity: 0.5;
}

.project-nav .icon {
  flex-shrink: 0;
}

.project-nav .icon::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  background-color: var(--color);
  -webkit-mask: url("../assets/brand/arrow.svg") 0 0 / contain no-repeat;
  mask: url("../assets/brand/arrow.svg") 0 0 / contain no-repeat;
}

.project-nav .prev .wrap {
  justify-content: flex-start;
  padding-right: 20px;
  text-align: left;
}

.project-nav .prev .icon {
  margin-left: -10px;
}

.project-nav .prev .icon::before {
  transform: rotate(0.5turn);
}

.project-nav .next .wrap {
  justify-content: flex-end;
  padding-left: 20px;
  text-align: right;
}

.project-nav .next .icon {
  margin-right: -10px;
}

.project-nav .prev:hover .icon {
  animation: arrowMoveLeft 0.3s ease-out 0.1s forwards;
}

.project-nav .next:hover .icon {
  animation: arrowMoveRight 0.3s ease-out 0.1s forwards;
}

@keyframes arrowMoveLeft {
  50% {
    opacity: 0;
    transform: translateX(-20px);
  }
  51% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes arrowMoveRight {
  50% {
    opacity: 0;
    transform: translateX(20px);
  }
  51% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- footer ------------------------------------------------------------ */

footer {
  position: relative;
  width: 100%;
  padding: 20px var(--site-margin) 30px;
  color: var(--color);
}

footer > .content {
  display: grid;
  grid-template-columns: calc(50% - 25px) 50px calc(50% - 25px);
  align-items: center;
  max-width: var(--container-width);
  margin: 0 auto;
}

footer .copyright {
  grid-column: 1;
}

footer .links {
  display: flex;
  grid-column: 3;
  justify-content: flex-end;
}

footer .links > .icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 12px;
  background-color: var(--color);
  -webkit-mask: center center / contain no-repeat;
  mask: center center / contain no-repeat;
  transform: scale(1);
  transition: transform 50ms ease-out;
}

footer .links > .icon:last-child {
  margin-right: 0;
}

footer .links > .icon:hover {
  transform: scale(1.1);
}

footer .icon.instagram {
  -webkit-mask-image: url("../assets/icons/instagram.svg");
  mask-image: url("../assets/icons/instagram.svg");
}

footer .icon.twitter {
  -webkit-mask-image: url("../assets/icons/twitter.svg");
  mask-image: url("../assets/icons/twitter.svg");
}

footer .icon.linkedIn {
  -webkit-mask-image: url("../assets/icons/linkedIn.svg");
  mask-image: url("../assets/icons/linkedIn.svg");
}

@media (max-width: 768px) {
  .project-nav .title {
    font-size: 0;
    line-height: 0;
  }

  .project-nav label {
    display: none;
  }

  .project-nav .action .title::before {
    font-size: 36px;
    line-height: 43px;
  }

  .project-nav .action.prev .title::before {
    content: "Prev";
  }

  .project-nav .action.next .title::before {
    content: "Next";
  }

  .project-nav .action:hover .wrap {
    transform: none;
  }

  footer > .content {
    grid-template-columns: calc(50% - 15px) calc(50% - 15px) 30px;
  }

  footer .copyright {
    grid-row: 1;
    grid-column: 1 / 4;
    margin-bottom: 20px;
    text-align: left;
  }

  footer .links {
    grid-row: 2;
    grid-column: 1 / 3;
    flex-flow: row wrap;
    justify-content: flex-start;
  }
}

/* --- lightbox ---------------------------------------------------------- */

.lightbox {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.9);
  opacity: 0;
  visibility: hidden;
  cursor: zoom-out;
  overflow: auto;
  transition: opacity 250ms ease-out, visibility 250ms;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 100%;
  height: auto;
  margin: auto;
}
