:root {
  --header-height: 69px;
  --nav-hover: #f1f1f1;
  --nav-pressed: #dedede;
}

.site-header {
  position: sticky;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  z-index: 40;
}
.site-header nav {
  position: relative;
  flex: none;
  flex-wrap: nowrap;
  gap: 8px;
}
.site-header .nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.site-header .brand { display: block; flex: none; border-radius: 6px; }
.brand picture, .brand img { display: block; }
.brand img { width: 242px; height: 44px; object-fit: contain; }
.nav-icon { width: 22px; height: 22px; flex: none; }
.cart-link { position: relative; }
.site-header .nav-action:hover { background: var(--nav-hover); }
.site-header .nav-action:active { background: var(--nav-pressed); }
.site-header :is(a, button):focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.profile-toggle { position: relative; }
.profile-caret, .filter-caret {
  width: 7px;
  height: 7px;
  margin: -4px 2px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.profile-toggle[aria-expanded="true"] .profile-caret,
.filter-toggle[aria-expanded="true"] .filter-caret {
  margin-top: 4px;
  transform: rotate(225deg);
}
.profile-unread {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 36px));
  max-height: calc(100dvh - var(--header-height) - 24px);
  overflow-y: auto;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.profile-dropdown[hidden] { display: none; }
.profile-dropdown ul { list-style: none; padding: 0; margin: 0; }
.site-header .profile-dropdown .nav-action {
  width: 100%;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
}
.profile-logout { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }
.catalog-filter-panel, .filters-sticky { position: sticky; z-index: 10; top: var(--header-height); background: var(--cream); }
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.filter-toggle[hidden], .filters[hidden] { display: none; }
.filter-toggle:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.messages { top: calc(var(--header-height) + 10px); max-width: calc(100vw - 36px); }
.messages.cart-messages { max-height: calc(100dvh - var(--header-height) - 28px); }
.comments-section, .comment, .comment-form { scroll-margin-top: calc(var(--header-height) + 16px); }
.profile-details { margin: 20px 0 0; }
.profile-details dt { color: var(--muted); margin-top: 16px; }
.profile-details dd { margin: 4px 0 0; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .site-header nav { gap: 4px; }
  .site-header .nav-action { font-size: 14px; padding-inline: 8px; }
  .site-header nav > .nav-action,
  .site-header .profile-toggle { width: 44px; padding: 0; gap: 0; }
  .site-header .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .profile-caret { display: none; }
  .cart-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    padding: 1px 4px;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
  }
}

@media (max-width: 479px) {
  .brand img { width: 96px; height: 64px; }
}
