.site-header {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(280px, 600px) auto;
  align-items: center;
  height: var(--header-height);
  padding: 0 22px;
  gap: 18px;
  border-bottom: 1px solid var(--color-line);
  background: color-mix(in srgb, var(--color-surface) 96%, transparent);
  backdrop-filter: blur(16px);
}

.header-left,
.header-right,
.site-brand,
.header-search,
.header-switcher,
.icon-button {
  display: flex;
  align-items: center;
}

.header-left {
  min-width: 0;
  height: 100%;
  gap: 10px;
}

.header-icon {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.site-brand {
  min-width: max-content;
  gap: 8px;
  font-family: "Cormorant Garamond", serif;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-brand em {
  color: var(--color-brand);
  font-style: normal;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 6px 16px rgb(201 0 107 / 20%);
  place-items: center;
}

.brand-mark .header-icon {
  width: 16px;
  height: 16px;
}

.icon-button {
  position: relative;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-soft);
  cursor: pointer;
}

.icon-button:hover,
.icon-button.is-soft {
  background: var(--color-surface-muted);
}

.icon-button:focus-visible,
.header-search:focus-within,
.header-switcher:focus-within {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.header-search {
  justify-self: center;
  width: min(100%, 600px);
  height: 42px;
  padding: 0 4px 0 16px;
  gap: 8px;
  border: 1px solid var(--color-line-strong);
  border-radius: 12px;
  background: var(--color-bg);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.header-search:focus-within {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgb(201 0 107 / 8%);
  outline: 0;
}

.header-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
}

.header-search input::placeholder {
  color: var(--color-faint);
}

.header-search .search-submit {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  background: var(--gradient-brand);
  color: #fff;
  cursor: pointer;
  place-items: center;
}

.header-search .search-submit .header-icon {
  width: 18px;
  height: 18px;
}

.header-right {
  justify-content: flex-end;
  height: 100%;
  gap: 7px;
}

.header-switcher {
  position: relative;
  min-height: 42px;
  padding: 5px 9px;
  gap: 8px;
  border: 1px solid var(--color-line);
  border-radius: 11px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  cursor: pointer;
}

.header-switcher:hover {
  border-color: var(--color-line-strong);
  background: var(--color-surface-muted);
}

.header-switcher.is-enhanced {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.switcher-trigger {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 5px 9px;
  gap: 8px;
  border: 1px solid var(--color-line);
  border-radius: 11px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  cursor: pointer;
}

.switcher-trigger:hover,
.header-switcher.is-open .switcher-trigger {
  border-color: var(--color-line-strong);
  background: var(--color-surface-muted);
}

.switcher-trigger:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.header-switcher > .header-icon:first-child {
  width: 18px;
  height: 18px;
  color: var(--color-brand);
}

.switcher-trigger > .header-icon:first-child {
  width: 18px;
  height: 18px;
  color: var(--color-brand);
}

.switcher-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1;
}

.switcher-copy small {
  margin-bottom: 3px;
  color: var(--color-faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.switcher-copy select {
  min-width: 72px;
  padding: 0;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--color-text);
  font: 600 11px/1 "Inter", sans-serif;
  cursor: pointer;
}

.language-switcher .switcher-copy select {
  min-width: 38px;
}

.switcher-current {
  min-width: 72px;
  color: var(--color-text);
  font: 600 11px/1 "Inter", sans-serif;
}

.language-switcher .switcher-current {
  min-width: 38px;
}

.switcher-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-faint);
  transition: transform 160ms ease;
}

.header-switcher.is-open .switcher-chevron {
  transform: rotate(180deg);
}

.switcher-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 7px);
  right: 0;
  min-width: 100%;
  padding: 6px;
  border: 1px solid var(--color-line);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.switcher-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.switcher-option:hover,
.switcher-option:focus-visible {
  background: var(--color-surface-muted);
  outline: 0;
}

.switcher-option[aria-selected="true"] {
  background: var(--color-brand-soft);
  color: var(--color-brand);
}

.switcher-option[aria-selected="true"]::after {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: currentcolor;
  content: "";
}

.header-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  place-items: center;
}

.header-avatar.is-guest {
  border: 1px solid var(--color-line-strong);
  background: var(--color-surface-muted);
  color: var(--color-text-soft);
}

.notification-button.has-unread::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  background: var(--color-brand);
  content: "";
}

.header-popover {
  position: fixed;
  z-index: 130;
  width: min(350px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: var(--color-surface);
  box-shadow: 0 20px 50px rgb(56 19 42 / 18%);
}

.popover-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 18px 14px;
  gap: 16px;
  border-bottom: 1px solid var(--color-line);
}

