.site-header {
  position: relative;
  z-index: 20;
  height: 83px;
  padding-top: 24px;
  background: var(--surface);
}

.site-header .container {
  position: relative;
  width: calc(100vw - (var(--gutter) * 2));
  max-width: var(--container);
  margin: 0 auto;
}

.main-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(24px, 4.85vw, 77.5px);
  width: 100%;
  font-size: 16px;
  line-height: 19px;
  font-weight: 600;
  letter-spacing: 0.016em;
  text-transform: uppercase;
  white-space: nowrap;
}

.main-nav a {
  position: relative;
  padding-top: 13px;
  color: var(--ink, var(--text));
}

.main-nav a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: #d9d9d9;
  transition: background 180ms ease, height 180ms ease;
}

.main-nav a:hover::before,
.main-nav a[aria-current="page"]::before {
  height: 2px;
  background: var(--accent);
}

.mobile-header-logo {
  display: none;
}

.menu-toggle {
  position: relative;
  z-index: 40;
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line, var(--border, rgba(34, 34, 34, 0.1)));
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink, var(--text));
  align-items: center;
  justify-content: center;
  transition: border-color 180ms ease, background 180ms ease;
}

.menu-toggle:hover {
  border-color: var(--accent);
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  transition: transform 220ms ease, opacity 180ms ease;
}

.menu-toggle span {
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before {
  transform: translateY(-7px);
}

.menu-toggle span::after {
  transform: translateY(7px);
}

.menu-toggle[aria-expanded="true"] span {
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span::before {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span::after {
  transform: rotate(90deg);
}

.main-nav a:focus-visible,
.menu-toggle:focus-visible,
.mobile-header-logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 1700px) {
  .main-nav {
    gap: clamp(24px, 3vw, 58px);
    font-size: 14px;
  }
}

@media (max-width: 1180px) {
  .site-header {
    height: 74px;
    padding-top: 14px;
  }

  body.menu-open .site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    width: 100%;
  }

  .site-header .container {
    display: flex;
    justify-content: flex-end;
    width: calc(100vw - 40px);
    margin: 0 auto;
  }

  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    inset: 0 0 auto 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    min-height: 100vh;
    padding: 92px 28px 40px;
    background: rgba(255, 255, 255, 0.98);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 260ms ease, opacity 220ms ease;
    white-space: normal;
  }

  .main-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .main-nav a {
    padding: 17px 0;
    border-bottom: 1px solid rgba(34, 34, 34, 0.08);
    font-size: 18px;
    line-height: 1.25;
  }

  .main-nav a::before {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 62px;
    padding-top: 8px;
  }

  .site-header .container {
    width: calc(100vw - 32px);
    align-items: center;
    justify-content: space-between;
  }

  .mobile-header-logo {
    position: relative;
    z-index: 2;
    display: inline-flex;
    width: auto;
    max-width: calc(100vw - 92px);
    height: 46px;
    align-items: center;
    gap: 10px;
    margin-left: 0;
    background: transparent;
    color: var(--ink, var(--text));
    text-decoration: none;
    touch-action: manipulation;
  }

  .mobile-header-portrait {
    display: block;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    overflow: hidden;
    border: 1px solid color-mix(in oklch, var(--accent) 24%, transparent);
    border-radius: 50%;
  }

  .mobile-header-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mobile-header-name {
    overflow: hidden;
    font-size: 16px;
    line-height: 20px;
    font-weight: 600;
    letter-spacing: 0.1px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .menu-toggle {
    position: relative;
    z-index: 2;
    touch-action: manipulation;
  }

  .main-nav {
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(76px, calc(62px + env(safe-area-inset-top, 0px))) 20px max(24px, env(safe-area-inset-bottom, 0px));
  }
}
