.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.site-header__inner > .brand {
  flex-shrink: 0;
}

.site-header .main-nav {
  order: 3;
  width: 100%;
  gap: 1.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-inline-start: auto;
}

.header-action {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  color: var(--color-text);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.header-action:hover,
.account-menu[open] > summary {
  color: var(--color-primary);
  background: rgb(87 113 95 / 9%);
}

.header-action--signin {
  color: #74796f;
}

.store-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.header-cart__count {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  display: grid;
  min-width: 1.125rem;
  height: 1.125rem;
  padding-inline: 0.2rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--color-primary);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}

.account-menu {
  position: relative;
}

.account-menu__toggle {
  gap: 0.125rem;
  width: 3.25rem;
  list-style: none;
}

.account-menu__toggle::-webkit-details-marker {
  display: none;
}

.account-menu__toggle .store-icon--chevron {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 180ms ease;
}

.account-menu[open] .store-icon--chevron {
  transform: rotate(180deg);
}

.account-menu__panel {
  position: absolute;
  z-index: 20;
  inset-block-start: calc(100% + 0.5rem);
  inset-inline-end: 0;
  width: min(17rem, calc(100vw - 2rem));
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: var(--color-background);
  box-shadow: 0 0.75rem 2rem rgb(45 52 48 / 10%);
}

.account-menu[open] .account-menu__panel {
  animation: account-menu-enter 160ms ease-out;
}

.account-menu__panel nav {
  display: grid;
}

.account-menu__panel a,
.account-menu__panel button {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 0;
  border-radius: 0.25rem;
  color: var(--color-text);
  background: transparent;
  text-align: start;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background-color 180ms ease;
}

.account-menu__panel a:hover,
.account-menu__panel button:hover {
  background: var(--color-chrome);
}

.header-action:focus-visible,
.account-menu__panel a:focus-visible,
.account-menu__panel button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.account-menu__logout {
  margin-block: 0.5rem 0;
  padding-block-start: 0.5rem;
  border-top: 1px solid var(--color-border);
}

@keyframes account-menu-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (width >= 576px) {
  .site-header__inner {
    flex-wrap: nowrap;
    gap: 1.5rem;
  }

  .site-header .main-nav {
    order: 0;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-action,
  .account-menu__panel a,
  .account-menu__panel button,
  .account-menu__toggle .store-icon--chevron {
    transition: none;
  }

  .account-menu[open] .account-menu__panel {
    animation: none;
  }
}