.popover-heading small {
  color: var(--color-brand);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.3px;
}

.popover-heading h2,
.guest-account-intro h2 {
  margin: 3px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  line-height: 1;
}

.popover-text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-brand);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.notification-list {
  display: grid;
  max-height: min(420px, calc(100vh - 130px));
  overflow-y: auto;
}

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  padding: 13px 18px;
  gap: 11px;
  border-bottom: 1px solid var(--color-line);
}

.notification-item:hover {
  background: var(--color-surface-soft);
}

.notification-item.is-unread {
  background: color-mix(in srgb, var(--color-brand-soft) 62%, var(--color-surface));
}

.notification-item.is-unread::after {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-brand);
  content: "";
  transform: translateY(-50%);
}

.notification-avatar,
.account-summary-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  place-items: center;
}

.notification-avatar.is-reel {
  background: linear-gradient(135deg, #4c2fd4, #a448ef);
}

.notification-avatar.is-system {
  background: var(--color-text-soft);
}

.notification-item > span:last-child {
  display: grid;
  padding-right: 10px;
  color: var(--color-text-soft);
  font-size: 12px;
  line-height: 1.35;
}

.notification-item small,
.account-summary small,
.account-menu small {
  margin-top: 3px;
  color: var(--color-faint);
  font-size: 10px;
}

.popover-empty {
  display: grid;
  justify-items: center;
  padding: 28px 24px;
  text-align: center;
}

.popover-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border-radius: 15px;
  background: var(--color-brand-soft);
  color: var(--color-brand);
  place-items: center;
}

.popover-empty-icon svg,
.guest-account-intro svg,
.account-menu svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popover-empty p,
.guest-account-intro p {
  margin: 7px 0 16px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
}

.popover-primary-action {
  width: 100%;
}

.account-popover {
  width: min(320px, calc(100vw - 24px));
}

.account-summary {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  padding: 18px;
  gap: 12px;
  border-bottom: 1px solid var(--color-line);
}

.account-summary-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
}

.account-summary > span:last-child {
  display: grid;
  min-width: 0;
}

.account-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  display: grid;
  padding: 7px;
}

.account-menu a,
.account-menu button {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-soft);
  text-align: left;
  cursor: pointer;
}

.account-menu a:hover,
.account-menu button:hover {
  background: var(--color-surface-muted);
}

.account-menu svg {
  width: 19px;
  height: 19px;
  color: var(--color-brand);
}

.account-menu span {
  display: grid;
  font-size: 12px;
  font-weight: 600;
}

.account-menu button:last-child {
  margin-top: 5px;
  border-top: 1px solid var(--color-line);
  border-radius: 0 0 9px 9px;
  color: #b3264a;
}

.guest-account-intro {
  display: grid;
  justify-items: center;
  padding: 24px 22px 16px;
  text-align: center;
}

.guest-account-intro .account-summary-avatar {
  margin-bottom: 13px;
  border-radius: 14px;
  background: var(--color-brand-soft);
  color: var(--color-brand);
}

.guest-account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0 14px 14px;
  gap: 8px;
}

.guest-account-actions .button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 12px;
}

.mobile-search-button {
  display: none;
}

@media (max-width: 1179px) {
  .site-header {
    grid-template-columns: 176px minmax(220px, 1fr) auto;
    padding: 0 18px;
    gap: 12px;
  }

  .site-brand {
    font-size: 20px;
  }

  .header-search {
    width: 100%;
  }

  .switcher-copy small {
    display: none;
  }

  .header-switcher {
    min-height: 38px;
    padding: 0 8px;
    gap: 6px;
  }

  .header-switcher.is-enhanced {
    min-height: 0;
    padding: 0;
  }

  .switcher-trigger {
    min-height: 38px;
    padding: 0 8px;
    gap: 6px;
  }
}

@media (max-width: 979px) {
  .site-header {
    grid-template-columns: 170px minmax(180px, 1fr) auto;
  }

  .language-switcher {
    display: none;
  }
}

@media (max-width: 767px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
    gap: 6px;
  }

  .site-brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 27px;
    height: 27px;
    border-radius: 7px;
  }

  .header-search,
  .header-switcher,
  .theme-button {
    display: none;
  }

  .header-right {
    grid-column: 3;
    gap: 4px;
  }

  .header-right .icon-button {
    width: 36px;
    height: 36px;
  }

  .mobile-search-button {
    display: flex;
  }
}

@media (max-width: 379px) {
  .site-brand > span:last-child {
    display: none;
  }
}
