/*
 * Site header.
 *
 * Geometry follows the comp: an 80px bar, the nav pushed to the right, and a
 * 4px indicator that sits flush with the bottom edge. Items are stretched to
 * full header height so that indicator lands on the header rule rather than
 * floating above it.
 */

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgb(35 31 32 / 8%);
  background: var(--sk-white);

  /*
	 * The comp sets 16px labels in 20px of padding on a ~1600px canvas. Six
	 * items at that size overflow a 1440px viewport, so both scale with the
	 * viewport and land on the comp's values at the width it was designed for.
	 */

  --sk-nav-pad: clamp(0.5rem, 1.25vw, 1.25rem);

  /* Thickness of the hover/active indicator under each nav item. */
  --sk-nav-indicator: 4px;
}

.site-header__inner {
  display: flex;
  align-items: stretch;
  gap: clamp(1rem, 3.9vw, 3.5rem);
  width: 100%;
  max-width: var(--sk-container);
  min-height: 5rem;
  margin-inline: auto;
  padding-inline: var(--sk-gutter);

  /* The open drawer needs a row of its own; the logo and toggle keep theirs. */
  @media (max-width: 61.99rem) {
    flex-wrap: wrap;
    row-gap: 0;
  }
}

/*
	 * The green wedge that overlaps the hero in the comp. Decorative only, so it
	 * sits outside the flow and is hidden from assistive tech in the markup.
	 */

.site-header__chevron {
  position: absolute;
  top: calc(100% + 1px);
  right: 0;
  z-index: 5;
  width: clamp(4rem, 10vw, 8rem);
  aspect-ratio: 1;
  background: var(--sk-green);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  pointer-events: none;
}

.site-header__toggle {
  margin-left: auto;
  padding: 0.5rem;
  border: 0;
  background: none;

  @media (min-width: 62rem) {
    display: none;
  }
}

.site-header__toggle-bars {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--sk-black);
  box-shadow:
        0 -7px 0 var(--sk-black),
        0 7px 0 var(--sk-black);
}

.site-logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;

  img {
    width: auto;
    height: clamp(1.75rem, 2.9vw, 2.625rem);
  }
}

.primary-nav {
  @media (max-width: 61.99rem) {
    display: none;
    flex: 0 0 100%;
    padding-bottom: 1rem;

    &.is-open {
      display: block;
    }
  }

  @media (min-width: 62rem) {
    display: flex;
    align-items: stretch;
    margin-left: auto;
  }

}

.primary-nav__list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;

  @media (min-width: 62rem) {
    flex-direction: row;
    align-items: stretch;
    gap: 0.375rem;
  }
}

.primary-nav__item {
  display: flex;
  align-items: center;

  @media (min-width: 62rem) {
    align-items: stretch;
    border-bottom: var(--sk-nav-indicator) solid transparent;
    transition: border-color var(--sk-transition);

    /* A filled button is already its own affordance, so it sits out the
			   indicator bar and the accent text swap. */

    &:not(.primary-nav__item--button) {
      &:hover,
      &:focus-within,
      &.is-open,
      &.is-current {
        border-bottom-color: var(--sk-green);

        > .primary-nav__link,
        > .primary-nav__toggle {
          color: var(--sk-accent);
        }
      }
    }
  }
}
@media (min-width: 62rem) {

  /* The panel is positioned against the header, not the item, so a mega
			   item must stay static. Only the narrow dropdowns anchor to themselves. */

  .primary-nav__item--links {
    position: relative;
  }
}

/*
	 * The "View the Latest" item, promoted with the nav-button menu class. The
	 * indicator border is dropped rather than made transparent so the button
	 * centers on the full header height instead of 4px above it.
	 */

.primary-nav__item--button {
  margin-block: 0.5rem;

  @media (min-width: 62rem) {
    align-items: center;
    border-bottom: 0;
    margin-block: 0;
    margin-inline-start: var(--sk-nav-pad);
  }
}

.primary-nav__link {
  display: flex;
  align-items: center;
  padding-block: 0.75rem;
  color: var(--sk-black);
  font-family: var(--sk-font-display);
  font-size: clamp(0.8125rem, 1vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.125em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color var(--sk-transition);

  /* The indicator bar is the hover cue here, not the reset's underline. */
  &:hover,
  &:focus-visible {
    text-decoration: none;
  }

  @media (min-width: 62rem) {
    padding-block: 0;
    padding-inline: var(--sk-nav-pad);
  }
}

/* Declared after __link so its padding wins at every width without needing
	   to out-specify the base rule. */

.primary-nav__link--button {
  justify-content: center;
  padding: 1rem 1.75rem;
  background: var(--sk-accent);
  color: var(--sk-white);
  line-height: 1;
  transition:
      background var(--sk-transition),
      color var(--sk-transition);

  &:hover,
  &:focus-visible {
    background: var(--sk-accent-dark);
    color: var(--sk-white);
  }
}

/* The caret is its own control: the link keeps its destination while the
	   button owns aria-expanded for the panel. */

.primary-nav__toggle {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border: 0;
  background: none;
  color: var(--sk-black);
  cursor: pointer;

  @media (min-width: 62rem) {
    padding-block: 0;
    padding-inline: 0.4375rem var(--sk-nav-pad);
  }
}

.primary-nav__caret {
  display: block;
  width: 9px;
  height: 5px;
  background: currentcolor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  opacity: 0.5;
  transition:
      transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
      opacity var(--sk-transition);
}

.primary-nav__item.is-open .primary-nav__caret {
  transform: rotate(180deg);
  opacity: 1;
}
@media (min-width: 62rem) {
  .primary-nav__item--has-panel > .primary-nav__link {
    padding-inline-end: 0;
  }
}

.primary-nav__empty {
  margin: 0;
  color: var(--sk-gray);
  font-size: 0.8125rem;
}
