/* ==========================================================================
   SITE HEADER
   An app's navigation bar: edge to edge, no container. Clear at the top of a
   screen, white over the home screen's photographs, and frosted paper with a
   hairline once the screen has scrolled (.is-scrolled on <html>, from
   SiteHeader.js). Without scripts it is always frosted.

   Phone: menu, the logo in the middle like an app's title, Join. From 900px:
   the logo on the left, the tabs in the middle with a short line under the
   current one, then Join and the menu.
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
}

/* BAR */

.site-header__bar {
  padding-top: env(safe-area-inset-top);
  background-color: color-mix(in srgb, var(--paper) 86%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 9%, transparent);
  color: var(--ink);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  transition: background-color 350ms ease, box-shadow 350ms ease, color 350ms ease;
  view-transition-name: app-header;
}

/* At the top of a screen the bar is clear and the screen shows through. */
.is-scripted:not(.is-scrolled) .site-header__bar {
  background-color: transparent;
  box-shadow: 0 1px 0 transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.is-scripted:not(.is-scrolled) .site-header.is-over-photo .site-header__bar {
  color: var(--white);
}

.site-header__wrapper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1280px;
  height: 60px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.625rem;
  padding-right: 0.75rem;
  container-type: inline-size;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__wrapper {
    grid-template-columns: auto 1fr auto auto;
    column-gap: 1.25rem;
    height: 72px;
    padding-left: 3rem;
    padding-right: 2.5rem;
  }
}

/* MENU */

.site-header__menu {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  padding-left: 0.625rem;
  padding-right: 0.625rem;
  border-radius: 999px;
  color: inherit;
  font-size: 15px;
  font-weight: 620;
  text-decoration: none;
  transition: background-color var(--duration-sm) ease;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__menu {
    order: 4;
  }
}

.site-header__menu:hover {
  background-color: color-mix(in srgb, currentColor 8%, transparent);
}

.site-header__menu span {
  display: none;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__menu span {
    display: inline;
  }
}

/* BRAND */

.site-header__brand {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 0.5rem;
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__brand {
    justify-self: start;
    gap: 0.875rem;
  }
}

.site-header__brand svg {
  width: auto;
  height: 16px;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__brand svg {
    height: 22px;
  }
}

.site-header__brand span {
  padding-left: 0.5rem;
  border-left: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  opacity: 0.82;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__brand span {
    padding-left: 0.875rem;
    font-size: 14px;
  }
}

/* On the narrowest phones (under 320px of bar) the logo stands alone, so it
   stays clear of Join. */
@container (max-width: 320px) {
  .site-header__brand span {
    display: none;
  }
}

/* TABS */

.site-header__tabs {
  display: none;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__tabs {
    position: relative;
    display: block;
    justify-self: center;
  }
}

.site-header__tabs ul {
  display: grid;
  grid-template-columns: repeat(4, 7.5rem);
}

.site-header__tabs a {
  display: grid;
  place-items: center;
  height: 48px;
  color: inherit;
  font-size: 15px;
  font-weight: 620;
  text-decoration: none;
  opacity: 0.62;
  transition: opacity var(--duration-sm) ease;
}

.site-header__tabs a:hover {
  opacity: 1;
}

.site-header__tabs a[aria-current="page"] {
  opacity: 1;
}

/* The short line under the current tab; the browser slides it between
   screens (header-marker). */
.site-header__marker {
  position: absolute;
  bottom: 2px;
  left: calc(12.5% - 10px);
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background-color: currentColor;
  view-transition-name: header-marker;
}

.site-header__tabs:has(li:nth-child(2) [aria-current]) .site-header__marker {
  left: calc(37.5% - 10px);
}

.site-header__tabs:has(li:nth-child(3) [aria-current]) .site-header__marker {
  left: calc(62.5% - 10px);
}

.site-header__tabs:has(li:nth-child(4) [aria-current]) .site-header__marker {
  left: calc(87.5% - 10px);
}

.site-header__tabs:not(:has([aria-current])) .site-header__marker {
  display: none;
}

/* JOIN */

.site-header__join {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-height: 34px;
  padding-left: 0.875rem;
  padding-right: 0.875rem;
  border-radius: 999px;
  background-color: var(--secondary-color);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color var(--duration-sm) ease, transform var(--duration-sm) var(--ease-out);
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__join {
    min-height: 40px;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    font-size: 15px;
  }
}

.site-header__join:hover {
  background-color: var(--secondary-color-darkened);
}

.site-header__join:active {
  transform: scale(0.95);
}

/* MENU PANEL */

/* On a phone the top of the panel repeats the bar: the close button where the
   menu button was, the logo in the middle. On a computer only the close
   button, at the right. */
.site-header__panel-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 60px;
  margin-left: -0.625rem; /* the same edges as the bar, so the logo lands in the same place */
  margin-right: -0.5rem;
  margin-bottom: 1.5rem;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__panel-top {
    display: flex;
    justify-content: flex-end;
    height: 72px;
    margin-left: 0;
    margin-right: -1rem;
    margin-bottom: 1rem;
  }
}

.site-header__panel-top .sheet__close {
  background-color: transparent;
}

.site-header__panel-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .site-header__panel-brand {
    display: none;
  }
}

.site-header__panel-brand svg {
  width: auto;
  height: 16px;
}

.site-header__panel-brand span {
  padding-left: 0.5rem;
  border-left: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  opacity: 0.82;
}

/* The tabs arrive one after another as the panel opens (an animation starts
   each time the dialog is shown). */
@media (prefers-reduced-motion: no-preference) {
  .site-header__panel-nav li {
    animation: site-header-arrive 560ms var(--ease-out) 80ms backwards;
  }
}

.site-header__panel-nav li:nth-child(2) {
  animation-delay: 120ms;
}

.site-header__panel-nav li:nth-child(3) {
  animation-delay: 160ms;
}

.site-header__panel-nav li:nth-child(4) {
  animation-delay: 200ms;
}

.site-header__panel-nav ul {
  margin-bottom: 1.5rem;
}

.site-header__panel-nav a:not(.button) {
  display: flex;
  align-items: center;
  min-height: 60px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  font-size: 30px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: none;
  color: var(--ink);
}

.site-header__panel-nav a[aria-current="page"] {
  color: var(--primary-color);
}

.site-header__panel-esquire {
  margin-top: 2.5rem;
}

.site-header__panel-esquire h2 {
  margin-bottom: 0.5rem;
  font-family: var(--body-font-family);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--slate);
}

.site-header__panel-esquire ul a {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 17px;
  font-weight: 560;
  text-decoration: none;
}

.site-header__panel-esquire ul a:hover {
  color: var(--primary-color);
}

.site-header__panel-esquire .text-link {
  margin-top: 0.75rem;
  color: var(--primary-color);
}

/* KEYFRAMES */

@keyframes site-header-arrive {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}
