/* Home page. Designed at 1440x900; every left edge shares --edge (site.css).
   Header and footer are shared chrome in site.css.

   Type: the headline (--title) and the wordmark (--wordmark) scale together so
   the headline always reads larger (desktop ratio 62:28). Body copy, captions
   and links are fixed sizes and never change with the viewport. */

.home {
  --title: clamp(44px, 12vw, 62px);
  --wordmark: calc(var(--title) / 2.2143);
  --case-gap: 24px;

  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* Mast: lockup (left) and case link (right) */

.home-mast {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  padding: 0 var(--edge);
}

.home-wordmark {
  margin: 0;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: var(--wordmark);
  line-height: 1.43;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.home-title {
  margin: calc(var(--wordmark) * 0.571) 0 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--title);
  line-height: 1.258;
  letter-spacing: -0.003em;
  text-wrap: balance;
}

.home-sub,
.home-location {
  margin: 0;
  max-width: 560px;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.home-sub strong {
  font-weight: 500;
}

.home-nobreak {
  white-space: nowrap;
}

.home-avatar {
  width: 88px;
  height: 88px;
  margin-top: 25px;
  border-radius: 50%;
}

/* Case link: label, title and arrow are one link */

.home-case {
  display: block;
  margin-top: var(--case-gap);
  color: inherit;
  text-decoration: none;
}

.home-case-label {
  display: block;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.home-case-title {
  display: block;
  margin-top: 4px;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.5571px;
  text-decoration: underline transparent 2px;
  text-underline-offset: 5px;
  transition: color var(--motion-duration-hover), text-decoration-color var(--motion-duration-hover);
}

.home-case-end {
  white-space: nowrap;
}

.home-case-arrow {
  display: inline-block;
  vertical-align: -5px;
  width: 24px;
  height: 24px;
  transition: transform var(--motion-duration-hover);
}

.home-case:focus-visible .home-case-title {
  color: var(--red);
  text-decoration-color: currentColor;
}

@media (hover: hover) {
  .home-case:hover .home-case-title {
    color: var(--red);
    text-decoration-color: currentColor;
  }
}

.home-case:focus-visible .home-case-arrow {
  transform: translateX(6px);
}

@media (hover: hover) {
  .home-case:hover .home-case-arrow {
    transform: translateX(6px);
  }
}

.home-case:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 10px;
}

/* One column (tablet portrait and phones): case link right after the sub line.
   The avatar keeps its desktop size and place (after the location). */

@media (max-width: 799.98px) {
  .home-location {
    margin-top: 24px;
  }
}

/* Phones only: avatar variants. Switch the class on <body>:
   home--avatar-a (small, above the wordmark) or home--avatar-b (bottom, above Contact). */

@media (max-width: 599.98px) {
  .home {
    --case-gap: 36px;
  }

  .home-location {
    margin-top: 24px;
  }

  .home--avatar-a .home-avatar {
    order: -1;
    width: 56px;
    height: 56px;
    margin: 0 0 20px;
  }

  .home--avatar-b .home-mast {
    align-content: start;
    grid-template-rows: repeat(5, auto) 1fr;
  }

  .home--avatar-b .home-avatar {
    align-self: end;
    width: 72px;
    height: 72px;
    margin-top: 24px;
  }
}

/* Mobile (below iPad portrait, 768px): the avatar takes the signature's place top right,
   the signature moves to the end of the footer (bottom right), and "Based in Los Angeles."
   sits above the case link. Both are positioned against the page edge so they line up
   with the header and the footer links. */

@media (max-width: 767.98px) {
  .home {
    position: relative;
  }

  .home-avatar {
    position: absolute;
    top: var(--pad-top);
    right: var(--edge);
    order: 0;
    width: 56px;
    height: 56px;
    margin: 0;
  }

  .home--avatar-a .home-avatar {
    order: 0;
    margin: 0;
  }

  .site-signature {
    position: absolute;
    right: var(--edge);
    /* centre the mark on the Contact / LinkedIn text line */
    bottom: calc(var(--pad-bottom) - 10px);
  }

  /* A little air between the header and the wordmark now the avatar is out of the flow
     (32px at first, trimmed to 8px so the footer clears the browser's bottom bar) */
  .home-mast {
    padding-top: 8px;
  }

  .home-location {
    order: 1;
    margin-top: 24px;
  }

  .home-case {
    order: 2;
  }
}

/* Two columns, as in the mock */

@media (min-width: 800px) {
  .home {
    --title: clamp(40px, 4.3vw, 62px);
  }

  .home-mast {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: repeat(5, auto);
    /* On large monitors the lockup and case link stay together, flush left.
       Header and footer stay full width. */
    max-width: 1680px;
  }

  .home-wordmark,
  .home-title,
  .home-sub,
  .home-location,
  .home-avatar {
    grid-column: 1;
  }

  .home-wordmark { grid-row: 1; }
  .home-title    { grid-row: 2; white-space: nowrap; }
  .home-sub      { grid-row: 3; }
  .home-location { grid-row: 4; margin-top: 25px; }
  .home-avatar   { grid-row: 5; }

  .home-case {
    grid-column: 2;
    grid-row: 1 / 6;
    align-self: center;
    justify-self: center;
    width: 100%;
    max-width: 380px;
    margin-top: 0;
  }
}

/* Narrow two-column layouts (phone landscape, small tablet landscape): a bit more
   room between the lockup and the case link. Desktop spacing is untouched. */

@media (min-width: 800px) and (max-width: 1099.98px) {
  .home-mast {
    column-gap: 32px;
  }

  /* trim the text column a little so the case link isn't squeezed */
  .home-sub,
  .home-location {
    max-width: 520px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-case-title,
  .home-case-arrow {
    transition: none;
  }

  .home-case:hover .home-case-arrow,
  .home-case:focus-visible .home-case-arrow {
    transform: none;
  }
}
